Poster of Linux kernelThe best gift for a Linux geek
PointLocatorBase

PointLocatorBase

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

PointLocatorBase -  

SYNOPSIS


#include <point_locator_base.h>

Inherits ReferenceCountedObject< PointLocatorBase >.

Inherited by PointLocatorList, and PointLocatorTree.  

Public Member Functions


virtual ~PointLocatorBase ()

virtual void clear ()=0

virtual void init ()=0

virtual const Elem * operator() (const Point &p) const =0

bool initialized () const

virtual void enable_out_of_mesh_mode (void)=0

virtual void disable_out_of_mesh_mode (void)=0
 

Static Public Member Functions


static AutoPtr< PointLocatorBase > build (const PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=NULL)

static std::string get_info ()

static void print_info ()

static unsigned int n_objects ()
 

Protected Types


typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 

Protected Member Functions


PointLocatorBase (const MeshBase &mesh, const PointLocatorBase *master)

void increment_constructor_count (const std::string &name)

void increment_destructor_count (const std::string &name)
 

Protected Attributes


const PointLocatorBase * _master

const MeshBase & _mesh

bool _initialized
 

Static Protected Attributes


static Counts _counts

static Threads::atomic< unsigned int > _n_objects

static Threads::spin_mutex _mutex
 

Detailed Description

This is the base class for point locators. They locate points in space: given a mesh they return the element and local coordinates for a given point in global coordinates.

Author:

Daniel Dreyer, 2003

Definition at line 57 of file point_locator_base.h.  

Member Typedef Documentation

 

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.

Definition at line 105 of file reference_counter.h.  

Constructor & Destructor Documentation

 

PointLocatorBase::PointLocatorBase (const MeshBase &mesh, const PointLocatorBase *master) [protected]Constructor. Protected so that this base class cannot be explicitly instantiated. Takes a master PointLocator that helps in saving memory.

Definition at line 35 of file point_locator_base.C.

                                                                    :
  _master                  (master),
  _mesh                    (mesh),
  _initialized             (false)
{
}
 

PointLocatorBase::~PointLocatorBase () [virtual]Destructor.

Definition at line 47 of file point_locator_base.C.

{
}
 

Member Function Documentation

 

AutoPtr< PointLocatorBase > PointLocatorBase::build (const PointLocatorTypet, const MeshBase &mesh, const PointLocatorBase *master = NULL) [static]Builds an PointLocator for the mesh mesh. Optionally takes a master PointLocator to save memory. An AutoPtr<PointLocatorBase> is returned to prevent memory leak. This way the user need not remember to delete the object.

Definition at line 55 of file point_locator_base.C.

References MeshEnums::LIST, and MeshEnums::TREE.

Referenced by MeshBase::point_locator().

{
  switch (t)
    {
    case TREE:
      {
        AutoPtr<PointLocatorBase> ap(new PointLocatorTree(mesh,
                                                          master));
        return ap;
      }

    case LIST:
      {
        AutoPtr<PointLocatorBase> ap(new PointLocatorList(mesh,
                                                          master));
        return ap;
      }

    default:
      {
        std::cerr << 'ERROR: Bad PointLocatorType = ' << t << std::endl;
        libmesh_error();
      }
    }

  libmesh_error();
  AutoPtr<PointLocatorBase> ap(NULL);
  return ap;
}
 

virtual void PointLocatorBase::clear () [pure virtual]Clears the PointLocator.

Implemented in PointLocatorList, and PointLocatorTree.  

virtual void PointLocatorBase::disable_out_of_mesh_mode (void) [pure virtual]Disables out-of-mesh mode (default). If asked to find a point that is contained in no mesh at all, the point locator will now crash.

Implemented in PointLocatorList, and PointLocatorTree.

Referenced by MeshFunction::disable_out_of_mesh_mode().  

virtual void PointLocatorBase::enable_out_of_mesh_mode (void) [pure virtual]Enables out-of-mesh mode. In this mode, if asked to find a point that is contained in no mesh at all, the point locator will return a NULL pointer instead of crashing. Per default, this mode is off.

Implemented in PointLocatorList, and PointLocatorTree.

Referenced by MeshFunction::enable_out_of_mesh_mode().  

std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.

Definition at line 45 of file reference_counter.C.

References ReferenceCounter::_counts, and Quality::name().

Referenced by ReferenceCounter::print_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream out;
  
  out << '
      << ' ---------------------------------------------------------------------------- 
      << '| Reference count information                                                |
      << ' ---------------------------------------------------------------------------- ;
  
  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      out << '| ' << name << ' reference count information:
          << '|  Creations:    ' << creations    << '
          << '|  Destructions: ' << destructions << ';
    }
  
  out << ' ---------------------------------------------------------------------------- ;

  return out.str();

#else

  return '';
  
#endif
}
 

void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 149 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
 

void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 167 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
 

virtual void PointLocatorBase::init () [pure virtual]Initializes the point locator, so that the operator() methods can be used. Pure virtual.

Implemented in PointLocatorList, and PointLocatorTree.  

bool PointLocatorBase::initialized () const [inline]Returns:

true when this object is properly initialized and ready for use, false otherwise.

Definition at line 150 of file point_locator_base.h.

References _initialized.

Referenced by PointLocatorTree::init(), and PointLocatorList::init().

{
  return (this->_initialized);
}
 

static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 76 of file reference_counter.h.

References ReferenceCounter::_n_objects.

Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().

  { return _n_objects; }
 

virtual const Elem* PointLocatorBase::operator() (const Point &p) const [pure virtual]Locates the element in which the point with global coordinates p is located. Pure virtual.

Implemented in PointLocatorList, and PointLocatorTree.  

void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.

Definition at line 83 of file reference_counter.C.

References ReferenceCounter::get_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
  
  std::cout << ReferenceCounter::get_info();
  
#endif
}
 

Member Data Documentation

 

ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.

Definition at line 110 of file reference_counter.h.

Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().  

bool PointLocatorBase::_initialized [protected]true when properly initialized, false otherwise.

Definition at line 142 of file point_locator_base.h.

Referenced by PointLocatorTree::init(), PointLocatorList::init(), initialized(), PointLocatorTree::operator()(), and PointLocatorList::operator()().  

const PointLocatorBase* PointLocatorBase::_master [protected]Const pointer to our master, initialized to NULL if none given. When using multiple PointLocators, one can be assigned master and be in charge of something that all can have access to.

Definition at line 132 of file point_locator_base.h.

Referenced by PointLocatorTree::clear(), PointLocatorList::clear(), PointLocatorTree::init(), and PointLocatorList::init().  

const MeshBase& PointLocatorBase::_mesh [protected]constant reference to the mesh in which the point is looked for.

Definition at line 137 of file point_locator_base.h.

Referenced by PointLocatorTree::enable_out_of_mesh_mode(), PointLocatorTree::init(), PointLocatorList::init(), and PointLocatorTree::operator()().  

Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.

Definition at line 123 of file reference_counter.h.  

Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.

Definition at line 118 of file reference_counter.h.

Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Types
Protected Member Functions
Protected Attributes
Static Protected Attributes
Detailed Description
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
Constructor & Destructor Documentation
PointLocatorBase::PointLocatorBase (const MeshBase &mesh, const PointLocatorBase *master) [protected]Constructor. Protected so that this base class cannot be explicitly instantiated. Takes a master PointLocator that helps in saving memory.
PointLocatorBase::~PointLocatorBase () [virtual]Destructor.
Member Function Documentation
AutoPtr< PointLocatorBase > PointLocatorBase::build (const PointLocatorTypet, const MeshBase &mesh, const PointLocatorBase *master = NULL) [static]Builds an PointLocator for the mesh mesh. Optionally takes a master PointLocator to save memory. An AutoPtr<PointLocatorBase> is returned to prevent memory leak. This way the user need not remember to delete the object.
virtual void PointLocatorBase::clear () [pure virtual]Clears the PointLocator.
virtual void PointLocatorBase::disable_out_of_mesh_mode (void) [pure virtual]Disables out-of-mesh mode (default). If asked to find a point that is contained in no mesh at all, the point locator will now crash.
virtual void PointLocatorBase::enable_out_of_mesh_mode (void) [pure virtual]Enables out-of-mesh mode. In this mode, if asked to find a point that is contained in no mesh at all, the point locator will return a NULL pointer instead of crashing. Per default, this mode is off.
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
virtual void PointLocatorBase::init () [pure virtual]Initializes the point locator, so that the operator() methods can be used. Pure virtual.
bool PointLocatorBase::initialized () const [inline]Returns:
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
virtual const Elem* PointLocatorBase::operator() (const Point &p) const [pure virtual]Locates the element in which the point with global coordinates p is located. Pure virtual.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
bool PointLocatorBase::_initialized [protected]true when properly initialized, false otherwise.
const PointLocatorBase* PointLocatorBase::_master [protected]Const pointer to our master, initialized to NULL if none given. When using multiple PointLocators, one can be assigned master and be in charge of something that all can have access to.
const MeshBase& PointLocatorBase::_mesh [protected]constant reference to the mesh in which the point is looked for.
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
Author

This document was created by man2html, using the manual pages.
Time: 21:52:48 GMT, April 16, 2011