Elem Class Reference

#include <elem.h>

Inheritance diagram for Elem:

List of all members.

Public Types

enum  RefinementState {
  COARSEN = 0, DO_NOTHING, REFINE, JUST_REFINED,
  JUST_COARSENED, INACTIVE, COARSEN_INACTIVE
}
typedef Predicates::multi_predicate Predicate

Public Member Functions

virtual ~Elem ()
virtual const Pointpoint (const unsigned int i) const
virtual Pointpoint (const unsigned int i)
virtual unsigned int node (const unsigned int i) const
virtual Nodeget_node (const unsigned int i) const
virtual Node *& set_node (const unsigned int i)
subdomain_id_type subdomain_id () const
subdomain_id_typesubdomain_id ()
virtual unsigned int key (const unsigned int s) const =0
virtual bool operator== (const DofObject &rhs) const
Elemneighbor (const unsigned int i) const
void set_neighbor (const unsigned int i, Elem *n)
bool has_neighbor (const Elem *elem) const
Elemchild_neighbor (Elem *elem) const
const Elemchild_neighbor (const Elem *elem) const
bool on_boundary () const
unsigned int which_neighbor_am_i (const Elem *e) const
bool contains_vertex_of (const Elem *e) const
bool contains_edge_of (const Elem *e) const
void find_point_neighbors (std::set< const Elem * > &neighbor_set) const
void find_edge_neighbors (std::set< const Elem * > &neighbor_set) const
void make_links_to_me_remote ()
virtual bool is_remote () const
virtual void connectivity (const unsigned int sc, const IOPackage iop, std::vector< unsigned int > &conn) const =0
void write_connectivity (std::ostream &out, const IOPackage iop) const
virtual ElemType type () const =0
virtual unsigned int dim () const =0
virtual unsigned int n_nodes () const =0
virtual unsigned int n_sides () const =0
virtual unsigned int n_neighbors () const
virtual unsigned int n_vertices () const =0
virtual unsigned int n_edges () const =0
virtual unsigned int n_faces () const =0
virtual unsigned int n_children () const =0
virtual bool is_vertex (const unsigned int i) const =0
virtual bool is_edge (const unsigned int i) const =0
virtual bool is_face (const unsigned int i) const =0
virtual bool is_node_on_side (const unsigned int n, const unsigned int s) const =0
virtual bool is_node_on_edge (const unsigned int n, const unsigned int e) const =0
virtual unsigned int n_sub_elem () const =0
virtual AutoPtr< DofObjectside (const unsigned int i) const =0
virtual AutoPtr< Elembuild_side (const unsigned int i, bool proxy=true) const =0
virtual AutoPtr< Elembuild_edge (const unsigned int i) const =0
virtual Order default_order () const =0
virtual Point centroid () const
virtual Real hmin () const
virtual Real hmax () const
virtual Real volume () const
virtual Real quality (const ElemQuality q) const
virtual std::pair< Real, Realqual_bounds (const ElemQuality) const
virtual bool contains_point (const Point &p) const
virtual bool has_affine_map () const
bool active () const
bool ancestor () const
bool subactive () const
bool has_children () const
bool has_ancestor_children () const
bool is_ancestor_of (const Elem *descendant) const
const Elemparent () const
Elemparent ()
void set_parent (Elem *p)
const Elemtop_parent () const
const Eleminterior_parent () const
Real length (const unsigned int n1, const unsigned int n2) const
virtual unsigned int n_second_order_adjacent_vertices (const unsigned int n) const
virtual unsigned short int second_order_adjacent_vertex (const unsigned int n, const unsigned int v) const
virtual std::pair< unsigned
short int, unsigned short int > 
second_order_child_vertex (const unsigned int n) const
unsigned int level () const
unsigned int p_level () const
Elemchild (const unsigned int i) const
unsigned int which_child_am_i (const Elem *e) const
virtual bool is_child_on_side (const unsigned int c, const unsigned int s) const =0
virtual bool is_child_on_edge (const unsigned int c, const unsigned int e) const
void add_child (Elem *elem)
void add_child (Elem *elem, unsigned int c)
void family_tree (std::vector< const Elem * > &family, const bool reset=true) const
void active_family_tree (std::vector< const Elem * > &active_family, const bool reset=true) const
void family_tree_by_side (std::vector< const Elem * > &family, const unsigned int side, const bool reset=true) const
void active_family_tree_by_side (std::vector< const Elem * > &family, const unsigned int side, const bool reset=true) const
void family_tree_by_neighbor (std::vector< const Elem * > &family, const Elem *neighbor, const bool reset=true) const
void family_tree_by_subneighbor (std::vector< const Elem * > &family, const Elem *neighbor, const Elem *subneighbor, const bool reset=true) const
void active_family_tree_by_neighbor (std::vector< const Elem * > &family, const Elem *neighbor, const bool reset=true) const
RefinementState refinement_flag () const
void set_refinement_flag (const RefinementState rflag)
RefinementState p_refinement_flag () const
void set_p_refinement_flag (const RefinementState pflag)
unsigned int max_descendant_p_level () const
unsigned int min_p_level_by_neighbor (const Elem *neighbor, unsigned int current_min) const
unsigned int min_new_p_level_by_neighbor (const Elem *neighbor, unsigned int current_min) const
void set_p_level (const unsigned int p)
void hack_p_level (const unsigned int p)
virtual void refine (MeshRefinement &mesh_refinement)
void coarsen ()
void contract ()
void libmesh_assert_valid_neighbors () const
void libmesh_assert_valid_node_pointers () const
side_iterator boundary_sides_begin ()
side_iterator boundary_sides_end ()
virtual bool infinite () const =0
virtual Point origin () const
virtual float embedding_matrix (const unsigned int i, const unsigned int j, const unsigned int k) const =0
void clear_old_dof_object ()
void set_old_dof_object ()
void clear_dofs ()
void invalidate_dofs (const unsigned int sys_num=libMesh::invalid_uint)
void invalidate_id ()
void invalidate_processor_id ()
void invalidate ()
unsigned int n_dofs (const unsigned int s, const unsigned int var=libMesh::invalid_uint) const
unsigned int id () const
unsigned int & set_id ()
void set_id (const unsigned int id)
bool valid_id () const
unsigned short int processor_id () const
unsigned short int & processor_id ()
void processor_id (const unsigned int id)
bool valid_processor_id () const
unsigned int n_systems () const
void set_n_systems (const unsigned int s)
void add_system ()
unsigned int n_vars (const unsigned int s) const
void set_n_vars (const unsigned int s, const unsigned int nvars)
unsigned int n_comp (const unsigned int s, const unsigned int var) const
void set_n_comp (const unsigned int s, const unsigned int var, const unsigned int ncomp)
unsigned int dof_number (const unsigned int s, const unsigned int var, const unsigned int comp) const
void set_dof_number (const unsigned int s, const unsigned int var, const unsigned int comp, const unsigned int dn)
bool has_dofs (const unsigned int s=libMesh::invalid_uint) const

Static Public Member Functions

static ElemType second_order_equivalent_type (const ElemType et, const bool full_ordered=true)
static ElemType first_order_equivalent_type (const ElemType et)
static AutoPtr< Elembuild (const ElemType type, Elem *p=NULL)
static std::string get_info ()
static void print_info ()
static unsigned int n_objects ()
static std::string get_info ()
static void print_info ()
static unsigned int n_objects ()

Public Attributes

DofObjectold_dof_object

Static Public Attributes

static const unsigned int type_to_n_nodes_map [INVALID_ELEM]
static const unsigned int invalid_id = libMesh::invalid_uint
static const unsigned short int invalid_processor_id = static_cast<unsigned short int>(-1)

Protected Types

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

Protected Member Functions

 Elem (const unsigned int n_nodes=0, const unsigned int n_sides=0, Elem *parent=NULL)
void nullify_neighbors ()
void increment_constructor_count (const std::string &name)
void increment_destructor_count (const std::string &name)
void increment_constructor_count (const std::string &name)
void increment_destructor_count (const std::string &name)

Static Protected Member Functions

static unsigned int compute_key (unsigned int n0)
static unsigned int compute_key (unsigned int n0, unsigned int n1)
static unsigned int compute_key (unsigned int n0, unsigned int n1, unsigned int n2)
static unsigned int compute_key (unsigned int n0, unsigned int n1, unsigned int n2, unsigned int n3)

Protected Attributes

Node ** _nodes
Elem ** _neighbors
Elem_parent
Elem ** _children
unsigned char _rflag
unsigned char _pflag
unsigned char _p_level
subdomain_id_type _sbd_id

Static Protected Attributes

static Counts _counts
static Threads::atomic
< unsigned int > 
_n_objects
static Threads::spin_mutex _mutex
static Counts _counts
static Threads::atomic
< unsigned int > 
_n_objects
static Threads::spin_mutex _mutex

Private Member Functions

SideIter _first_side ()
SideIter _last_side ()
unsigned int _cast_node_address_to_unsigned_int (const unsigned int n)

Static Private Attributes

static const unsigned int _bp1 = 65449
static const unsigned int _bp2 = 48661

Friends

class MeshRefinement


Detailed Description

This is the base class from which all geometric entities (elements) are derived. The Elem class contains information that every entity might need, such as its number of nodes and pointers to the nodes to which it is connected. This class also provides virtual functions that will be overloaded by derived classes. These functions provide information such as the number of sides the element has, who its neighbors are, how many children it might have, and who they are.

In an Elem becomes an Edge in 1D, a Face in 2D, and a Cell in 3D. An Elem is composed of a number of sides, which you may access as Elem types in dimension D-1. For example, a concrete element type in 3D is a Hex8, which is a hexahedral. A Hex8 has 6 sides, which are Faces. You may access these sides.

An Elem is composed of a number of Node objects. Some of these nodes live at the vertices of the element, and others may live on edges (and faces in 3D) or interior to the element. The number of vertices an element contains n_vertices() is determined strictly by the type of geometric object it corresponds to. For example, a Tri is a type of Face that always contains 3 vertices. A Tri3 is a specific triangular element type with three 3 nodes, all located at the vertices. A Tri6 is another triangular element with 6 nodes, 3 of which are located at vertices and another 3 that live on the edges. In all that follows, nodes that live either on edges, faces or the interior are named second-order nodes.

Author:
Benjamin S. Kirk, 2002-2007

Definition at line 84 of file elem.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.

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.

Useful iterator typedefs

Definition at line 857 of file elem.h.


Member Enumeration Documentation

Useful ENUM describing the refinement state of an element.

Enumerator:
COARSEN 
DO_NOTHING 
REFINE 
JUST_REFINED 
JUST_COARSENED 
INACTIVE 
COARSEN_INACTIVE 

Definition at line 640 of file elem.h.

00640                        { COARSEN = 0,
00641                          DO_NOTHING,
00642                          REFINE,
00643                          JUST_REFINED,
00644                          JUST_COARSENED,
00645                          INACTIVE,
00646                          COARSEN_INACTIVE };


Constructor & Destructor Documentation

Elem::Elem ( const unsigned int  n_nodes = 0,
const unsigned int  n_sides = 0,
Elem parent = NULL 
) [inline, protected]

Constructor. Creates an element with n_nodes nodes, n_sides sides, n_children possible children, and parent p. The constructor allocates the memory necessary to support this data.

Definition at line 1071 of file elem.h.

References _children, _neighbors, _nodes, DO_NOTHING, DofObject::invalid_processor_id, p_level(), parent(), DofObject::processor_id(), set_p_level(), set_p_refinement_flag(), set_refinement_flag(), and subdomain_id().

01073                     :
01074   _parent(p)
01075 #ifdef LIBMESH_ENABLE_AMR
01076   , _p_level(0)
01077 #endif
01078 {
01079   this->subdomain_id() = 0;
01080   this->processor_id() = DofObject::invalid_processor_id;
01081   
01082   // Initialize the nodes data structure
01083   _nodes = NULL;
01084   
01085   if (nn != 0)
01086     {
01087       _nodes = new Node*[nn]; 
01088       
01089       for (unsigned int n=0; n<nn; n++)
01090         _nodes[n] = NULL;
01091     }
01092   
01093   // Initialize the neighbors data structure
01094   _neighbors = NULL;
01095   
01096   if (ns != 0)
01097     {
01098       _neighbors = new Elem*[ns]; 
01099       
01100       for (unsigned int n=0; n<ns; n++)
01101         _neighbors[n] = NULL;
01102     }
01103 
01104   // Optionally initialize data from the parent
01105   if (this->parent() != NULL)
01106     {
01107       this->subdomain_id() = this->parent()->subdomain_id();
01108       this->processor_id() = this->parent()->processor_id();
01109     }  
01110 
01111 #ifdef LIBMESH_ENABLE_AMR
01112   
01113   _children = NULL;
01114 
01115   this->set_refinement_flag(Elem::DO_NOTHING);
01116 
01117   this->set_p_refinement_flag(Elem::DO_NOTHING);
01118 
01119   if (this->parent())
01120     this->set_p_level(parent()->p_level());
01121   else
01122     this->set_p_level(0);
01123 
01124 #endif
01125 }

Elem::~Elem (  )  [inline, virtual]

Destructor. Frees all the memory associated with the element.

Definition at line 1130 of file elem.h.

References _children, _neighbors, and _nodes.

01131 {
01132   // Delete my node storage
01133   if (_nodes != NULL)
01134     delete [] _nodes;
01135   _nodes = NULL;
01136 
01137   // Delete my neighbor storage
01138   if (_neighbors != NULL)
01139     delete [] _neighbors;
01140   _neighbors = NULL;
01141 
01142 #ifdef LIBMESH_ENABLE_AMR
01143 
01144   // Delete my children's storage
01145   if (_children != NULL)
01146     delete [] _children;
01147   _children = NULL;
01148   
01149 #endif
01150 }


Member Function Documentation

unsigned int Elem::_cast_node_address_to_unsigned_int ( const unsigned int  n  )  [private]

This function is used internally for node key generation. It handles casting of pointers on various architectures.

Definition at line 148 of file elem_refinement.C.

References get_node().

00149 {
00150   // An unsigned int associated with the
00151   // address of the node n.  We can't use the
00152   // node number since they can change, so we use the
00153   // Node's address.  (We also can't use the x,y,z
00154   // location of the node since that can change too!)
00155 
00156 #if LIBMESH_SIZEOF_INT == LIBMESH_SIZEOF_VOID_P
00157 
00158   // 32-bit machines
00159   const unsigned int n_id =
00160     reinterpret_cast<unsigned int>(this->get_node(n));
00161 
00162 #elif LIBMESH_SIZEOF_LONG_INT == LIBMESH_SIZEOF_VOID_P
00163 
00164   // 64-bit machines 
00165   // Another big prime number less than max_unsigned_int
00166   // for key creation on 64-bit machines
00167   const unsigned int bp3 = 4294967291;
00168   const unsigned int n_id =                     
00169     reinterpret_cast<long unsigned int>(this->get_node(n))%bp3;
00170 
00171 #else
00172   // Huh?
00173 #error                  WHAT KIND OF CRAZY MACHINE IS THIS? CANNOT COMPILE
00174 
00175 #endif
00176 
00177   return n_id;
00178 }

SideIter Elem::_first_side (  )  [private]

Side iterator helper functions. Used to replace the begin() and end() functions of the STL containers.

Referenced by boundary_sides_begin(), and is_ancestor_of().

SideIter Elem::_last_side (  )  [private]

bool Elem::active (  )  const [inline]

Returns:
true if the element is active (i.e. has no active descendants), false otherwise. Note that it suffices to check the first child only. Always returns true if AMR is disabled.

Definition at line 1316 of file elem.h.

References COARSEN_INACTIVE, INACTIVE, and refinement_flag().

Referenced by MeshRefinement::_coarsen_elements(), MetisPartitioner::_do_partition(), MeshRefinement::_refine_elements(), active_family_tree(), active_family_tree_by_neighbor(), active_family_tree_by_side(), DofMap::add_neighbors_to_send_list(), HPCoarsenTest::add_projection(), ancestor(), Patch::build_around_element(), ParmetisPartitioner::build_graph(), coarsen(), MeshRefinement::coarsen_elements(), FEBase::compute_periodic_constraints(), FEBase::compute_proj_constraints(), UnstructuredMesh::contract(), contract(), DofMap::dof_indices(), MeshRefinement::eliminate_unrefined_patches(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), family_tree(), family_tree_by_neighbor(), family_tree_by_side(), family_tree_by_subneighbor(), find_edge_neighbors(), Patch::find_face_neighbors(), UnstructuredMesh::find_neighbors(), find_point_neighbors(), MeshRefinement::flag_elements_by_nelem_target(), ErrorVector::is_active_elem(), is_ancestor_of(), MeshRefinement::make_coarsening_compatible(), MeshRefinement::make_refinement_compatible(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), DofMap::old_dof_indices(), PointLocatorTree::operator()(), PointLocatorList::operator()(), refine(), MeshRefinement::refine_and_coarsen_elements(), MeshRefinement::refine_elements(), subactive(), Parallel::sync_element_data_by_parent_id(), MeshRefinement::test_level_one(), ExodusII_IO_Helper::write_elements(), and DivaIO::write_stream().

01317 {
01318 #ifdef LIBMESH_ENABLE_AMR
01319   if ((this->refinement_flag() == INACTIVE) ||
01320       (this->refinement_flag() == COARSEN_INACTIVE))
01321     return false;
01322   else
01323     return true;
01324 #else
01325   return true;
01326 #endif
01327 }

void Elem::active_family_tree ( std::vector< const Elem * > &  active_family,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds the active children. Can be thought of as removing all the inactive elements from the vector created by family_tree, but is implemented more efficiently.

Definition at line 982 of file elem.C.

References active(), active_family_tree(), child(), is_remote(), n_children(), and subactive().

Referenced by MetisPartitioner::_do_partition(), active_family_tree(), and ParmetisPartitioner::build_graph().

00984 {
00985   // The "family tree" doesn't include subactive elements
00986   libmesh_assert(!this->subactive());
00987 
00988   // Clear the vector if the flag reset tells us to.
00989   if (reset)
00990     active_family.clear();
00991 
00992   // Add this element to the family tree if it is active
00993   if (this->active())
00994     active_family.push_back(this);
00995 
00996   // Otherwise recurse into the element's children.
00997   // Do not clear the vector any more.
00998   else 
00999     for (unsigned int c=0; c<this->n_children(); c++)
01000       if (!this->child(c)->is_remote())
01001         this->child(c)->active_family_tree (active_family, false);
01002 }

void Elem::active_family_tree_by_neighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const bool  reset = true 
) const

Same as the active_family_tree() member, but only adds elements which are next to neighbor.

Definition at line 1138 of file elem.C.

References active(), active_family_tree_by_neighbor(), child(), has_neighbor(), level(), n_children(), remote_elem, and subactive().

Referenced by active_family_tree_by_neighbor(), DofMap::add_neighbors_to_send_list(), find_edge_neighbors(), Patch::find_face_neighbors(), find_point_neighbors(), and SparsityPattern::Build::operator()().

01141 {
01142   // The "family tree" doesn't include subactive elements
01143   libmesh_assert(!this->subactive());
01144 
01145   // Clear the vector if the flag reset tells us to.
01146   if (reset)
01147     family.clear();
01148 
01149   // This only makes sense if we're already a neighbor
01150   if (this->level() >= neighbor->level())
01151     libmesh_assert (this->has_neighbor(neighbor));
01152 
01153   // Add an active element to the family tree.
01154   if (this->active())
01155     family.push_back(this);
01156 
01157   // Or recurse into an ancestor element's children.
01158   // Do not clear the vector any more.
01159   else if (!this->active())
01160     for (unsigned int c=0; c<this->n_children(); c++)
01161       {
01162         Elem *child = this->child(c);
01163         if (child != remote_elem && child->has_neighbor(neighbor))
01164           child->active_family_tree_by_neighbor (family, neighbor, false);
01165       }
01166 }

void Elem::active_family_tree_by_side ( std::vector< const Elem * > &  family,
const unsigned int  side,
const bool  reset = true 
) const

Same as the active_family_tree() member, but only adds elements which are next to side.

Definition at line 1033 of file elem.C.

References active(), active_family_tree_by_side(), child(), is_child_on_side(), n_children(), n_sides(), and subactive().

Referenced by active_family_tree_by_side().

01036 {
01037   // The "family tree" doesn't include subactive elements
01038   libmesh_assert(!this->subactive());
01039 
01040   // Clear the vector if the flag reset tells us to.
01041   if (reset)
01042     family.clear();
01043 
01044   libmesh_assert(s < this->n_sides());
01045 
01046   // Add an active element to the family tree.
01047   if (this->active())
01048     family.push_back(this);
01049 
01050   // Or recurse into an ancestor element's children.
01051   // Do not clear the vector any more.
01052   else
01053     for (unsigned int c=0; c<this->n_children(); c++)
01054       if (this->child(c)->is_child_on_side(c, s))
01055         this->child(c)->active_family_tree_by_side (family, s, false);
01056 }

void Elem::add_child ( Elem elem,
unsigned int  c 
)

Adds a new child pointer to the specified index in the array of children of this element. If this is the first child to be added, this method allocates memory in the parent's _children array, otherwise, it just sets the pointer.

Definition at line 925 of file elem.C.

References _children, n_children(), parent(), and remote_elem.

00926 {
00927   if(_children == NULL)
00928     {
00929       _children = new Elem*[this->n_children()];
00930       
00931       for (unsigned int i=0; i<this->n_children(); i++)
00932         _children[i] = NULL;
00933     }
00934   
00935   libmesh_assert (_children[c] == NULL || _children[c] == remote_elem);
00936   libmesh_assert (this == elem->parent());
00937 
00938   _children[c] = elem;
00939 }

void Elem::add_child ( Elem elem  ) 

Adds a child pointer to the array of children of this element. If this is the first child to be added, this method allocates memory in the parent's _children array, otherwise, it just sets the pointer.

Definition at line 898 of file elem.C.

References _children, n_children(), parent(), and remote_elem.

Referenced by UnstructuredMesh::all_first_order(), UnstructuredMesh::copy_nodes_and_elements(), LegacyXdrIO::read_mesh(), and XdrIO::read_serialized_connectivity().

00899 {
00900   if(_children == NULL)
00901     {
00902       _children = new Elem*[this->n_children()];
00903       
00904       for (unsigned int c=0; c<this->n_children(); c++)
00905         _children[c] = NULL;
00906     }
00907   
00908   for (unsigned int c=0; c<this->n_children(); c++)
00909     {
00910       if(_children[c] == NULL || _children[c] == remote_elem)
00911         {
00912           libmesh_assert (this == elem->parent());
00913           _children[c] = elem;
00914           return;
00915         }
00916     }
00917 
00918   std::cerr << "Error: Tried to add a child to an element with full children array"
00919             << std::endl;
00920   libmesh_error();
00921 }

void DofObject::add_system (  )  [inherited]

Adds an additional system to the DofObject

Definition at line 188 of file dof_object.C.

References DofObject::_dof_ids, DofObject::_n_systems, DofObject::_n_v_comp, and DofObject::n_systems().

00189 {
00190   if (this->n_systems() > 0)
00191     {
00192       // Copy the old systems to temporary storage
00193       unsigned char **old_n_v_comp = new unsigned char* [this->n_systems()];
00194       unsigned int  **old_dof_ids  = new unsigned int*  [this->n_systems()]; 
00195       
00196       for (unsigned int s=0; s<this->n_systems(); s++)
00197         {
00198           old_n_v_comp[s] = _n_v_comp[s];
00199           old_dof_ids[s]  = _dof_ids[s];
00200         }
00201       
00202       // Delete old storage
00203       libmesh_assert (_n_v_comp != NULL); delete [] _n_v_comp; _n_v_comp = NULL;
00204       libmesh_assert (_dof_ids  != NULL); delete [] _dof_ids;  _dof_ids  = NULL;
00205   
00206       // Allocate space for new system
00207       _n_v_comp= new unsigned char* [this->n_systems()+1];
00208       _dof_ids = new unsigned int*  [this->n_systems()+1];
00209       
00210       // Copy the other systems
00211       for (unsigned int s=0; s<this->n_systems(); s++)
00212         {
00213           _n_v_comp[s] = old_n_v_comp[s];
00214           _dof_ids[s]  = old_dof_ids[s];
00215         }
00216                
00217       // Delete temporary storage
00218       libmesh_assert (old_n_v_comp != NULL); delete [] old_n_v_comp; old_n_v_comp = NULL;
00219       libmesh_assert (old_dof_ids  != NULL); delete [] old_dof_ids;  old_dof_ids  = NULL;
00220     }
00221   else
00222     {
00223       libmesh_assert (_n_v_comp == NULL);
00224       libmesh_assert (_dof_ids  == NULL);
00225       
00226       // Allocate space for new system
00227       _n_v_comp = new unsigned char* [this->n_systems()+1];
00228       _dof_ids  = new unsigned int*  [this->n_systems()+1];      
00229     }
00230   
00231   // Initialize the new system
00232   _n_v_comp[this->n_systems()] = NULL;
00233   _dof_ids[this->n_systems()]  = NULL;
00234   
00235   // Done. Don't forget to increment the number of systems!
00236   _n_systems++;
00237 }

bool Elem::ancestor (  )  const

Returns:
true if the element is an ancestor (i.e. has an active child or ancestor child), false otherwise. Always returns false if AMR is disabled.

Definition at line 876 of file elem.C.

References active(), ancestor(), child(), and has_children().

Referenced by ancestor(), UnstructuredMesh::contract(), MeshRefinement::eliminate_unrefined_patches(), UnstructuredMesh::find_neighbors(), MeshRefinement::make_coarsening_compatible(), make_links_to_me_remote(), and refine().

00877 {
00878 #ifdef LIBMESH_ENABLE_AMR
00879 
00880   if (this->active())
00881     return false;
00882 
00883 if (!this->has_children())
00884     return false;
00885   if (this->child(0)->active())
00886     return true;
00887 
00888   return this->child(0)->ancestor();
00889 #else
00890   return false;
00891 #endif
00892 }

Elem::side_iterator Elem::boundary_sides_begin (  ) 

Iterator accessor functions

Definition at line 1473 of file elem.C.

References _first_side(), and _last_side().

01474 {
01475   Predicates::BoundarySide<SideIter> bsp;
01476   return side_iterator(this->_first_side(), this->_last_side(), bsp);
01477 }

Elem::side_iterator Elem::boundary_sides_end (  ) 

Definition at line 1482 of file elem.C.

References _last_side().

01483 {
01484   Predicates::BoundarySide<SideIter> bsp;
01485   return side_iterator(this->_last_side(), this->_last_side(), bsp);
01486 }

AutoPtr< Elem > Elem::build ( const ElemType  type,
Elem p = NULL 
) [static]

Build an element of type type. Since this method allocates memory the new Elem is returned in a AutoPtr<>

Definition at line 108 of file elem.C.

References libMeshEnums::EDGE2, libMeshEnums::EDGE3, libMeshEnums::EDGE4, libMeshEnums::HEX20, libMeshEnums::HEX27, libMeshEnums::HEX8, libMeshEnums::INFEDGE2, libMeshEnums::INFHEX16, libMeshEnums::INFHEX18, libMeshEnums::INFHEX8, libMeshEnums::INFPRISM12, libMeshEnums::INFPRISM6, libMeshEnums::INFQUAD4, libMeshEnums::INFQUAD6, libMeshEnums::PRISM15, libMeshEnums::PRISM18, libMeshEnums::PRISM6, libMeshEnums::PYRAMID5, libMeshEnums::QUAD4, libMeshEnums::QUAD8, libMeshEnums::QUAD9, libMeshEnums::TET10, libMeshEnums::TET4, libMeshEnums::TRI3, and libMeshEnums::TRI6.

Referenced by GMVIO::_read_one_cell(), UnstructuredMesh::all_first_order(), UnstructuredMesh::all_second_order(), UnstructuredMesh::copy_nodes_and_elements(), UnstructuredMesh::create_submesh(), MeshTools::Modification::flatten(), Nemesis_IO::read(), ExodusII_IO::read(), GmshIO::read_mesh(), XdrIO::read_serialized_connectivity(), refine(), and GMVIO::write_ascii_old_impl().

00110 {
00111   Elem* elem = NULL;
00112  
00113   switch (type)
00114     {
00115       // 1D elements 
00116     case EDGE2:
00117       {
00118         elem = new Edge2(p);
00119         break;
00120       }
00121     case EDGE3:
00122       {
00123         elem = new Edge3(p);
00124         break;
00125       }
00126     case EDGE4:
00127       {
00128         elem = new Edge4(p);
00129         break;
00130       }
00131 
00132 
00133       
00134       // 2D elements
00135     case TRI3:
00136       {
00137         elem = new Tri3(p);
00138         break;
00139       }
00140     case TRI6:
00141       {
00142         elem = new Tri6(p);
00143         break;
00144       }
00145     case QUAD4:
00146       {
00147         elem = new Quad4(p);
00148         break;
00149       }
00150     case QUAD8:
00151       {
00152         elem = new Quad8(p);
00153         break;
00154       }
00155     case QUAD9:
00156       {
00157         elem = new Quad9(p);
00158         break;
00159       }
00160    
00161 
00162       // 3D elements
00163     case TET4:
00164       {
00165         elem = new Tet4(p);
00166         break;
00167       }
00168     case TET10:
00169       {
00170         elem = new Tet10(p);
00171         break;
00172       }
00173     case HEX8:
00174       {
00175         elem = new Hex8(p);
00176         break;
00177       }
00178     case HEX20:
00179       {
00180         elem = new Hex20(p);
00181         break;
00182       }
00183     case HEX27:
00184       {
00185         elem = new Hex27(p);
00186         break;
00187       }
00188     case PRISM6:
00189       {
00190         elem = new Prism6(p);
00191         break;
00192       }
00193     case PRISM15:
00194       {
00195         elem = new Prism15(p);
00196         break;
00197       }
00198     case PRISM18:
00199       {
00200         elem = new Prism18(p);
00201         break;
00202       }
00203     case PYRAMID5:
00204       {
00205         elem = new Pyramid5(p);
00206         break;
00207       }
00208 
00209 
00210 
00211 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
00212 
00213       // 1D infinite elements
00214     case INFEDGE2:
00215       {
00216         elem = new InfEdge2(p);
00217         break;
00218       }
00219 
00220 
00221       // 2D infinite elements
00222     case INFQUAD4:
00223       {
00224         elem = new InfQuad4(p);
00225         break;
00226       }
00227     case INFQUAD6:
00228       {
00229         elem = new InfQuad6(p);
00230         break;
00231       }
00232 
00233    
00234     // 3D infinite elements
00235     case INFHEX8:
00236       {
00237         elem = new InfHex8(p);
00238         break;
00239       }
00240     case INFHEX16:
00241       {
00242         elem = new InfHex16(p);
00243         break;
00244       }
00245     case INFHEX18:
00246       {
00247         elem = new InfHex18(p);
00248         break;
00249       }
00250     case INFPRISM6:
00251       {
00252         elem = new InfPrism6(p);
00253         break;
00254       }
00255     case INFPRISM12:
00256       {
00257         elem = new InfPrism12(p);
00258         break;
00259       }
00260 
00261 #endif
00262            
00263     default:
00264       {
00265         std::cerr << "ERROR: Undefined element type!." << std::endl;
00266         libmesh_error();
00267       }
00268     }
00269   
00270 
00271   AutoPtr<Elem> ap(elem);
00272   return ap;
00273 }

virtual AutoPtr<Elem> Elem::build_edge ( const unsigned int  i  )  const [pure virtual]

Creates an element coincident with edge i. The element returned is full-ordered. For example, calling build_edge(0) on a 20-noded hex will build a 3-noded edge coincident with edge 0 and pass back the pointer.

A AutoPtr<Elem> is returned to prevent a memory leak. This way the user need not remember to delete the object.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge, Face, InfQuad, NodeElem, and RemoteElem.

Referenced by FE< Dim, T >::edge_reinit(), is_child_on_edge(), and MeshRefinement::limit_level_mismatch_at_edge().

virtual AutoPtr<Elem> Elem::build_side ( const unsigned int  i,
bool  proxy = true 
) const [pure virtual]

Creates an element coincident with side i. The element returned is full-ordered, in contrast to the side method. For example, calling build_side(0) on a 20-noded hex will build a 8-noded quadrilateral coincident with face 0 and pass back the pointer.

A AutoPtr<Elem> is returned to prevent a memory leak. This way the user need not remember to delete the object.

The second argument, which is true by default, specifies that a "proxy" element (of type Side) will be returned. This type of return value is useful because it does not allocate additional memory, and is usually sufficient for FE calculation purposes. If you really need a full-ordered, non-proxy side object, call this function with proxy=false.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

Referenced by MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), InfQuad::build_edge(), Face::build_edge(), InfFE< Dim, T_radial, T_map >::Base::build_elem(), InfElemBuilder::build_inf_elem(), BoundaryInfo::build_node_list_from_side_list(), InfFE< Dim, T_radial, T_map >::compute_data(), LaplaceMeshSmoother::init(), is_ancestor_of(), PeriodicBoundaries::neighbor(), PostscriptIO::plot_quadratic_elem(), GmshIO::read_mesh(), InfFE< Dim, T_radial, T_map >::reinit(), FEXYZ< Dim >::reinit(), REINIT_ERROR(), InfFE< Dim, T_radial, T_map >::shape(), MeshTools::Modification::smooth(), BoundaryInfo::sync(), FroIO::write(), and DivaIO::write_stream().

Point Elem::centroid (  )  const [virtual]

Returns:
the centriod of the element. The centroid is computed as the average of all the element vertices. This method is overloadable since some derived elements might want to use shortcuts to compute their centroid.

Definition at line 277 of file elem.C.

References TypeVector< T >::add(), and n_vertices().

Referenced by SFCPartitioner::_do_partition(), MeshCommunication::assign_global_indices(), CentroidPartitioner::compute_centroids(), UnstructuredMesh::find_neighbors(), get_hilbert_index(), LocationMap< T >::point_of(), FE< Dim, T >::shape(), FE< Dim, T >::shape_deriv(), FE< Dim, T >::shape_second_deriv(), Prism6::volume(), and Hex8::volume().

00278 {
00279   Point cp;
00280 
00281   for (unsigned int n=0; n<this->n_vertices(); n++)
00282     cp.add (this->point(n));
00283 
00284   return (cp /= static_cast<Real>(this->n_vertices()));    
00285 }

const Elem * Elem::child_neighbor ( const Elem elem  )  const [inline]

If the element elem in question is a neighbor of a child of this element, this returns a pointer to that child. Otherwise it returns NULL.

Definition at line 1271 of file elem.h.

References n_neighbors(), neighbor(), and parent().

01272 {
01273   for (unsigned int n=0; n<elem->n_neighbors(); n++)
01274     if (elem->neighbor(n) &&
01275         elem->neighbor(n)->parent() == this)
01276       return elem->neighbor(n);
01277 
01278   return NULL;
01279 }

Elem * Elem::child_neighbor ( Elem elem  )  const [inline]

If the element elem in question is a neighbor of a child of this element, this returns a pointer to that child. Otherwise it returns NULL.

Definition at line 1258 of file elem.h.

References n_neighbors(), neighbor(), and parent().

01259 {
01260   for (unsigned int n=0; n<elem->n_neighbors(); n++)
01261     if (elem->neighbor(n) &&
01262         elem->neighbor(n)->parent() == this)
01263       return elem->neighbor(n);
01264 
01265   return NULL;
01266 }

void DofObject::clear_dofs (  )  [inline, inherited]

Clear the DofMap data structures and return to a pristine state.

Definition at line 388 of file dof_object.h.

References DofObject::_dof_ids, DofObject::_n_systems, DofObject::_n_v_comp, and DofObject::n_systems().

Referenced by DofObject::set_n_systems(), and DofObject::~DofObject().

00389 {
00390   // Only clear if there is data
00391   if (this->n_systems() != 0)
00392     {
00393       libmesh_assert (_n_v_comp != NULL);
00394       libmesh_assert (_dof_ids  != NULL);
00395       
00396       for (unsigned int s=0; s<this->n_systems(); s++)
00397         {
00398           if (_dof_ids[s] != NULL) // This has only been allocated if 
00399             {                      // variables were declared
00400               delete [] _dof_ids[s]; _dof_ids[s] = NULL;
00401             }
00402           
00403           if (_n_v_comp[s] != NULL) // it is possible the number of variables is 0,
00404             {                       // but this was allocated (_n_v_comp[s][0] == 0)
00405               delete [] _n_v_comp[s]; _n_v_comp[s] = NULL;
00406             }
00407         }
00408       
00409       delete [] _n_v_comp; _n_v_comp = NULL;
00410       delete [] _dof_ids;  _dof_ids  = NULL;
00411     }
00412   
00413   // Make sure we cleaned up
00414   // (or there was nothing there)
00415   libmesh_assert (_n_v_comp == NULL);
00416   libmesh_assert (_dof_ids  == NULL);
00417   
00418   // No systems now.
00419   _n_systems = 0;
00420 }

void DofObject::clear_old_dof_object (  )  [inherited]

Sets the old_dof_object to NULL

Definition at line 120 of file dof_object.C.

References DofObject::old_dof_object.

Referenced by DofObject::set_old_dof_object(), and DofObject::~DofObject().

00121 {
00122   // If we have been called before...
00123   // prevent a memory leak
00124   if (old_dof_object != NULL)
00125     {
00126       delete this->old_dof_object;
00127       this->old_dof_object = NULL;
00128     }  
00129 }

void Elem::coarsen (  ) 

Coarsen the element. This is not virtual since it is the same for all element types.

Definition at line 184 of file elem_refinement.C.

References active(), TypeVector< T >::add_scaled(), child(), COARSEN, COARSEN_INACTIVE, embedding_matrix(), get_node(), INACTIVE, JUST_COARSENED, n_children(), n_nodes(), p_level(), point(), refinement_flag(), remote_elem, set_p_level(), and set_refinement_flag().

Referenced by MeshRefinement::_coarsen_elements().

00185 {
00186   libmesh_assert (this->refinement_flag() == Elem::COARSEN_INACTIVE);
00187   libmesh_assert (!this->active());
00188 
00189   // We no longer delete children until MeshRefinement::contract()
00190   // delete [] _children;
00191   // _children = NULL;
00192 
00193   unsigned int parent_p_level = 0;
00194 
00195   // re-compute hanging node nodal locations
00196   for (unsigned int c=0; c<this->n_children(); c++)
00197   {     
00198     Elem *mychild = this->child(c);
00199     if (mychild == remote_elem)
00200       continue;
00201     for (unsigned int nc=0; nc<mychild->n_nodes(); nc++)
00202     {
00203       Point new_pos;
00204       bool calculated_new_pos = false;
00205 
00206       for (unsigned int n=0; n<this->n_nodes(); n++)
00207       {
00208         // The value from the embedding matrix
00209         const float em_val = this->embedding_matrix(c,nc,n);
00210          
00211         // The node location is somewhere between existing vertices
00212         if ((em_val != 0.) && (em_val != 1.)) 
00213         {
00214           new_pos.add_scaled (this->point(n), em_val);
00215           calculated_new_pos = true;
00216         }
00217       }
00218 
00219       if(calculated_new_pos)
00220       { 
00221         //Move the existing node back into it's original location
00222         for(unsigned int i=0; i<LIBMESH_DIM; i++)
00223         {
00224           Point & child_node = *(mychild->get_node(nc));
00225           child_node(i)=new_pos(i);
00226         }
00227       }
00228     }
00229   }
00230 
00231   for (unsigned int c=0; c<this->n_children(); c++)
00232     {   
00233       Elem *mychild = this->child(c);
00234       if (mychild == remote_elem)
00235         continue;
00236       libmesh_assert (mychild->refinement_flag() == Elem::COARSEN);
00237       mychild->set_refinement_flag(Elem::INACTIVE);
00238       if (mychild->p_level() > parent_p_level)
00239         parent_p_level = mychild->p_level();
00240     }
00241 
00242   this->set_refinement_flag(Elem::JUST_COARSENED);
00243   this->set_p_level(parent_p_level);
00244 
00245   libmesh_assert (this->active());
00246 }

static unsigned int Elem::compute_key ( unsigned int  n0,
unsigned int  n1,
unsigned int  n2,
unsigned int  n3 
) [static, protected]

Compute a key from the specified nodes.

static unsigned int Elem::compute_key ( unsigned int  n0,
unsigned int  n1,
unsigned int  n2 
) [static, protected]

Compute a key from the specified nodes.

static unsigned int Elem::compute_key ( unsigned int  n0,
unsigned int  n1 
) [static, protected]

Compute a key from the specified nodes.

static unsigned int Elem::compute_key ( unsigned int  n0  )  [static, protected]

virtual void Elem::connectivity ( const unsigned int  sc,
const IOPackage  iop,
std::vector< unsigned int > &  conn 
) const [pure virtual]

Returns the connectivity for this element in a specific format, which is specified by the IOPackage tag. This method supercedes the tecplot_connectivity(...) and vtk_connectivity(...) routines.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

Referenced by VTKIO::cells_to_vtk(), VTKIO::read(), write_connectivity(), and DivaIO::write_stream().

bool Elem::contains_edge_of ( const Elem e  )  const

This function returns true iff an edge of e is contained in this element. (Internally, this is done by checking whether at least two vertices of e are contained in this element).

Definition at line 443 of file elem.C.

References contains_point(), n_vertices(), and point().

Referenced by find_edge_neighbors().

00444 {
00445   unsigned int num_contained_edges = 0;
00446 
00447   // Our vertices are the first numbered nodes
00448   for (unsigned int n = 0; n != e->n_vertices(); ++n)
00449     {
00450       if (this->contains_point(e->point(n)))
00451         {
00452           num_contained_edges++;
00453           if(num_contained_edges>=2)
00454             {
00455               return true;
00456             }
00457         }
00458     }
00459   return false;
00460 }

bool Elem::contains_point ( const Point p  )  const [virtual]

Returns:
true if the point p is contained in this element, false otherwise.

Reimplemented in InfHex8, InfPrism6, and InfQuad4.

Definition at line 1244 of file elem.C.

References default_order(), dim(), FEInterface::inverse_map(), FEInterface::on_reference_element(), and type().

Referenced by contains_edge_of(), contains_vertex_of(), PointLocatorTree::operator()(), and HPSingularity::select_refinement().

01245 {
01246   // Declare a basic FEType.  Will ue a Lagrange
01247   // element by default.
01248   FEType fe_type(this->default_order());
01249   
01250   const Point mapped_point = FEInterface::inverse_map(this->dim(),
01251                                                       fe_type,
01252                                                       this,
01253                                                       p,
01254                                                       1.e-4,
01255                                                       false);
01256 
01257   return FEInterface::on_reference_element(mapped_point, this->type());
01258 }

bool Elem::contains_vertex_of ( const Elem e  )  const

This function returns true iff a vertex of e is contained in this element

Definition at line 432 of file elem.C.

References contains_point(), n_vertices(), and point().

Referenced by find_point_neighbors().

00433 {
00434   // Our vertices are the first numbered nodes
00435   for (unsigned int n = 0; n != e->n_vertices(); ++n)
00436     if (this->contains_point(e->point(n)))
00437       return true;
00438   return false;
00439 }

void Elem::contract (  ) 

Contract an active element, i.e. remove pointers to any subactive children. This should only be called via MeshRefinement::contract, which will also remove subactive children from the mesh

Definition at line 250 of file elem_refinement.C.

References _children, active(), DO_NOTHING, JUST_COARSENED, refinement_flag(), and set_refinement_flag().

Referenced by UnstructuredMesh::contract().

00251 {
00252   // Subactive elements get deleted entirely, not contracted
00253   libmesh_assert (this->active());
00254 
00255   // Active contracted elements no longer can have children
00256   if (_children)
00257     {
00258       delete [] _children;
00259       _children = NULL;
00260     }
00261   if (this->refinement_flag() == Elem::JUST_COARSENED)
00262     this->set_refinement_flag(Elem::DO_NOTHING);
00263 }

unsigned int DofObject::dof_number ( const unsigned int  s,
const unsigned int  var,
const unsigned int  comp 
) const [inline, inherited]

Returns:
the global degree of freedom number variable var, component comp for system s associated with this DofObject

Definition at line 564 of file dof_object.h.

References DofObject::_dof_ids, DofObject::invalid_id, DofObject::n_comp(), DofObject::n_systems(), and DofObject::n_vars().

Referenced by DofMap::constrain_p_dofs(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofMap::dof_indices(), DofObject::DofObject(), DofMap::old_dof_indices(), DofMap::reinit(), HPCoarsenTest::select_refinement(), DofObject::set_dof_number(), DofMap::set_nonlocal_dof_objects(), VTKIO::solution_to_vtk(), and System::zero_variable().

00567 {
00568   libmesh_assert (s < this->n_systems());
00569   libmesh_assert (var  < this->n_vars(s));
00570   libmesh_assert (_dof_ids != NULL);
00571   libmesh_assert (_dof_ids[s] != NULL);  
00572   libmesh_assert (comp < this->n_comp(s,var));
00573   
00574   if (_dof_ids[s][var] == invalid_id)
00575     return invalid_id;
00576   else
00577     return (_dof_ids[s][var] + comp);
00578 }

virtual float Elem::embedding_matrix ( const unsigned int  i,
const unsigned int  j,
const unsigned int  k 
) const [pure virtual]

Matrix that transforms the parents nodes into the children's nodes

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

Referenced by coarsen(), refine(), and MeshTools::Modification::smooth().

void Elem::family_tree ( std::vector< const Elem * > &  family,
const bool  reset = true 
) const

Fills the vector family with the children of this element, recursively. So, calling this method on a twice-refined element will give you the element itself, its direct children, and their children, etc... When the optional parameter reset is true then the vector will be cleared before the element and its descendants are added.

Definition at line 959 of file elem.C.

References active(), child(), family_tree(), is_remote(), n_children(), and subactive().

Referenced by family_tree().

00961 {
00962   // The "family tree" doesn't include subactive elements
00963   libmesh_assert(!this->subactive());
00964 
00965   // Clear the vector if the flag reset tells us to.
00966   if (reset)
00967     family.clear();
00968 
00969   // Add this element to the family tree.
00970   family.push_back(this);
00971 
00972   // Recurse into the elements children, if it has them.
00973   // Do not clear the vector any more.
00974   if (!this->active())
00975     for (unsigned int c=0; c<this->n_children(); c++)
00976       if (!this->child(c)->is_remote())
00977         this->child(c)->family_tree (family, false);
00978 }

void Elem::family_tree_by_neighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to neighbor.

Definition at line 1060 of file elem.C.

References active(), child(), family_tree_by_neighbor(), has_neighbor(), n_children(), remote_elem, and subactive().

Referenced by family_tree_by_neighbor(), and make_links_to_me_remote().

01063 {
01064   // The "family tree" doesn't include subactive elements
01065   libmesh_assert(!this->subactive());
01066 
01067   // Clear the vector if the flag reset tells us to.
01068   if (reset)
01069     family.clear();
01070 
01071   // This only makes sense if we're already a neighbor
01072   libmesh_assert (this->has_neighbor(neighbor));
01073 
01074   // Add this element to the family tree.
01075   family.push_back(this);
01076 
01077   // Recurse into the elements children, if it's not active.
01078   // Do not clear the vector any more.
01079   if (!this->active())
01080     for (unsigned int c=0; c<this->n_children(); c++)
01081       {
01082         Elem *child = this->child(c);
01083         if (child != remote_elem && child->has_neighbor(neighbor))
01084           child->family_tree_by_neighbor (family, neighbor, false);
01085       }
01086 }

void Elem::family_tree_by_side ( std::vector< const Elem * > &  family,
const unsigned int  side,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to side.

Definition at line 1006 of file elem.C.

References active(), child(), family_tree_by_side(), is_child_on_side(), n_children(), n_sides(), and subactive().

Referenced by family_tree_by_side().

01009 {
01010   // The "family tree" doesn't include subactive elements
01011   libmesh_assert(!this->subactive());
01012 
01013   // Clear the vector if the flag reset tells us to.
01014   if (reset)
01015     family.clear();
01016 
01017   libmesh_assert(s < this->n_sides());
01018 
01019   // Add this element to the family tree.
01020   family.push_back(this);
01021 
01022   // Recurse into the elements children, if it has them.
01023   // Do not clear the vector any more.
01024   if (!this->active())
01025     for (unsigned int c=0; c<this->n_children(); c++)
01026       if (this->child(c)->is_child_on_side(c, s))
01027         this->child(c)->family_tree_by_side (family, s, false);
01028 
01029 }

void Elem::family_tree_by_subneighbor ( std::vector< const Elem * > &  family,
const Elem neighbor,
const Elem subneighbor,
const bool  reset = true 
) const

Same as the family_tree() member, but only adds elements which are next to subneighbor. Only applicable when this->has_neighbor(neighbor) and neighbor->is_ancestor(subneighbor)

Definition at line 1090 of file elem.C.

References active(), child(), family_tree_by_subneighbor(), has_neighbor(), is_ancestor_of(), n_children(), n_sides(), neighbor(), parent(), remote_elem, and subactive().

Referenced by family_tree_by_subneighbor(), and make_links_to_me_remote().

01094 {
01095   // The "family tree" doesn't include subactive elements
01096   libmesh_assert(!this->subactive());
01097 
01098   // Clear the vector if the flag reset tells us to.
01099   if (reset)
01100     family.clear();
01101 
01102   // To simplifly this function we need an existing neighbor
01103   libmesh_assert (neighbor);
01104   libmesh_assert (neighbor != remote_elem);
01105   libmesh_assert (this->has_neighbor(neighbor));
01106 
01107   // This only makes sense if subneighbor descends from neighbor
01108   libmesh_assert (subneighbor);
01109   libmesh_assert (subneighbor != remote_elem);
01110   libmesh_assert (neighbor->is_ancestor_of(subneighbor));
01111 
01112   // Add this element to the family tree if applicable.
01113   if (neighbor == subneighbor)
01114     family.push_back(this);
01115 
01116   // Recurse into the elements children, if it's not active.
01117   // Do not clear the vector any more.
01118   if (!this->active())
01119     for (unsigned int c=0; c != this->n_children(); ++c)
01120       {
01121         Elem *child = this->child(c);
01122         if (child != remote_elem)
01123           for (unsigned int s=0; s != child->n_sides(); ++s)
01124             {
01125               Elem *child_neigh = child->neighbor(s);
01126               if (child_neigh &&
01127                   (child_neigh == neighbor ||
01128                    (child_neigh->parent() == neighbor &&
01129                     child_neigh->is_ancestor_of(subneighbor))))
01130                 child->family_tree_by_subneighbor (family, child_neigh,
01131                                                    subneighbor, false);
01132             }
01133       }
01134 }

void Elem::find_edge_neighbors ( std::set< const Elem * > &  neighbor_set  )  const

This function finds all elements which touch the current element at any edge (more precisely, at at least two points).

Definition at line 522 of file elem.C.

References active(), active_family_tree_by_neighbor(), contains_edge_of(), n_sides(), neighbor(), and remote_elem.

00523 {
00524   neighbor_set.clear();
00525   neighbor_set.insert(this);
00526 
00527   unsigned int old_size;
00528   do
00529     {
00530       old_size = neighbor_set.size();
00531 
00532       // Loop over all the elements in the patch
00533       std::set<const Elem*>::const_iterator       it  = neighbor_set.begin();
00534       const std::set<const Elem*>::const_iterator end = neighbor_set.end();
00535 
00536       for (; it != end; ++it)
00537         {
00538           const Elem* elem = *it;
00539 
00540           for (unsigned int s=0; s<elem->n_sides(); s++)
00541             {
00542               const Elem* neighbor = elem->neighbor(s);
00543               if (neighbor &&
00544                   neighbor != remote_elem)    // we have a real neighbor on this side
00545                 {
00546                   if (neighbor->active())                // ... if it is active
00547                     {
00548                       if (this->contains_edge_of(neighbor) // ... and touches us
00549                           || neighbor->contains_edge_of(this))  
00550                         neighbor_set.insert (neighbor);  // ... then add it
00551                     }
00552 #ifdef LIBMESH_ENABLE_AMR
00553                   else                                 // ... the neighbor is *not* active,
00554                     {                                  // ... so add *all* neighboring
00555                                                        // active children
00556                       std::vector<const Elem*> active_neighbor_children;
00557   
00558                       neighbor->active_family_tree_by_neighbor
00559                         (active_neighbor_children, elem);
00560 
00561                       std::vector<const Elem*>::const_iterator
00562                         child_it = active_neighbor_children.begin();
00563                       const std::vector<const Elem*>::const_iterator
00564                         child_end = active_neighbor_children.end();
00565                       for (; child_it != child_end; ++child_it)
00566                         if (this->contains_edge_of(*child_it) ||
00567                             (*child_it)->contains_edge_of(this))
00568                           neighbor_set.insert (*child_it);
00569                     }
00570 #endif // #ifdef LIBMESH_ENABLE_AMR
00571                 }
00572             }
00573         }
00574     }
00575   while (old_size != neighbor_set.size());
00576 }

void Elem::find_point_neighbors ( std::set< const Elem * > &  neighbor_set  )  const

This function finds all elements which touch the current element at any point

Definition at line 464 of file elem.C.

References active(), active_family_tree_by_neighbor(), contains_vertex_of(), n_sides(), neighbor(), and remote_elem.

Referenced by Patch::find_point_neighbors().

00465 {
00466   neighbor_set.clear();
00467   neighbor_set.insert(this);
00468 
00469   unsigned int old_size;
00470   do
00471     {
00472       old_size = neighbor_set.size();
00473 
00474       // Loop over all the elements in the patch
00475       std::set<const Elem*>::const_iterator       it  = neighbor_set.begin();
00476       const std::set<const Elem*>::const_iterator end = neighbor_set.end();
00477 
00478       for (; it != end; ++it)
00479         {
00480           const Elem* elem = *it;
00481 
00482           for (unsigned int s=0; s<elem->n_sides(); s++)
00483             {
00484               const Elem* neighbor = elem->neighbor(s);
00485               if (neighbor &&
00486                   neighbor != remote_elem)    // we have a real neighbor on this side
00487                 {
00488                   if (neighbor->active())                // ... if it is active
00489                     {
00490                       if (this->contains_vertex_of(neighbor) // ... and touches us
00491                           || neighbor->contains_vertex_of(this))  
00492                         neighbor_set.insert (neighbor);  // ... then add it
00493                     }
00494 #ifdef LIBMESH_ENABLE_AMR
00495                   else                                 // ... the neighbor is *not* active,
00496                     {                                  // ... so add *all* neighboring
00497                                                        // active children
00498                       std::vector<const Elem*> active_neighbor_children;
00499   
00500                       neighbor->active_family_tree_by_neighbor
00501                         (active_neighbor_children, elem);
00502 
00503                       std::vector<const Elem*>::const_iterator
00504                         child_it = active_neighbor_children.begin();
00505                       const std::vector<const Elem*>::const_iterator
00506                         child_end = active_neighbor_children.end();
00507                       for (; child_it != child_end; ++child_it)
00508                         if (this->contains_vertex_of(*child_it) ||
00509                             (*child_it)->contains_vertex_of(this))
00510                           neighbor_set.insert (*child_it);
00511                     }
00512 #endif // #ifdef LIBMESH_ENABLE_AMR
00513                 }
00514             }
00515         }
00516     }
00517   while (old_size != neighbor_set.size());
00518 }

ElemType Elem::first_order_equivalent_type ( const ElemType  et  )  [static]

Returns:
the element type of the associated first-order element, e.g. when this is a TET10, then TET4 is returned. Returns INVALID_ELEM for first order or other elements that should not or cannot be converted into lower order equivalents.

Definition at line 1314 of file elem.C.

References libMeshEnums::EDGE2, libMeshEnums::EDGE3, libMeshEnums::EDGE4, libMeshEnums::HEX20, libMeshEnums::HEX27, libMeshEnums::HEX8, libMeshEnums::INFHEX16, libMeshEnums::INFHEX18, libMeshEnums::INFHEX8, libMeshEnums::INFPRISM12, libMeshEnums::INFPRISM6, libMeshEnums::INFQUAD4, libMeshEnums::INFQUAD6, libMeshEnums::INVALID_ELEM, libMeshEnums::PRISM15, libMeshEnums::PRISM18, libMeshEnums::PRISM6, libMeshEnums::QUAD4, libMeshEnums::QUAD8, libMeshEnums::QUAD9, libMeshEnums::TET10, libMeshEnums::TET4, libMeshEnums::TRI3, and libMeshEnums::TRI6.

Referenced by UnstructuredMesh::all_first_order(), and GMVIO::write_ascii_old_impl().

01315 { 
01316   switch (et)
01317     {
01318     case EDGE2:
01319     case EDGE3:
01320     case EDGE4:
01321       return EDGE2;
01322     case TRI3:
01323     case TRI6:
01324       return TRI3;
01325     case QUAD4:
01326     case QUAD8:
01327     case QUAD9:
01328       return QUAD4;
01329     case TET4:
01330     case TET10:
01331       return TET4;
01332     case HEX8:
01333     case HEX27:
01334     case HEX20:
01335       return HEX8;
01336     case PRISM6:
01337     case PRISM15:
01338     case PRISM18:
01339       return PRISM6;
01340 
01341 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
01342 
01343     case INFQUAD4:
01344     case INFQUAD6:
01345       return INFQUAD4;
01346     case INFHEX8:
01347     case INFHEX16:
01348     case INFHEX18:
01349       return INFHEX8;
01350     case INFPRISM6:
01351     case INFPRISM12:
01352       return INFPRISM6;
01353 
01354 #endif
01355 
01356     default:
01357       // unknown element
01358       return INVALID_ELEM;
01359     }
01360 }

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 QuadratureRules::name().

Referenced by ReferenceCounter::print_info().

00046 {
00047 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
00048 
00049   std::ostringstream out;
00050   
00051   out << '\n'
00052       << " ---------------------------------------------------------------------------- \n"
00053       << "| Reference count information                                                |\n"
00054       << " ---------------------------------------------------------------------------- \n";
00055   
00056   for (Counts::iterator it = _counts.begin();
00057        it != _counts.end(); ++it)
00058     {
00059       const std::string name(it->first);
00060       const unsigned int creations    = it->second.first;
00061       const unsigned int destructions = it->second.second;
00062 
00063       out << "| " << name << " reference count information:\n"
00064           << "|  Creations:    " << creations    << '\n'
00065           << "|  Destructions: " << destructions << '\n';
00066     }
00067   
00068   out << " ---------------------------------------------------------------------------- \n";
00069 
00070   return out.str();
00071 
00072 #else
00073 
00074   return "";
00075   
00076 #endif
00077 }

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 QuadratureRules::name().

Referenced by ReferenceCounter::print_info().

00046 {
00047 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
00048 
00049   std::ostringstream out;
00050   
00051   out << '\n'
00052       << " ---------------------------------------------------------------------------- \n"
00053       << "| Reference count information                                                |\n"
00054       << " ---------------------------------------------------------------------------- \n";
00055   
00056   for (Counts::iterator it = _counts.begin();
00057        it != _counts.end(); ++it)
00058     {
00059       const std::string name(it->first);
00060       const unsigned int creations    = it->second.first;
00061       const unsigned int destructions = it->second.second;
00062 
00063       out << "| " << name << " reference count information:\n"
00064           << "|  Creations:    " << creations    << '\n'
00065           << "|  Destructions: " << destructions << '\n';
00066     }
00067   
00068   out << " ---------------------------------------------------------------------------- \n";
00069 
00070   return out.str();
00071 
00072 #else
00073 
00074   return "";
00075   
00076 #endif
00077 }

Node * Elem::get_node ( const unsigned int  i  )  const [inline, virtual]

Returns:
the pointer to local Node i.

Reimplemented in RemoteElem.

Definition at line 1189 of file elem.h.

References _nodes, and n_nodes().

Referenced by _cast_node_address_to_unsigned_int(), UnstructuredMesh::all_first_order(), UnstructuredMesh::all_second_order(), MeshTools::Generation::build_cube(), Tri6::build_side(), Tri3::build_side(), Quad9::build_side(), Quad8::build_side(), Quad4::build_side(), InfQuad6::build_side(), Edge::build_side(), Tet4::build_side(), Tet10::build_side(), Pyramid5::build_side(), Prism6::build_side(), Prism18::build_side(), Prism15::build_side(), InfPrism12::build_side(), InfHex18::build_side(), InfHex16::build_side(), Hex8::build_side(), Hex27::build_side(), Hex20::build_side(), coarsen(), DofMap::constrain_p_dofs(), MeshTools::correct_node_proc_ids(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofMap::dof_indices(), UNVIO::element_out(), MeshTools::Modification::flatten(), libmesh_assert_valid_node_pointers(), MeshTools::libmesh_assert_valid_node_procids(), DofMap::old_dof_indices(), Tri::quality(), refine(), DofMap::reinit(), Tet4::reselect_diagonal(), HPCoarsenTest::select_refinement(), Partitioner::set_node_processor_ids(), Tri::side(), Quad::side(), InfQuad::side(), Edge::side(), Tet::side(), Pyramid::side(), Prism::side(), InfPrism::side(), InfHex::side(), Hex::side(), MeshTools::Modification::smooth(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), Tri3::volume(), Tet4::volume(), Pyramid5::volume(), and GnuPlotIO::write_solution().

01190 {
01191   libmesh_assert (i < this->n_nodes());
01192   libmesh_assert (_nodes[i] != NULL);
01193 
01194   return _nodes[i];
01195 }

void Elem::hack_p_level ( const unsigned int  p  ) 

Sets the value of the p refinement level for the element without altering the p level of its ancestors

Referenced by is_ancestor_of(), and XdrIO::read_serialized_connectivity().

virtual bool Elem::has_affine_map (  )  const [inline, virtual]

Returns:
true iff the element map is definitely affine (i.e. the same at every quadrature point) within numerical tolerances

Reimplemented in Hex20, Hex27, Hex8, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, Quad4, Quad8, Quad9, Tri3, Tri6, and NodeElem.

Definition at line 478 of file elem.h.

Referenced by FEBase::compute_map(), FEXYZ< Dim >::init_shape_functions(), and FE< Dim, T >::init_shape_functions().

00478 { return false; }

bool Elem::has_ancestor_children (  )  const [inline]

Returns:
true if the element has any descendants other than its immediate children, false otherwise. Always returns false if AMR is disabled.

Definition at line 1364 of file elem.h.

References _children, child(), has_children(), and n_children().

01365 {
01366 #ifdef LIBMESH_ENABLE_AMR
01367   if (_children == NULL)
01368     return false;
01369   else
01370     for (unsigned int c=0; c != this->n_children(); c++)
01371       if (this->child(c)->has_children())
01372         return true;
01373 #endif
01374   return false;
01375 }

bool Elem::has_children (  )  const [inline]

Returns:
true if the element has any children (active or not), false otherwise. Always returns false if AMR is disabled.

Definition at line 1350 of file elem.h.

References _children.

Referenced by UnstructuredMesh::all_first_order(), ancestor(), UnstructuredMesh::find_neighbors(), MeshRefinement::flag_elements_by_nelem_target(), has_ancestor_children(), is_ancestor_of(), MeshTools::libmesh_assert_no_links_to_elem(), MeshRefinement::make_coarsening_compatible(), make_links_to_me_remote(), MeshRefinement::make_refinement_compatible(), FEMSystem::mesh_position_set(), System::ProjectVector::operator()(), subactive(), and Parallel::sync_element_data_by_parent_id().

01351 {
01352 #ifdef LIBMESH_ENABLE_AMR
01353   if (_children == NULL)
01354     return false;
01355   else
01356     return true;
01357 #else
01358   return false;
01359 #endif
01360 }

bool DofObject::has_dofs ( const unsigned int  s = libMesh::invalid_uint  )  const [inline, inherited]

Returns:
true if any system has variables which have been assigned, false otherwise

Definition at line 583 of file dof_object.h.

References libMesh::invalid_uint, DofObject::n_systems(), and DofObject::n_vars().

Referenced by DofMap::reinit().

00584 {
00585   if (sys == libMesh::invalid_uint)
00586     {
00587       for (unsigned int s=0; s<this->n_systems(); s++)
00588         if (this->n_vars(s))
00589           return true;
00590     }
00591   
00592   else
00593     {
00594       libmesh_assert (sys < this->n_systems());
00595 
00596       if (this->n_vars(sys))
00597         return true;
00598     }
00599   
00600   return false;
00601 }

bool Elem::has_neighbor ( const Elem elem  )  const [inline]

Returns:
true if the element elem in question is a neighbor of this element, false otherwise.

Definition at line 1246 of file elem.h.

References n_neighbors(), and neighbor().

Referenced by active_family_tree_by_neighbor(), family_tree_by_neighbor(), family_tree_by_subneighbor(), MeshRefinement::make_coarsening_compatible(), make_links_to_me_remote(), MeshRefinement::make_refinement_compatible(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), and on_boundary().

01247 {
01248   for (unsigned int n=0; n<this->n_neighbors(); n++)
01249     if (this->neighbor(n) == elem)
01250       return true;
01251 
01252   return false;
01253 }

Real Elem::hmax (  )  const [virtual]

Returns:
the maximum vertex separation for the element.

Definition at line 306 of file elem.C.

References std::max(), n_vertices(), point(), and TypeVector< T >::size().

Referenced by KellyErrorEstimator::boundary_side_integration(), DiscontinuityMeasure::boundary_side_integration(), KellyErrorEstimator::internal_side_integration(), LaplacianErrorEstimator::internal_side_integration(), DiscontinuityMeasure::internal_side_integration(), and HPCoarsenTest::select_refinement().

00307 {
00308   Real h_max=0;
00309 
00310   for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
00311     for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
00312       {
00313         const Point diff = (this->point(n_outer) - this->point(n_inner));
00314         
00315         h_max = std::max(h_max,diff.size());
00316       }
00317 
00318   return h_max;
00319 }

Real Elem::hmin (  )  const [virtual]

Returns:
the minimum vertex separation for the element.

Definition at line 289 of file elem.C.

References std::min(), n_vertices(), point(), and TypeVector< T >::size().

Referenced by UnstructuredMesh::find_neighbors(), FEMSystem::numerical_jacobian(), and refine().

00290 {
00291   Real h_min=1.e30;
00292 
00293   for (unsigned int n_outer=0; n_outer<this->n_vertices(); n_outer++)
00294     for (unsigned int n_inner=n_outer+1; n_inner<this->n_vertices(); n_inner++)
00295       {
00296         const Point diff = (this->point(n_outer) - this->point(n_inner));
00297         
00298         h_min = std::min(h_min,diff.size());
00299       }
00300 
00301   return h_min;
00302 }

unsigned int DofObject::id (  )  const [inline, inherited]

Returns:
the id for this DofObject

Definition at line 449 of file dof_object.h.

References DofObject::_id, and DofObject::valid_id().

Referenced by SFCPartitioner::_do_partition(), SerialMesh::add_elem(), ParallelMesh::add_elem(), SerialMesh::add_node(), ParallelMesh::add_node(), ParallelMesh::add_point(), UnstructuredMesh::all_first_order(), UnstructuredMesh::all_second_order(), FEMSystem::assembly(), MeshData::assign(), ParmetisPartitioner::assign_partitioning(), MeshTools::Generation::build_delaunay_square(), ParmetisPartitioner::build_graph(), InfElemBuilder::build_inf_elem(), VTKIO::cells_to_vtk(), clough_compute_coefs(), FEBase::compute_single_point_map(), UnstructuredMesh::copy_nodes_and_elements(), MeshRefinement::create_parent_error_vector(), SerialMesh::delete_elem(), ParallelMesh::delete_elem(), SerialMesh::delete_node(), ParallelMesh::delete_node(), MeshCommunication::delete_remote_elements(), MeshData::elem_to_foreign_id(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), UnstructuredMesh::find_neighbors(), MeshTools::find_nodal_neighbors(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_error_fraction(), MeshRefinement::flag_elements_by_error_tolerance(), MeshRefinement::flag_elements_by_mean_stddev(), TetGenMeshInterface::get_node_index(), hermite_compute_coefs(), LaplaceMeshSmoother::init(), ParmetisPartitioner::initialize(), ExodusII_IO_Helper::initialize(), TreeNode< N >::insert(), SerialMesh::insert_elem(), ParallelMesh::insert_elem(), ParallelMesh::insert_node(), FE< Dim, T >::inverse_map(), is_ancestor_of(), MeshTools::libmesh_assert_valid_elem_ids(), MeshTools::libmesh_assert_valid_node_procids(), MeshTools::libmesh_assert_valid_refinement_flags(), node(), MeshData::node_to_foreign_id(), VTKIO::nodes_to_vtk(), PatchRecoveryErrorEstimator::EstimateError::operator()(), XdrIO::pack_element(), ErrorVector::plot_error(), Nemesis_IO::read(), ExodusII_IO::read(), ParallelMesh::renumber_elem(), ParallelMesh::renumber_node(), ParallelMesh::renumber_nodes_and_elements(), HPCoarsenTest::select_refinement(), Partitioner::set_node_processor_ids(), DofMap::set_nonlocal_dof_objects(), Partitioner::set_parent_processor_ids(), FE< Dim, T >::shape(), FE< Dim, T >::shape_deriv(), FE< Dim, T >::shape_second_deriv(), LaplaceMeshSmoother::smooth(), MeshTools::Modification::smooth(), BoundaryInfo::sync(), Parallel::sync_dofobject_data_by_id(), Parallel::sync_element_data_by_parent_id(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), ExodusII_IO_Helper::write_elements(), LegacyXdrIO::write_mesh(), GmshIO::write_mesh(), and XdrIO::write_serialized_connectivity().

00450 {
00451   libmesh_assert (this->valid_id());
00452   return _id;
00453 }

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, and Threads::spin_mtx.

Referenced by ReferenceCountedObject< SparseMatrix< T > >::ReferenceCountedObject().

00150 {
00151   Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
00152   std::pair<unsigned int, unsigned int>& p = _counts[name];
00153 
00154   p.first++;
00155 }

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, and Threads::spin_mtx.

Referenced by ReferenceCountedObject< SparseMatrix< T > >::ReferenceCountedObject().

00150 {
00151   Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
00152   std::pair<unsigned int, unsigned int>& p = _counts[name];
00153 
00154   p.first++;
00155 }

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, and Threads::spin_mtx.

Referenced by ReferenceCountedObject< SparseMatrix< T > >::~ReferenceCountedObject().

00168 {
00169   Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
00170   std::pair<unsigned int, unsigned int>& p = _counts[name];
00171 
00172   p.second++;
00173 }

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, and Threads::spin_mtx.

Referenced by ReferenceCountedObject< SparseMatrix< T > >::~ReferenceCountedObject().

00168 {
00169   Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
00170   std::pair<unsigned int, unsigned int>& p = _counts[name];
00171 
00172   p.second++;
00173 }

virtual bool Elem::infinite (  )  const [pure virtual]

Returns:
true if the element is an infinite element, false otherwise.

Implemented in Cell, InfCell, Edge2, Edge3, Edge4, InfEdge2, Face, InfQuad, NodeElem, and RemoteElem.

Referenced by EquationSystems::build_discontinuous_solution_vector(), EquationSystems::build_solution_vector(), and TreeNode< N >::insert().

const Elem* Elem::interior_parent (  )  const

In some cases it is desireable to extract the boundary (or a subset thereof) of a D-dimensional mesh as a (D-1)-dimensional manifold. In this case we may want to know the 'parent' element from which the manifold elements were extracted. We can easily do that for the level-0 manifold elements by storing the D-dimensional parent. This method provides access to that element.

Referenced by is_ancestor_of().

void DofObject::invalidate (  )  [inline, inherited]

Invalidates all the indices for this DofObject

Definition at line 378 of file dof_object.h.

References DofObject::invalidate_dofs(), DofObject::invalidate_id(), and DofObject::invalidate_processor_id().

Referenced by DofObject::DofObject().

00379 {
00380   this->invalidate_dofs ();
00381   this->invalidate_id ();
00382   this->invalidate_processor_id ();
00383 }

void DofObject::invalidate_dofs ( const unsigned int  sys_num = libMesh::invalid_uint  )  [inline, inherited]

Sets all degree of freedom numbers to invalid_id

Definition at line 342 of file dof_object.h.

References DofObject::invalid_id, DofObject::n_comp(), DofObject::n_systems(), DofObject::n_vars(), and DofObject::set_dof_number().

Referenced by DofObject::invalidate().

00343 {
00344   // If the user does not specify the system number...
00345   if (sys_num >= this->n_systems()) 
00346     {
00347       for (unsigned int s=0; s<this->n_systems(); s++)
00348         for (unsigned int v=0; v<this->n_vars(s); v++)
00349           if (this->n_comp(s,v))
00350             this->set_dof_number(s,v,0,invalid_id);
00351     }
00352   // ...otherwise invalidate the dofs for all systems
00353   else
00354     for (unsigned int v=0; v<n_vars(sys_num); v++)
00355       if (this->n_comp(sys_num,v))
00356         this->set_dof_number(sys_num,v,0,invalid_id);
00357 }

void DofObject::invalidate_id (  )  [inline, inherited]

Sets the id to invalid_id

Definition at line 362 of file dof_object.h.

References DofObject::invalid_id, and DofObject::set_id().

Referenced by DofObject::invalidate().

00363 {
00364   this->set_id (invalid_id);
00365 }

void DofObject::invalidate_processor_id (  )  [inline, inherited]

bool Elem::is_ancestor_of ( const Elem descendant  )  const [inline]

Returns:
true if descendant is a child of this, or a child of a child of this, etc. Always returns false if AMR is disabled.

Convenient way to communicate elements. This class packes up an element so that it can easily be communicated through an MPI array.

Author:
Benjamin S. Kirk
Date:
2008
Iterator pointing to the beginning of this packed element's index buffer.

Constructor. Takes an input iterator pointing to the beginning of the connectivity block for this element.

An Elem can be packed into an integer array which is header_size + elem->n_nodes() in length.

For each element it is of the form [ level p_level r_flag p_r_flag etype processor_id subdomain_id self_ID parent_ID which_child node_0 node_1 ... node_n] We cannot use unsigned int because parent_ID can be negative

Unpacks this packed element. Returns a pointer to the new element. Takes a pointer to the parent, which is required unless this packed element is at level 0.

return the level of this packed element.

return the p-level of this packed element.

return the refinement state of this packed element.

return the p-refinement state of this packed element.

return the element type of this packed element.

return the processor id of this packed element.

return the subdomain id of this packed element.

return the id of this packed element.

return the parent id of this packed element.

return which child this packed element is.

return the number of nodes in this packed element

return the global index of the packed element's nth node.

The definition of the protected nested SideIter class.

The definition of the struct used for iterating over sides.

Definition at line 1381 of file elem.h.

References _children, _first_side(), _last_side(), _p_level, _parent, _pflag, _rflag, active(), build_side(), child(), compute_key(), dim(), hack_p_level(), has_children(), DofObject::id(), interior_parent(), libMesh::invalid_uint, level(), std::max(), max_descendant_p_level(), mesh, std::min(), n_children(), n_neighbors(), n_nodes(), neighbor(), node(), operator*(), operator==(), p_level(), p_refinement_flag(), parent(), DofObject::processor_id(), refinement_flag(), set_p_level(), set_p_refinement_flag(), set_parent(), set_refinement_flag(), subactive(), subdomain_id(), top_parent(), type(), type_to_n_nodes_map, and which_child_am_i().

Referenced by family_tree_by_subneighbor().

bool Elem::is_child_on_edge ( const unsigned int  c,
const unsigned int  e 
) const [virtual]

Returns:
true iff the specified child is on the specified edge

Definition at line 943 of file elem.C.

References build_edge(), n_children(), and n_edges().

Referenced by FEBase::coarsened_dof_values().

00945 {
00946   libmesh_assert (c < this->n_children());
00947   libmesh_assert (e < this->n_edges());
00948 
00949   AutoPtr<Elem> my_edge = this->build_edge(e);
00950   AutoPtr<Elem> child_edge = this->build_edge(e);
00951 
00952   // We're assuming that an overlapping child edge has the same
00953   // number and orientation as its parent
00954   return (child_edge->node(0) == my_edge->node(0) ||
00955       child_edge->node(1) == my_edge->node(1));
00956 }

virtual bool Elem::is_child_on_side ( const unsigned int  c,
const unsigned int  s 
) const [pure virtual]

Returns:
true iff the specified child is on the specified side

Implemented in Hex, InfHex, InfPrism, Prism, Pyramid, Tet, Edge, InfQuad, Quad, Tri, NodeElem, and RemoteElem.

Referenced by active_family_tree_by_side(), FEBase::coarsened_dof_values(), and family_tree_by_side().

virtual bool Elem::is_edge ( const unsigned int  i  )  const [pure virtual]

Returns:
true iff the specified (local) node number is an edge.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

virtual bool Elem::is_face ( const unsigned int  i  )  const [pure virtual]

Returns:
true iff the specified (local) node number is a face.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

virtual bool Elem::is_node_on_edge ( const unsigned int  n,
const unsigned int  e 
) const [pure virtual]

virtual bool Elem::is_node_on_side ( const unsigned int  n,
const unsigned int  s 
) const [pure virtual]

virtual bool Elem::is_remote (  )  const [inline, virtual]

Returns true if this element is remote, false otherwise. A remote element (see RemoteElem) is a syntactic convenience -- it is a placeholder for an element which exists on some other processor. Local elements are required to have valid neighbors, and these ghost elements may have remote neighbors for data structure consistency. The use of remote elements helps assure that any element we may access has a NULL neighbor if and only if it lies on the physical boundary of the domain.

Reimplemented in RemoteElem.

Definition at line 251 of file elem.h.

Referenced by active_family_tree(), family_tree(), and Partitioner::set_parent_processor_ids().

00252   { return false; }

virtual bool Elem::is_vertex ( const unsigned int  i  )  const [pure virtual]

virtual unsigned int Elem::key ( const unsigned int  s  )  const [pure virtual]

Returns:
an id associated with the s side of this element. The id is not necessariy unique, but should be close. This is particularly useful in the MeshBase::find_neighbors() routine.

Implemented in Hex, Hex27, InfHex, InfHex18, InfPrism, Prism, Pyramid, Tet, Edge, InfQuad, Quad, Quad8, Quad9, Tri, Tri6, NodeElem, and RemoteElem.

Referenced by UnstructuredMesh::find_neighbors().

Real Elem::length ( const unsigned int  n1,
const unsigned int  n2 
) const

Returns:
the magnitude of the distance between nodes n1 and n2. Useful for computing the lengths of the sides of elements.

Definition at line 323 of file elem.C.

References n_vertices(), and point().

Referenced by Quad::quality(), InfHex::quality(), and Hex::quality().

00325 {
00326   libmesh_assert ( n1 < this->n_vertices() );
00327   libmesh_assert ( n2 < this->n_vertices() );
00328 
00329   return (this->point(n1) - this->point(n2)).size();
00330 }

void Elem::libmesh_assert_valid_neighbors (  )  const

This function checks for consistent neighbor links at this element.

Definition at line 594 of file elem.C.

References n_neighbors(), neighbor(), parent(), remote_elem, subactive(), and which_neighbor_am_i().

Referenced by MeshTools::libmesh_assert_valid_neighbors().

00595 {
00596   for (unsigned int s=0; s<this->n_neighbors(); s++)
00597     {
00598       const Elem *neigh = this->neighbor(s);
00599 
00600       // Any element might have a remote neighbor; checking
00601       // to make sure that's not inaccurate is tough.
00602       if (neigh == remote_elem)
00603         continue;
00604 
00605       if (neigh)
00606         {
00607           // Only subactive elements have subactive neighbors
00608           libmesh_assert (this->subactive() || !neigh->subactive());
00609 
00610           const Elem *elem = this;
00611 
00612           // If we're subactive but our neighbor isn't, its
00613           // return neighbor link will be to our first active
00614           // ancestor OR to our inactive ancestor of the same
00615           // level as neigh, 
00616           if (this->subactive() && !neigh->subactive())
00617             {
00618               for (elem = this; !elem->active();
00619                    elem = elem->parent())
00620                 libmesh_assert(elem);
00621             }
00622 
00623           unsigned int rev = neigh->which_neighbor_am_i(elem);
00624           libmesh_assert (rev < neigh->n_neighbors());
00625 
00626           if (this->subactive() && !neigh->subactive())
00627             {
00628               while (neigh->neighbor(rev) != elem)
00629                 {
00630                   libmesh_assert(elem->parent());
00631                   elem = elem->parent();
00632                 }
00633             }
00634           else
00635             {
00636               Elem *nn = neigh->neighbor(rev);
00637               libmesh_assert(nn);
00638 
00639               for (; elem != nn; elem = elem->parent())
00640                 libmesh_assert(elem);
00641             }
00642         }
00643       else
00644         {
00645           const Elem *parent = this->parent();
00646           if (parent)
00647             libmesh_assert (!parent->neighbor(s));
00648         }
00649     }
00650 }

void Elem::libmesh_assert_valid_node_pointers (  )  const

This function checks for a valid id and for pointers to nodes with valid ids at this element.

Definition at line 582 of file elem.C.

References get_node(), n_nodes(), and DofObject::valid_id().

Referenced by MeshTools::libmesh_assert_valid_node_pointers().

00583 {
00584   libmesh_assert(this->valid_id());
00585   for (unsigned int n=0; n != this->n_nodes(); ++n)
00586     {
00587       libmesh_assert(this->get_node(n));
00588       libmesh_assert(this->get_node(n)->valid_id());
00589     }
00590 }

void Elem::make_links_to_me_remote (  ) 

Resets this element's neighbors' appropriate neighbor pointers and its parent's and children's appropriate pointers to point to the global remote_elem instead of this. Used by the library before a remote element is deleted on the local processor.

Definition at line 656 of file elem.C.

References _children, ancestor(), child(), family_tree_by_neighbor(), family_tree_by_subneighbor(), has_children(), has_neighbor(), level(), n_children(), n_neighbors(), n_sides(), neighbor(), parent(), remote_elem, set_neighbor(), subactive(), which_child_am_i(), and which_neighbor_am_i().

Referenced by MeshCommunication::delete_remote_elements().

00657 {
00658   libmesh_assert (this != remote_elem);
00659 
00660   // We need to have handled any children first
00661 #if defined(LIBMESH_ENABLE_AMR) && defined(DEBUG)
00662   if (this->has_children())
00663     for (unsigned int c = 0; c != this->n_children(); ++c)
00664       {
00665         Elem *child = this->child(c);
00666         libmesh_assert (child == remote_elem);
00667       }
00668 #endif
00669 
00670   // Remotify any neighbor links
00671   for (unsigned int s = 0; s != this->n_sides(); ++s)
00672     {
00673       Elem *neigh = this->neighbor(s);
00674       if (neigh && neigh != remote_elem)
00675         {
00676           // My neighbor should never be more refined than me; my real
00677           // neighbor would have been its parent in that case.
00678           libmesh_assert(this->level() >= neigh->level());
00679           
00680           if (this->level() == neigh->level() &&
00681               neigh->has_neighbor(this))
00682             {
00683 #ifdef LIBMESH_ENABLE_AMR
00684               // My neighbor may have descendants which also consider me a
00685               // neighbor
00686               std::vector<const Elem*> family;
00687               neigh->family_tree_by_neighbor (family, this);
00688 
00689               // FIXME - There's a lot of ugly const_casts here; we
00690               // may want to make remote_elem non-const and create
00691               // non-const versions of the family_tree methods
00692               for (unsigned int i=0; i != family.size(); ++i)
00693                 {
00694                   Elem *n = const_cast<Elem*>(family[i]);
00695                   libmesh_assert (n);
00696                   if (n == remote_elem)
00697                     continue;
00698                   unsigned int my_s = n->which_neighbor_am_i(this);
00699                   libmesh_assert (my_s < n->n_neighbors());
00700                   libmesh_assert (n->neighbor(my_s) == this);
00701                   n->set_neighbor(my_s, const_cast<RemoteElem*>(remote_elem));
00702                 }
00703 #else
00704               unsigned int my_s = neigh->which_neighbor_am_i(this);
00705               libmesh_assert (my_s < neigh->n_neighbors());
00706               libmesh_assert (neigh->neighbor(my_s) == this);
00707               neigh->set_neighbor(my_s, const_cast<RemoteElem*>(remote_elem));
00708 #endif
00709             }
00710 #ifdef LIBMESH_ENABLE_AMR
00711           // Even if my neighbor doesn't link back to me, it might
00712           // have subactive descendants which do
00713           else if (neigh->has_children())
00714             {
00715               // If my neighbor at the same level doesn't have me as a
00716               // neighbor, I must be subactive
00717               libmesh_assert(this->level() > neigh->level() ||
00718                              this->subactive());
00719 
00720               // My neighbor must have some ancestor of mine as a
00721               // neighbor
00722               Elem *ancestor = this->parent();
00723               libmesh_assert(ancestor);
00724               while (!neigh->has_neighbor(ancestor))
00725                 {
00726                   ancestor = ancestor->parent();
00727                   libmesh_assert(ancestor);
00728                 }
00729 
00730               // My neighbor may have descendants which consider me a
00731               // neighbor
00732               std::vector<const Elem*> family;
00733               neigh->family_tree_by_subneighbor (family, ancestor, this);
00734 
00735               // FIXME - There's a lot of ugly const_casts here; we
00736               // may want to make remote_elem non-const and create
00737               // non-const versions of the family_tree methods
00738               for (unsigned int i=0; i != family.size(); ++i)
00739                 {
00740                   Elem *n = const_cast<Elem*>(family[i]);
00741                   libmesh_assert (n);
00742                   if (n == remote_elem)
00743                     continue;
00744                   unsigned int my_s = n->which_neighbor_am_i(this);
00745                   libmesh_assert (my_s < n->n_neighbors());
00746                   libmesh_assert (n->neighbor(my_s) == this);
00747                   n->set_neighbor(my_s, const_cast<RemoteElem*>(remote_elem));
00748                 }
00749             }
00750 #endif
00751         }
00752     }
00753 
00754 #ifdef LIBMESH_ENABLE_AMR
00755   // Remotify parent's child link
00756   Elem *parent = this->parent();
00757   if (parent && parent != remote_elem)
00758     {
00759       unsigned int me = parent->which_child_am_i(this);
00760       libmesh_assert (parent->_children[me] == this);
00761       parent->_children[me] = const_cast<RemoteElem*>(remote_elem);
00762     }
00763 #endif
00764 }

unsigned int Elem::max_descendant_p_level (  )  const

Returns the maximum value of the p refinement levels of an ancestor element's descendants

Referenced by FEBase::coarsened_dof_values(), and is_ancestor_of().

unsigned int Elem::min_new_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const

Returns the minimum new p refinement level (i.e. after refinement and coarsening is done) of elements which are descended from this and which share a side with the active neighbor

Definition at line 1203 of file elem.C.

References active(), child(), COARSEN, has_neighbor(), std::min(), min_new_p_level_by_neighbor(), n_children(), p_level(), p_refinement_flag(), REFINE, remote_elem, and subactive().

Referenced by MeshRefinement::eliminate_unrefined_patches(), and min_new_p_level_by_neighbor().

01205 {
01206   libmesh_assert(!this->subactive());
01207   libmesh_assert(neighbor->active());
01208 
01209   // If we're an active element this is simple
01210   if (this->active())
01211     {
01212       unsigned int new_p_level = this->p_level();
01213       if (this->p_refinement_flag() == Elem::REFINE)
01214         new_p_level += 1;
01215       if (this->p_refinement_flag() == Elem::COARSEN)
01216         {
01217           libmesh_assert (new_p_level > 0);
01218           new_p_level -= 1;
01219         }
01220       return std::min(current_min, new_p_level);
01221     }
01222 
01223   libmesh_assert(has_neighbor(neighbor));
01224 
01225   unsigned int min_p_level = current_min;
01226 
01227   for (unsigned int c=0; c<this->n_children(); c++)
01228     {
01229       const Elem* const child = this->child(c);
01230       if (child && child != remote_elem)
01231         if (child->has_neighbor(neighbor))
01232           min_p_level =
01233             child->min_new_p_level_by_neighbor(neighbor,
01234                                                min_p_level);
01235     }
01236 
01237   return min_p_level;
01238 }

unsigned int Elem::min_p_level_by_neighbor ( const Elem neighbor,
unsigned int  current_min 
) const

Returns the minimum p refinement level of elements which are descended from this and which share a side with the active neighbor

Definition at line 1170 of file elem.C.

References active(), child(), has_neighbor(), std::min(), min_p_level_by_neighbor(), n_children(), p_level(), remote_elem, and subactive().

Referenced by FEBase::compute_periodic_constraints(), FEBase::compute_proj_constraints(), and min_p_level_by_neighbor().

01172 {
01173   libmesh_assert(!this->subactive());
01174   libmesh_assert(neighbor->active());
01175 
01176   // If we're an active element this is simple
01177   if (this->active())
01178     return std::min(current_min, this->p_level());
01179 
01180   libmesh_assert(has_neighbor(neighbor));
01181 
01182   // The p_level() of an ancestor element is already the minimum
01183   // p_level() of its children - so if that's high enough, we don't
01184   // need to examine any children.
01185   if (current_min <= this->p_level())
01186     return current_min;
01187 
01188   unsigned int min_p_level = current_min;
01189 
01190   for (unsigned int c=0; c<this->n_children(); c++)
01191     {
01192       const Elem* const child = this->child(c);
01193       if (child != remote_elem && child->has_neighbor(neighbor))
01194         min_p_level =
01195           child->min_p_level_by_neighbor(neighbor,
01196                                          min_p_level);
01197     }
01198 
01199   return min_p_level;
01200 }

unsigned int DofObject::n_comp ( const unsigned int  s,
const unsigned int  var 
) const [inline, inherited]

Returns:
the number of components for variable var of system s associated with this DofObject. For example, the HIERARCHIC shape functions may have multiple dof's associated with one node. Another example is the MONOMIALs, where only the elements hold the dof's, but for the different spatial directions, and orders, see FE.

Definition at line 538 of file dof_object.h.

References DofObject::_dof_ids, DofObject::_n_v_comp, DofObject::n_systems(), and DofObject::n_vars().

Referenced by DofMap::constrain_p_dofs(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofMap::dof_indices(), DofObject::dof_number(), DofObject::DofObject(), DofObject::invalidate_dofs(), DofObject::n_dofs(), DofMap::old_dof_indices(), DofMap::reinit(), DofObject::set_dof_number(), DofObject::set_n_comp(), DofMap::set_nonlocal_dof_objects(), and System::zero_variable().

00540 {
00541   libmesh_assert (s < this->n_systems());
00542   libmesh_assert (_dof_ids != NULL);
00543   libmesh_assert (_dof_ids[s] != NULL);
00544   libmesh_assert (_n_v_comp != NULL);
00545   libmesh_assert (_n_v_comp[s] != NULL);
00546 
00547 # ifdef DEBUG
00548   // Does this ever happen?  I doubt it... 3/7/2003 (BSK)
00549   if (var >= this->n_vars(s))
00550     {
00551       std::cout << "s=" << s << ", var=" << var << std::endl
00552                 << "this->n_vars(s)=" << this->n_vars(s) << std::endl
00553                 << "this->n_systems()=" << this->n_systems() << std::endl;
00554       libmesh_error();
00555     }
00556 # endif
00557   
00558   return static_cast<unsigned int>(_n_v_comp[s][var+1]);
00559 }

unsigned int DofObject::n_dofs ( const unsigned int  s,
const unsigned int  var = libMesh::invalid_uint 
) const [inline, inherited]

Returns:
the number of degrees of freedom associated with system s for this object. Optionally only counts degrees of freedom for variable number var

Definition at line 425 of file dof_object.h.

References libMesh::invalid_uint, DofObject::n_comp(), DofObject::n_systems(), and DofObject::n_vars().

00427 {
00428   libmesh_assert (s < this->n_systems());
00429   
00430   unsigned int num = 0;
00431 
00432   // Count all variables
00433   if (var == libMesh::invalid_uint)
00434     for (unsigned int v=0; v<this->n_vars(s); v++)
00435       num += this->n_comp(s,v);
00436   
00437   // Only count specified variable
00438   else
00439     {
00440       num = this->n_comp(s,var);
00441     }
00442 
00443   return num;
00444 }

virtual unsigned int Elem::n_edges (  )  const [pure virtual]

Returns:
the number of edges the element that has been derived from this class has.

Implemented in Hex, InfHex, InfPrism, Prism, Pyramid, Tet, Edge, InfQuad, Quad, Tri, NodeElem, and RemoteElem.

Referenced by FEBase::coarsened_dof_values(), is_child_on_edge(), MeshRefinement::limit_level_mismatch_at_edge(), and System::ProjectVector::operator()().

virtual unsigned int Elem::n_faces (  )  const [pure virtual]

Returns:
the number of faces the element that has been derived from this class has.

Implemented in Hex, InfHex, InfPrism, Prism, Pyramid, Tet, Edge, Face, InfQuad, NodeElem, and RemoteElem.

virtual unsigned int Elem::n_nodes (  )  const [pure virtual]

Returns:
the number of nodes this element contains.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism, Prism15, Prism18, Pyramid, Tet10, Tet4, Edge, Edge3, Edge4, InfQuad4, InfQuad6, Quad, Quad8, Quad9, Tri, Tri6, NodeElem, and RemoteElem.

Referenced by MetisPartitioner::_do_partition(), DofMap::add_neighbors_to_send_list(), EquationSystems::build_discontinuous_solution_vector(), EquationSystems::build_solution_vector(), VTKIO::cells_to_vtk(), coarsen(), FEBase::coarsened_dof_values(), FEBase::compute_proj_constraints(), DofMap::constrain_p_dofs(), MeshTools::correct_node_proc_ids(), UnstructuredMesh::create_submesh(), MeshCommunication::delete_remote_elements(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofMap::dof_indices(), FE< Dim, T >::dofs_on_edge(), FE< Dim, T >::dofs_on_side(), FEMContext::elem_position_get(), FEMContext::elem_position_set(), UNVIO::element_out(), MeshTools::Modification::flatten(), get_node(), MeshTools::get_not_subactive_node_ids(), ParmetisPartitioner::initialize(), TreeNode< N >::insert(), is_ancestor_of(), libmesh_assert_valid_node_pointers(), MeshTools::libmesh_assert_valid_node_procids(), MeshRefinement::limit_level_mismatch_at_node(), FE< Dim, T >::nodal_soln(), node(), DofMap::old_dof_indices(), System::ProjectVector::operator()(), operator==(), XdrIO::pack_element(), point(), TetGenMeshInterface::pointset_convexhull(), VTKIO::read(), UCDIO::read_implementation(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), XdrIO::read_serialized_connectivity(), refine(), FE< Dim, T >::reinit(), DofMap::reinit(), SerialMesh::renumber_nodes_and_elements(), ParallelMesh::renumber_nodes_and_elements(), Tet4::reselect_diagonal(), HPCoarsenTest::select_refinement(), set_node(), Partitioner::set_node_processor_ids(), LaplaceMeshSmoother::smooth(), MeshTools::Modification::smooth(), MeshTools::subdomain_bounding_box(), BoundaryInfo::sync(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), TetGenMeshInterface::triangulate_pointset(), GMVIO::write_ascii_new_impl(), write_connectivity(), ExodusII_IO_Helper::write_elements(), EnsightIO::write_geometry_ascii(), LegacyXdrIO::write_mesh(), GmshIO::write_mesh(), EnsightIO::write_scalar_ascii(), GnuPlotIO::write_solution(), and EnsightIO::write_vector_ascii().

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.

00077   { return _n_objects; }

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.

00077   { return _n_objects; }

unsigned int Elem::n_second_order_adjacent_vertices ( const unsigned int  n  )  const [virtual]

Returns:
the number of adjacent vertices, that uniquely define the location of the $ n^{th} $ second-order node. For linear elements ( default_order()==FIRST ), this returns 0. This method is useful when converting linear elements to quadratic elements. Note that n has to be greater or equal this->n_vertices().

Reimplemented in Hex20, Hex27, InfHex16, InfHex18, InfPrism12, Prism15, Prism18, Tet10, Edge3, Edge4, InfQuad6, Quad8, Quad9, and Tri6.

Definition at line 1288 of file elem.C.

Referenced by LaplaceMeshSmoother::smooth(), and MeshTools::Modification::smooth().

01289 {
01290   // for linear elements, always return 0
01291   return 0;
01292 }

virtual unsigned int Elem::n_sub_elem (  )  const [pure virtual]

Returns:
the number of children this element has that share side s

the number of sub-elements this element may be broken down into for visualization purposes. For example, this returns 1 for a linear triangle, 4 for a quadratic (6-noded) triangle, etc...

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

Referenced by GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), write_connectivity(), and DivaIO::write_stream().

unsigned int DofObject::n_systems (  )  const [inline, inherited]

unsigned int DofObject::n_vars ( const unsigned int  s  )  const [inline, inherited]

Returns:
the number of variables associated with system s for this DofObject

Definition at line 525 of file dof_object.h.

References DofObject::_n_v_comp, and DofObject::n_systems().

Referenced by DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofObject::dof_number(), DofObject::DofObject(), DofObject::has_dofs(), DofObject::invalidate_dofs(), DofObject::n_comp(), DofObject::n_dofs(), DofObject::set_dof_number(), DofObject::set_n_comp(), DofObject::set_n_vars(), and DofMap::set_nonlocal_dof_objects().

00526 {
00527   libmesh_assert (s < this->n_systems());
00528   libmesh_assert (_n_v_comp != NULL);
00529   if (_n_v_comp[s] == NULL)
00530     return 0;
00531   return static_cast<unsigned int>(_n_v_comp[s][0]);
00532 }

Elem * Elem::neighbor ( const unsigned int  i  )  const [inline]

Returns:
a pointer to the $ i^{th} $ neighbor of this element. If MeshBase::find_neighbors() has not been called this simply returns NULL. If MeshBase::find_neighbors() has been called and this returns NULL then the side is on a boundary of the domain.

Definition at line 1226 of file elem.h.

References _neighbors, and n_neighbors().

Referenced by MetisPartitioner::_do_partition(), DofMap::add_neighbors_to_send_list(), FEMSystem::assemble_qoi(), FEMSystem::assemble_qoi_derivative(), FEMSystem::assembly(), MeshTools::Generation::build_delaunay_square(), ParmetisPartitioner::build_graph(), InfElemBuilder::build_inf_elem(), child_neighbor(), FEBase::compute_periodic_constraints(), FEBase::compute_proj_constraints(), UnstructuredMesh::create_submesh(), MeshRefinement::eliminate_unrefined_patches(), JumpErrorEstimator::estimate_error(), family_tree_by_subneighbor(), find_edge_neighbors(), Patch::find_face_neighbors(), MeshTools::find_hanging_nodes_and_parents(), UnstructuredMesh::find_neighbors(), find_point_neighbors(), MeshTools::Modification::flatten(), has_neighbor(), LaplaceMeshSmoother::init(), is_ancestor_of(), MeshTools::libmesh_assert_no_links_to_elem(), libmesh_assert_valid_neighbors(), MeshTools::libmesh_assert_valid_node_pointers(), MeshTools::libmesh_assert_valid_remote_elems(), MeshRefinement::make_coarsening_compatible(), make_links_to_me_remote(), MeshRefinement::make_refinement_compatible(), nullify_neighbors(), SparsityPattern::Build::operator()(), FEMSystem::postprocess(), GmshIO::read_mesh(), REINIT_ERROR(), MeshTools::Modification::smooth(), BoundaryInfo::sync(), MeshRefinement::test_level_one(), TetGenMeshInterface::triangulate_conformingDelaunayMesh(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), which_neighbor_am_i(), XdrIO::write_serialized_bcs(), GnuPlotIO::write_solution(), and DivaIO::write_stream().

01227 {
01228   libmesh_assert (i < this->n_neighbors());
01229 
01230   return _neighbors[i];
01231 }

unsigned int Elem::node ( const unsigned int  i  )  const [inline, virtual]

Returns:
the global id number of local Node i.

Reimplemented in RemoteElem.

Definition at line 1177 of file elem.h.

References _nodes, DofObject::id(), DofObject::invalid_id, and n_nodes().

Referenced by DofMap::add_neighbors_to_send_list(), EquationSystems::build_solution_vector(), FEBase::compute_face_map(), Tri6::connectivity(), Tri3::connectivity(), Quad9::connectivity(), Quad8::connectivity(), Quad4::connectivity(), InfQuad6::connectivity(), InfQuad4::connectivity(), InfEdge2::connectivity(), Edge4::connectivity(), Edge3::connectivity(), Edge2::connectivity(), Tet4::connectivity(), Tet10::connectivity(), Pyramid5::connectivity(), Prism6::connectivity(), Prism18::connectivity(), Prism15::connectivity(), InfPrism6::connectivity(), InfPrism12::connectivity(), InfHex8::connectivity(), InfHex18::connectivity(), InfHex16::connectivity(), Hex8::connectivity(), Hex27::connectivity(), Hex20::connectivity(), UnstructuredMesh::copy_nodes_and_elements(), UnstructuredMesh::create_submesh(), MeshCommunication::delete_remote_elements(), MeshTools::find_hanging_nodes_and_parents(), MeshTools::get_not_subactive_node_ids(), is_ancestor_of(), Tri6::key(), Tri::key(), Quad9::key(), Quad8::key(), Quad::key(), InfQuad::key(), Edge::key(), Tet::key(), Pyramid::key(), Prism::key(), InfPrism::key(), InfHex18::key(), InfHex::key(), Hex27::key(), Hex::key(), MeshRefinement::limit_level_mismatch_at_node(), operator==(), XdrIO::pack_element(), SerialMesh::renumber_nodes_and_elements(), ParallelMesh::renumber_nodes_and_elements(), LaplaceMeshSmoother::smooth(), MeshTools::subdomain_bounding_box(), BoundaryInfo::sync(), GMVIO::write_ascii_new_impl(), write_connectivity(), ExodusII_IO_Helper::write_elements(), EnsightIO::write_geometry_ascii(), LegacyXdrIO::write_mesh(), GmshIO::write_mesh(), GmshIO::write_post(), EnsightIO::write_scalar_ascii(), GnuPlotIO::write_solution(), DivaIO::write_stream(), and EnsightIO::write_vector_ascii().

01178 {
01179   libmesh_assert (i < this->n_nodes());
01180   libmesh_assert (_nodes[i] != NULL);
01181   libmesh_assert (_nodes[i]->id() != Node::invalid_id);
01182 
01183   return _nodes[i]->id();
01184 }

void Elem::nullify_neighbors (  )  [protected]

Replaces this element with NULL for all of its neighbors. This is useful when deleting an element.

Definition at line 1262 of file elem.C.

References level(), n_neighbors(), neighbor(), remote_elem, set_neighbor(), and which_neighbor_am_i().

Referenced by MeshRefinement::_coarsen_elements().

01263 {
01264   // Tell any of my neighbors about my death...
01265   // Looks strange, huh?
01266   for (unsigned int n=0; n<this->n_neighbors(); n++)
01267     {
01268       Elem* neighbor = this->neighbor(n);
01269       if (neighbor && neighbor != remote_elem)
01270         {
01271           // Note:  it is possible that I see the neighbor
01272           // (which is coarser than me)
01273           // but they don't see me, so avoid that case.
01274           if (neighbor->level() == this->level())
01275             {   
01276               const unsigned int w_n_a_i = neighbor->which_neighbor_am_i(this);
01277               libmesh_assert (w_n_a_i < neighbor->n_neighbors());
01278               neighbor->set_neighbor(w_n_a_i, NULL);
01279               this->set_neighbor(n, NULL);
01280             }
01281         }
01282     }
01283 }

bool Elem::on_boundary (  )  const [inline]

Returns:
true if this element has a side coincident with a boundary (indicated by a NULL neighbor), false otherwise.

Definition at line 1284 of file elem.h.

References has_neighbor().

01285 {
01286   // By convention, the element is on the boundary
01287   // if it has a NULL neighbor.
01288   return this->has_neighbor(NULL);
01289 }

bool Elem::operator== ( const DofObject rhs  )  const [virtual]

Returns:
true if two elements are identical, false otherwise. This is true if the elements are connected to identical global nodes, regardless of how those nodes might be numbered local to the elements.

Reimplemented from DofObject.

Definition at line 334 of file elem.C.

References n_nodes(), and node().

Referenced by is_ancestor_of().

00335 {
00336 
00337     // Cast rhs to an Elem*
00338     const Elem* rhs_elem = dynamic_cast<const Elem*>(&rhs);
00339 
00340     // If we cannot cast to an Elem*, rhs must be a Node
00341     if(rhs_elem == static_cast<const Elem*>(NULL))
00342         return false;
00343 
00344 //   libmesh_assert (n_nodes());
00345 //   libmesh_assert (rhs.n_nodes());
00346 
00347 //   // Elements can only be equal if they
00348 //   // contain the same number of nodes.
00349 //   if (this->n_nodes() == rhs.n_nodes())
00350 //     {
00351 //       // Create a set that contains our global
00352 //       // node numbers and those of our neighbor.
00353 //       // If the set is the same size as the number
00354 //       // of nodes in both elements then they must
00355 //       // be connected to the same nodes.     
00356 //       std::set<unsigned int> nodes_set;
00357 
00358 //       for (unsigned int n=0; n<this->n_nodes(); n++)
00359 //         {
00360 //           nodes_set.insert(this->node(n));
00361 //           nodes_set.insert(rhs.node(n));
00362 //         }
00363 
00364 //       // If this passes the elements are connected
00365 //       // to the same global nodes
00366 //       if (nodes_set.size() == this->n_nodes())
00367 //         return true;
00368 //     }
00369 
00370 //   // If we get here it is because the elements either
00371 //   // do not have the same number of nodes or they are
00372 //   // connected to different nodes.  Either way they
00373 //   // are not the same element
00374 //   return false;
00375   
00376   // Useful typedefs
00377   typedef std::vector<unsigned int>::iterator iterator;
00378 
00379   
00380   // Elements can only be equal if they
00381   // contain the same number of nodes.
00382   // However, we will only test the vertices,
00383   // which is sufficient & cheaper
00384   if (this->n_nodes() == rhs_elem->n_nodes())
00385     {
00386       // The number of nodes in the element
00387       const unsigned int nn = this->n_nodes();
00388       
00389       // Create a vector that contains our global
00390       // node numbers and those of our neighbor.
00391       // If the sorted, unique vector is the same size
00392       // as the number of nodes in both elements then
00393       // they must be connected to the same nodes.
00394       //
00395       // The vector will be no larger than 2*n_nodes(),
00396       // so we might as well reserve the space.
00397       std::vector<unsigned int> common_nodes;
00398       common_nodes.reserve (2*nn);
00399 
00400       // Add the global indices of the nodes
00401       for (unsigned int n=0; n<nn; n++)
00402         {
00403           common_nodes.push_back (this->node(n));
00404           common_nodes.push_back (rhs_elem->node(n));
00405         }
00406 
00407       // Sort the vector and find out how long
00408       // the sorted vector is.
00409       std::sort (common_nodes.begin(), common_nodes.end());
00410       
00411       iterator new_end = std::unique (common_nodes.begin(),
00412                                       common_nodes.end());
00413       
00414       const int new_size = std::distance (common_nodes.begin(),
00415                                           new_end);
00416       
00417       // If this passes the elements are connected
00418       // to the same global vertex nodes
00419       if (new_size == static_cast<int>(nn))
00420         return true;
00421     }
00422 
00423   // If we get here it is because the elements either
00424   // do not have the same number of nodes or they are
00425   // connected to different nodes.  Either way they
00426   // are not the same element
00427   return false;
00428 }

virtual Point Elem::origin (  )  const [inline, virtual]

Returns:
the origin for an infinite element. Currently, all infinite elements used in a mesh share the same origin. Overload this in infinite element classes. By default, issues an error, because returning the all zero point would very likely lead to unexpected behavior.

Reimplemented in InfCell, InfEdge2, and InfQuad.

Definition at line 904 of file elem.h.

Referenced by InfFE< Dim, T_radial, T_map >::combine_base_radial(), InfFE< Dim, T_radial, T_map >::compute_data(), InfFE< Dim, T_radial, T_map >::inverse_map(), and InfFE< Dim, T_radial, T_map >::map().

00904 { libmesh_error(); return Point(); }

Elem* Elem::parent (  ) 

Returns:
a pointer to the element's parent. Returns NULL if the element was not created via refinement, i.e. was read from file.

Point & Elem::point ( const unsigned int  i  )  [inline, virtual]

Returns:
the Point associated with local Node i as a writeable reference.

Reimplemented in RemoteElem.

Definition at line 1167 of file elem.h.

References _nodes, and n_nodes().

01168 {
01169   libmesh_assert (i < this->n_nodes());
01170 
01171   return *_nodes[i];
01172 }

const Point & Elem::point ( const unsigned int  i  )  const [inline, virtual]

Returns:
the Point associated with local Node i.

Reimplemented in RemoteElem.

Definition at line 1155 of file elem.h.

References _nodes, DofObject::invalid_id, and n_nodes().

Referenced by PostscriptIO::_compute_edge_bezier_coeffs(), clough_compute_coefs(), coarsen(), InfFE< Dim, T_radial, T_map >::combine_base_radial(), FEBase::compute_affine_map(), InfFE< Dim, T_radial, T_map >::compute_data(), FEBase::compute_edge_map(), FEBase::compute_face_map(), FEXYZ< Dim >::compute_face_values(), FEBase::compute_single_point_map(), contains_edge_of(), InfQuad4::contains_point(), InfPrism6::contains_point(), InfHex8::contains_point(), contains_vertex_of(), UnstructuredMesh::create_submesh(), cube_indices(), FEMContext::elem_position_get(), FEMContext::elem_position_set(), Tet4::embedding_matrix(), Tet10::embedding_matrix(), get_min_point(), Tri6::has_affine_map(), Quad9::has_affine_map(), Quad8::has_affine_map(), Quad4::has_affine_map(), Edge4::has_affine_map(), Edge3::has_affine_map(), Tet10::has_affine_map(), Prism6::has_affine_map(), Prism18::has_affine_map(), Prism15::has_affine_map(), Hex8::has_affine_map(), Hex27::has_affine_map(), Hex20::has_affine_map(), hermite_compute_coefs(), hmax(), hmin(), TreeNode< N >::insert(), InfFE< Dim, T_radial, T_map >::inverse_map(), length(), InfFE< Dim, T_radial, T_map >::map(), FE< Dim, T >::map(), FE< Dim, T >::map_eta(), FE< Dim, T >::map_xi(), FE< Dim, T >::map_zeta(), Tri3::min_and_max_angle(), Tet4::min_and_max_angle(), FE< Dim, T >::nodal_soln(), FEMSystem::numerical_jacobian(), System::ProjectVector::operator()(), InfQuad::origin(), InfEdge2::origin(), InfCell::origin(), PostscriptIO::plot_linear_elem(), refine(), FE< Dim, T >::reinit(), Tet4::reselect_optimal_diagonal(), FE< Dim, T >::shape(), FE< Dim, T >::shape_deriv(), MeshTools::Modification::smooth(), Quad4::volume(), Edge3::volume(), Edge2::volume(), EnsightIO::write_geometry_ascii(), and GmshIO::write_post().

01156 {
01157   libmesh_assert (i < this->n_nodes());
01158   libmesh_assert (_nodes[i] != NULL);
01159   libmesh_assert (_nodes[i]->id() != Node::invalid_id);
01160 
01161   return *_nodes[i];
01162 }

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().

00084 {
00085 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
00086   
00087   std::cout << ReferenceCounter::get_info();
00088   
00089 #endif
00090 }

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().

00084 {
00085 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
00086   
00087   std::cout << ReferenceCounter::get_info();
00088   
00089 #endif
00090 }

void DofObject::processor_id ( const unsigned int  id  )  [inline, inherited]

Sets the processor_id for this DofObject.

Definition at line 489 of file dof_object.h.

References DofObject::processor_id().

00490 {
00491 #ifdef DEBUG
00492   
00493   if (id != static_cast<unsigned int>(static_cast<unsigned short int>(id)))
00494     {
00495       std::cerr << "ERROR: id too large for unsigned short int!" << std::endl
00496                 << "Recompile with DofObject::_processor_id larger!" << std::endl;
00497       
00498       libmesh_error();
00499     }
00500 
00501 #endif
00502   
00503   this->processor_id() = id;
00504 }

unsigned short int & DofObject::processor_id (  )  [inline, inherited]

Returns:
the processor that this element belongs to as a writeable reference.

Definition at line 481 of file dof_object.h.

References DofObject::_processor_id.

00482 {
00483   return _processor_id;
00484 }

unsigned short int DofObject::processor_id (  )  const [inline, inherited]

Returns:
the processor that this element belongs to. To conserve space this is stored as a short integer.

Definition at line 473 of file dof_object.h.

References DofObject::_processor_id.

Referenced by MetisPartitioner::_do_partition(), LinearPartitioner::_do_partition(), CentroidPartitioner::_do_partition(), ParallelMesh::add_elem(), Patch::add_local_face_neighbors(), Patch::add_local_point_neighbors(), DofMap::add_neighbors_to_send_list(), ParallelMesh::add_node(), SerialMesh::add_point(), ParallelMesh::add_point(), UnstructuredMesh::all_first_order(), UnstructuredMesh::all_second_order(), MeshTools::Modification::all_tri(), ParmetisPartitioner::assign_partitioning(), Patch::build_around_element(), InfElemBuilder::build_inf_elem(), UnstructuredMesh::copy_nodes_and_elements(), MeshTools::correct_node_proc_ids(), UnstructuredMesh::create_submesh(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), Elem(), UnstructuredMesh::find_neighbors(), MeshTools::Modification::flatten(), DofObject::invalidate_processor_id(), is_ancestor_of(), MeshTools::libmesh_assert_valid_elem_ids(), MeshRefinement::make_coarsening_compatible(), XdrIO::pack_element(), Partitioner::partition_unpartitioned_elements(), DofObject::processor_id(), Nemesis_IO::read(), XdrIO::read_serialized_connectivity(), MeshData::read_xdr(), refine(), Partitioner::set_node_processor_ids(), DofMap::set_nonlocal_dof_objects(), Partitioner::set_parent_processor_ids(), BoundaryInfo::sync(), Parallel::sync_dofobject_data_by_id(), Parallel::sync_element_data_by_parent_id(), GmshIO::write_mesh(), and XdrIO::write_serialized_connectivity().

00474 {
00475   return _processor_id;
00476 }

virtual std::pair<Real,Real> Elem::qual_bounds ( const   ElemQuality  )  const [inline, virtual]

Returns the suggested quality bounds for the hex based on quality measure q. These are the values suggested by the CUBIT User's Manual. Since this function can have no possible meaning for an abstract Elem, it is an error.

Reimplemented in Hex, InfHex, Tet, InfQuad, Quad, and Tri.

Definition at line 465 of file elem.h.

00466   { libmesh_error(); return std::make_pair(0.,0.); }

Real Elem::quality ( const ElemQuality  q  )  const [virtual]

Based on the quality metric q specified by the user, returns a quantitative assessment of element quality.

I don't know what to do for this metric.

Reimplemented in Hex, InfHex, Tet, InfQuad, Quad, and Tri.

Definition at line 847 of file elem.C.

00848 {
00849   switch (q)
00850     {    
00854     default:
00855       {
00856         libmesh_here();
00857 
00858         std::cerr << "ERROR:  unknown quality metric: "
00859                   << q 
00860                   << std::endl
00861                   << "Cowardly returning 1."
00862                   << std::endl;
00863 
00864         return 1.;
00865       }
00866     }
00867 
00868     
00869     // Will never get here...
00870     libmesh_error();
00871     return 0.;
00872 }

void Elem::refine ( MeshRefinement mesh_refinement  )  [virtual]

Refine the element.

The following functions only apply when AMR is enabled and thus are not present otherwise.

Definition at line 40 of file elem_refinement.C.

References _children, active(), MeshRefinement::add_elem(), MeshRefinement::add_point(), ancestor(), build(), child(), embedding_matrix(), get_node(), hmin(), INACTIVE, JUST_REFINED, n_children(), n_nodes(), DofObject::n_systems(), nodes, p_level(), p_refinement_flag(), parent(), point(), DofObject::processor_id(), REFINE, refinement_flag(), DofObject::set_n_systems(), set_node(), set_p_level(), set_p_refinement_flag(), set_refinement_flag(), subactive(), and type().

00041 {
00042   libmesh_assert (this->refinement_flag() == Elem::REFINE);
00043   libmesh_assert (this->active());
00044   
00045   // Create my children if necessary
00046   if (!_children)
00047     {
00048       _children = new Elem*[this->n_children()];
00049 
00050       unsigned int parent_p_level = this->p_level();
00051       for (unsigned int c=0; c<this->n_children(); c++)
00052         {
00053           _children[c] = Elem::build(this->type(), this).release();
00054           _children[c]->set_refinement_flag(Elem::JUST_REFINED);
00055           _children[c]->set_p_level(parent_p_level);
00056           _children[c]->set_p_refinement_flag(this->p_refinement_flag());
00057         }
00058 
00059       // Compute new nodal locations
00060       // and asssign nodes to children
00061       // Make these static.  It is unlikely the
00062       // sizes will change from call to call, so having these
00063       // static should save on reallocations
00064       std::vector<std::vector<Point> >        p    (this->n_children());
00065       std::vector<std::vector<Node*> >        nodes(this->n_children());
00066     
00067 
00068       // compute new nodal locations
00069       for (unsigned int c=0; c<this->n_children(); c++)
00070         {       
00071           Elem *child = this->child(c);
00072           p[c].resize    (child->n_nodes());
00073           nodes[c].resize(child->n_nodes());
00074 
00075           for (unsigned int nc=0; nc<child->n_nodes(); nc++)
00076             {
00077               // zero entries
00078               p[c][nc].zero();
00079               nodes[c][nc] = NULL;
00080           
00081               for (unsigned int n=0; n<this->n_nodes(); n++)
00082                 {
00083                   // The value from the embedding matrix
00084                   const float em_val = this->embedding_matrix(c,nc,n);
00085               
00086                   if (em_val != 0.)
00087                     {
00088                       p[c][nc].add_scaled (this->point(n), em_val);
00089                   
00090                       // We may have found the node, in which case we
00091                       // won't need to look it up later.
00092                       if (em_val == 1.)
00093                         nodes[c][nc] = this->get_node(n);
00094                     }
00095                 }
00096             }
00097       
00098         // assign nodes to children & add them to the mesh
00099           const Real pointtol = this->hmin() * TOLERANCE;
00100           for (unsigned int nc=0; nc<child->n_nodes(); nc++)
00101             {
00102               if (nodes[c][nc] != NULL)
00103                 {
00104                   child->set_node(nc) = nodes[c][nc];
00105                 }
00106               else
00107                 {
00108                   child->set_node(nc) =
00109                     mesh_refinement.add_point(p[c][nc],
00110                                               child->processor_id(),
00111                                               pointtol);
00112                   child->get_node(nc)->set_n_systems
00113                     (this->n_systems());
00114                 }
00115             }
00116       
00117           mesh_refinement.add_elem (child);
00118           child->set_n_systems(this->n_systems());
00119         }
00120     }
00121   else
00122     {
00123       unsigned int parent_p_level = this->p_level();
00124       for (unsigned int c=0; c<this->n_children(); c++)
00125         {       
00126           Elem *child = this->child(c);
00127           libmesh_assert(child->subactive());
00128           child->set_refinement_flag(Elem::JUST_REFINED);
00129           child->set_p_level(parent_p_level);
00130           child->set_p_refinement_flag(this->p_refinement_flag());
00131         }
00132     }
00133 
00134   // Un-set my refinement flag now
00135   this->set_refinement_flag(Elem::INACTIVE);
00136   this->set_p_refinement_flag(Elem::INACTIVE);
00137 
00138   for (unsigned int c=0; c<this->n_children(); c++)
00139     {   
00140       libmesh_assert(this->child(c)->parent() == this);
00141       libmesh_assert(this->child(c)->active());
00142     }
00143   libmesh_assert (this->ancestor());
00144 }

unsigned short int Elem::second_order_adjacent_vertex ( const unsigned int  n,
const unsigned int  v 
) const [virtual]

Returns:
the element-local number of the $ v^{th} $ vertex that defines the $ n^{th} $ second-order node. Note that the return value is always less this->n_vertices(), while n has to be greater or equal this->n_vertices(). For linear elements this returns 0.

Reimplemented in Hex20, Hex27, InfHex16, InfHex18, InfPrism12, Prism15, Prism18, Tet10, Edge3, Edge4, InfQuad6, Quad8, Quad9, and Tri6.

Definition at line 1296 of file elem.C.

Referenced by LaplaceMeshSmoother::smooth(), and MeshTools::Modification::smooth().

01298 {
01299   // for linear elements, always return 0
01300   return 0;
01301 }

std::pair< unsigned short int, unsigned short int > Elem::second_order_child_vertex ( const unsigned int  n  )  const [virtual]

Returns:
the child number c and element-local index v of the $ n^{th} $ second-order node on the parent element. Note that the return values are always less this->n_children() and this->child(c)->n_vertices(), while n has to be greater or equal to * this->n_vertices(). For linear elements this returns 0,0. On refined second order elements, the return value will satisfy this->get_node(n)==this->child(c)->get_node(v)

Reimplemented in Hex20, Hex27, InfHex16, InfHex18, InfPrism12, Prism15, Prism18, Tet10, Edge3, InfQuad6, Quad8, Quad9, and Tri6.

Definition at line 1306 of file elem.C.

01307 {
01308   // for linear elements, always return 0
01309   return std::pair<unsigned short int, unsigned short int>(0,0);
01310 }

ElemType Elem::second_order_equivalent_type ( const ElemType  et,
const bool  full_ordered = true 
) [static]

Returns:
the element type of the associated second-order element, e.g. when this is a TET4, then TET10 is returned. Returns INVALID_ELEM for second order or other elements that should not or cannot be converted into higher order equivalents.
For some elements, there exist two second-order equivalents, e.g. for Quad4 there is Quad8 and Quad9. When the optional full_ordered is true, then QUAD9 is returned. When full_ordered is false, then QUAD8 is returned.

Definition at line 1364 of file elem.C.

References libMeshEnums::EDGE2, libMeshEnums::EDGE3, libMeshEnums::HEX20, libMeshEnums::HEX27, libMeshEnums::HEX8, libMeshEnums::INFEDGE2, libMeshEnums::INFHEX16, libMeshEnums::INFHEX18, libMeshEnums::INFHEX8, libMeshEnums::INFPRISM12, libMeshEnums::INFPRISM6, libMeshEnums::INFQUAD4, libMeshEnums::INFQUAD6, libMeshEnums::INVALID_ELEM, libMeshEnums::PRISM15, libMeshEnums::PRISM18, libMeshEnums::PRISM6, libMeshEnums::PYRAMID5, libMeshEnums::QUAD4, libMeshEnums::QUAD8, libMeshEnums::QUAD9, libMeshEnums::TET10, libMeshEnums::TET4, libMeshEnums::TRI3, and libMeshEnums::TRI6.

Referenced by UnstructuredMesh::all_second_order().

01366 { 
01367   /* for second-order elements, always return \p INVALID_ELEM
01368    * since second-order elements should not be converted
01369    * into something else.  Only linear elements should 
01370    * return something sensible here
01371    */
01372   switch (et)
01373     {
01374     case EDGE2:
01375       {
01376         // full_ordered not relevant
01377         return EDGE3;
01378       }
01379 
01380     case TRI3:
01381       {
01382         // full_ordered not relevant
01383         return TRI6;
01384       }
01385 
01386     case QUAD4:
01387       {
01388         if (full_ordered)
01389           return QUAD9;
01390         else 
01391           return QUAD8;
01392       }
01393 
01394     case TET4:
01395       {
01396         // full_ordered not relevant
01397         return TET10;
01398       }
01399 
01400     case HEX8:
01401       {
01402         // see below how this correlates with INFHEX8
01403         if (full_ordered)
01404           return HEX27;
01405         else 
01406           return HEX20;
01407       }
01408 
01409     case PRISM6:
01410       {
01411         if (full_ordered)
01412           return PRISM18;
01413         else 
01414           return PRISM15;
01415       }
01416 
01417     case PYRAMID5:
01418       {
01419         // libmesh_error(); 
01420         return INVALID_ELEM;
01421       }
01422 
01423 
01424 
01425 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
01426 
01427     // infinite elements
01428     case INFEDGE2:
01429       {
01430         // libmesh_error(); 
01431         return INVALID_ELEM;
01432       }
01433 
01434     case INFQUAD4:
01435       {
01436         // full_ordered not relevant
01437         return INFQUAD6;
01438       }
01439 
01440     case INFHEX8:
01441       {
01442         /*
01443          * Note that this matches with \p Hex8:
01444          * For full-ordered, \p InfHex18 and \p Hex27
01445          * belong together, and for not full-ordered,
01446          * \p InfHex16 and \p Hex20 belong together.
01447          */
01448         if (full_ordered)
01449           return INFHEX18;
01450         else 
01451           return INFHEX16;
01452       }
01453 
01454     case INFPRISM6:
01455       {
01456         // full_ordered not relevant
01457         return INFPRISM12;
01458       }
01459 
01460 #endif
01461 
01462 
01463     default:
01464       {
01465         // second-order element
01466         return INVALID_ELEM;
01467       }
01468     }
01469 }

void DofObject::set_dof_number ( const unsigned int  s,
const unsigned int  var,
const unsigned int  comp,
const unsigned int  dn 
) [inherited]

Sets the global degree of freedom number variable var, component comp for system s associated with this DofObject

Definition at line 338 of file dof_object.C.

References DofObject::_dof_ids, DofObject::dof_number(), DofObject::invalid_id, DofObject::n_comp(), DofObject::n_systems(), and DofObject::n_vars().

Referenced by DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), DofObject::invalidate_dofs(), DofMap::reinit(), and DofMap::set_nonlocal_dof_objects().

00342 {
00343   libmesh_assert (s < this->n_systems());
00344   libmesh_assert (var  < this->n_vars(s));
00345   libmesh_assert (_dof_ids != NULL);
00346   libmesh_assert (_dof_ids[s] != NULL);
00347   libmesh_assert (comp < this->n_comp(s,var));
00348   
00349   //We intend to change all dof numbers together or not at all
00350   if (comp)
00351     libmesh_assert ((dn == invalid_id && _dof_ids[s][var] == invalid_id) || 
00352                     (dn == _dof_ids[s][var] + comp));
00353   else
00354     _dof_ids[s][var] = dn;
00355 
00356 
00357   libmesh_assert(this->dof_number(s, var, comp) == dn);
00358 }

void DofObject::set_id ( const unsigned int  id  )  [inline, inherited]

Sets the id for this DofObject

Definition at line 143 of file dof_object.h.

References DofObject::set_id().

Referenced by DofObject::set_id().

00144   { this->set_id() = id; }

void DofObject::set_n_comp ( const unsigned int  s,
const unsigned int  var,
const unsigned int  ncomp 
) [inherited]

Sets the number of components for variable var of system s associated with this DofObject

Definition at line 298 of file dof_object.C.

References DofObject::_dof_ids, DofObject::_n_v_comp, DofObject::invalid_id, DofObject::n_comp(), DofObject::n_systems(), and DofObject::n_vars().

Referenced by DofMap::reinit(), and DofMap::set_nonlocal_dof_objects().

00301 {
00302   libmesh_assert (s < this->n_systems());
00303   libmesh_assert (var < this->n_vars(s));
00304   libmesh_assert (_dof_ids != NULL);
00305   libmesh_assert (_dof_ids[s] != NULL);
00306   
00307   // Check for trivial return
00308   if (ncomp == this->n_comp(s,var)) return;
00309 
00310 #ifdef DEBUG
00311 
00312   if (ncomp != static_cast<unsigned int>(static_cast<unsigned char>(ncomp)))
00313     {
00314       std::cerr << "Unsigned char not big enough to hold ncomp!" << std::endl
00315                 << "Recompile with _n_v_comp set to a bigger type!"
00316                 << std::endl;
00317       
00318       libmesh_error();
00319     }
00320   
00321 #endif
00322 
00323   // We use (invalid_id - 1) to signify no
00324   // components for this object
00325   if (ncomp == 0)
00326     {
00327       _dof_ids[s][var] = (invalid_id - 1);
00328     }
00329   
00330   libmesh_assert (_n_v_comp    != NULL);
00331   libmesh_assert (_n_v_comp[s] != NULL);
00332     
00333   _n_v_comp[s][var+1]  = static_cast<unsigned char>(ncomp);
00334 }

void DofObject::set_n_systems ( const unsigned int  s  )  [inherited]

Sets the number of systems for this DofObject

Definition at line 148 of file dof_object.C.

References DofObject::_dof_ids, DofObject::_n_systems, DofObject::_n_v_comp, DofObject::clear_dofs(), and DofObject::n_systems().

Referenced by refine().

00149 {
00150   // Check for trivial return
00151   if (ns == this->n_systems()) return;
00152  
00153 #ifdef DEBUG
00154 
00155   if (ns != static_cast<unsigned int>(static_cast<unsigned char>(ns)))
00156     {
00157       std::cerr << "Unsigned char not big enough to hold ns!" << std::endl
00158                 << "Recompile with _n_systems set to a bigger type!"
00159                 << std::endl;
00160       
00161       libmesh_error();
00162     }
00163                                         
00164 #endif
00165 
00166 
00167   // Clear any existing data.  This is safe to call
00168   // even if we don't have any data.
00169   this->clear_dofs();
00170 
00171   // Set the new number of systems
00172   _n_systems = static_cast<unsigned char>(ns);
00173   
00174   // Allocate storage for the systems
00175   _n_v_comp = new unsigned char* [this->n_systems()];
00176   _dof_ids  = new unsigned int*  [this->n_systems()];
00177 
00178   // No variables have been declared yet.
00179   for (unsigned int s=0; s<this->n_systems(); s++)
00180     {
00181       _n_v_comp[s] = NULL;
00182       _dof_ids[s]  = NULL;
00183     }
00184 }

void DofObject::set_n_vars ( const unsigned int  s,
const unsigned int  nvars 
) [inherited]

Sets number of variables associated with system s for this DofObject

Definition at line 241 of file dof_object.C.

References DofObject::_dof_ids, DofObject::_n_v_comp, DofObject::invalid_id, DofObject::n_systems(), and DofObject::n_vars().

00243 {
00244   libmesh_assert (s < this->n_systems());
00245   libmesh_assert (_n_v_comp != NULL);
00246   libmesh_assert (_dof_ids  != NULL);
00247 
00248 #ifdef DEBUG
00249 
00250   if (nvars != static_cast<unsigned int>(static_cast<unsigned char>(nvars)))
00251     {
00252       std::cerr << "Unsigned char not big enough to hold nvar!" << std::endl
00253                 << "Recompile with _n_vars set to a bigger type!"
00254                 << std::endl;
00255       
00256       libmesh_error();
00257     }
00258                                         
00259 #endif
00260 
00261   
00262   
00263   // If we already have memory allocated clear it.
00264   if (this->n_vars(s) != 0)
00265     {
00266       libmesh_assert (_n_v_comp[s] != NULL); delete [] _n_v_comp[s]; _n_v_comp[s] = NULL;
00267       libmesh_assert (_dof_ids[s]  != NULL); delete [] _dof_ids[s];  _dof_ids[s]  = NULL;
00268     }
00269 
00270   // Reset the number of variables in the system  
00271   if (nvars > 0)
00272     {
00273       libmesh_assert (_n_v_comp[s] == NULL);
00274       libmesh_assert (_dof_ids[s]  == NULL);
00275       
00276       _n_v_comp[s] = new unsigned char [nvars+1];
00277       _dof_ids[s]  = new unsigned int  [nvars];
00278       
00279       _n_v_comp[s][0] = static_cast<unsigned char>(nvars);
00280 
00281       libmesh_assert (nvars == this->n_vars(s));
00282       
00283       for (unsigned int v=0; v<this->n_vars(s); v++)
00284         {
00285           _n_v_comp[s][v+1] = 0;
00286           _dof_ids[s][v]    = invalid_id - 1;
00287         }
00288     }
00289   else // (nvars == 0)
00290     {
00291       libmesh_assert (_n_v_comp[s] == NULL);
00292       libmesh_assert (_dof_ids[s]  == NULL);
00293     }
00294 }

void Elem::set_neighbor ( const unsigned int  i,
Elem n 
) [inline]

Assigns n as the $ i^{th} $ neighbor.

Definition at line 1236 of file elem.h.

References _neighbors, and n_neighbors().

Referenced by UnstructuredMesh::find_neighbors(), make_links_to_me_remote(), and nullify_neighbors().

01237 {
01238   libmesh_assert (i < this->n_neighbors());
01239   
01240   _neighbors[i] = n;
01241 }

void DofObject::set_old_dof_object (  )  [inherited]

Sets the old_dof_object to a copy of this

Definition at line 133 of file dof_object.C.

References DofObject::clear_old_dof_object(), DofObject::DofObject(), and DofObject::old_dof_object.

Referenced by DofMap::reinit().

00134 {
00135   this->clear_old_dof_object();
00136 
00137   libmesh_assert (this->old_dof_object == NULL);
00138   
00139   // Make a new DofObject, assign a copy of \p this.
00140   // Make sure the copy ctor for DofObject works!!
00141   this->old_dof_object = new DofObject(*this);
00142 }

void Elem::set_p_level ( const unsigned int  p  ) 

Sets the value of the p refinement level for the element Note that the maximum p refinement level is currently 255

Referenced by MeshRefinement::_coarsen_elements(), MeshRefinement::_refine_elements(), UnstructuredMesh::all_first_order(), coarsen(), Elem(), is_ancestor_of(), refine(), and DofMap::reinit().

void Elem::set_parent ( Elem p  ) 

Sets the pointer to the element's parent. Dangerous to use in high-level code.

Referenced by UnstructuredMesh::all_first_order(), is_ancestor_of(), and BoundaryInfo::sync().

virtual AutoPtr<DofObject> Elem::side ( const unsigned int  i  )  const [pure virtual]

Returns:
a proxy element coincident with side i. This method returns the _minimum_ element necessary to uniquely identify the side. So, for example, the side of a hexahedral is always returned as a 4-noded quadrilateral, regardless of what type of hex you are dealing with. If you want the full-ordered face (i.e. a 9-noded quad face for a 27-noded hexahedral) use the build_side method.

Implemented in Hex, InfHex, InfPrism, Prism, Pyramid, Tet, Edge, InfQuad, Quad, Tri, NodeElem, and RemoteElem.

Referenced by UnstructuredMesh::find_neighbors().

bool Elem::subactive (  )  const [inline]

Returns:
true if the element is subactive (i.e. has no active descendants), false otherwise. Always returns false if AMR is disabled.

Definition at line 1334 of file elem.h.

References active(), child(), has_children(), and subactive().

Referenced by active_family_tree(), active_family_tree_by_neighbor(), active_family_tree_by_side(), HPCoarsenTest::add_projection(), UnstructuredMesh::contract(), family_tree(), family_tree_by_neighbor(), family_tree_by_side(), family_tree_by_subneighbor(), UnstructuredMesh::find_neighbors(), MeshTools::get_not_subactive_node_ids(), is_ancestor_of(), libmesh_assert_valid_neighbors(), make_links_to_me_remote(), min_new_p_level_by_neighbor(), min_p_level_by_neighbor(), refine(), subactive(), and LegacyXdrIO::write_mesh().

01335 {
01336 #ifdef LIBMESH_ENABLE_AMR
01337   if (this->active())
01338     return false;
01339   if (!this->has_children())
01340     return true;
01341   return this->child(0)->subactive();
01342 #else
01343   return false;
01344 #endif
01345 }

subdomain_id_type & Elem::subdomain_id (  )  [inline]

Returns:
the subdomain that this element belongs to as a writeable reference.

Definition at line 1218 of file elem.h.

References _sbd_id.

01219 {
01220   return _sbd_id;
01221 }

const Elem* Elem::top_parent (  )  const

Returns:
a pointer to the element's top-most (i.e. level-0) parent. Returns this if this is a level-0 element, this element's parent if this is a level-1 element, this element's grandparent if this is a level-2 element, etc...

Referenced by BoundaryInfo::boundary_id(), is_ancestor_of(), BoundaryInfo::side_with_boundary_id(), and BoundaryInfo::sync().

virtual ElemType Elem::type (  )  const [pure virtual]

Returns:
the VTK element type of the sc-th sub-element.

the type of element that has been derived from this base class.

Implemented in Hex20, Hex27, Hex8, InfHex16, InfHex18, InfHex8, InfPrism12, InfPrism6, Prism15, Prism18, Prism6, Pyramid5, Tet10, Tet4, Edge2, Edge3, Edge4, InfEdge2, InfQuad4, InfQuad6, Quad4, Quad8, Quad9, Tri3, Tri6, NodeElem, and RemoteElem.

Referenced by PostscriptIO::_compute_edge_bezier_coeffs(), UnstructuredMesh::all_first_order(), UnstructuredMesh::all_second_order(), VTKIO::cells_to_vtk(), clough_compute_coefs(), FEBase::coarsened_dof_values(), InfFE< Dim, T_radial, T_map >::combine_base_radial(), InfFE< Dim, T_radial, T_map >::compute_data(), FEInterface::compute_data(), DofMap::constrain_p_dofs(), contains_point(), UnstructuredMesh::copy_nodes_and_elements(), UnstructuredMesh::create_submesh(), DofMap::dof_indices(), FE< Dim, T >::dofs_on_edge(), FE< Dim, T >::dofs_on_side(), FE< Dim, T >::edge_reinit(), UNVIO::element_out(), MeshTools::find_hanging_nodes_and_parents(), MeshTools::Modification::flatten(), hermite_compute_coefs(), FE< Dim, T >::init_base_shape_functions(), FE< Dim, T >::init_edge_shape_functions(), InfFE< Dim, T_radial, T_map >::init_face_shape_functions(), FE< Dim, T >::init_face_shape_functions(), InfFE< Dim, T_radial, T_map >::init_shape_functions(), FEXYZ< Dim >::init_shape_functions(), FE< Dim, T >::init_shape_functions(), InfFE< Dim, T_radial, T_map >::inverse_map(), FEInterface::inverse_map(), is_ancestor_of(), FE< Dim, T >::map(), FE< Dim, T >::map_eta(), FE< Dim, T >::map_xi(), FE< Dim, T >::map_zeta(), FEInterface::nodal_soln(), FE< Dim, T >::nodal_soln(), DofMap::old_dof_indices(), System::ProjectVector::operator()(), XdrIO::pack_element(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), refine(), InfFE< Dim, T_radial, T_map >::reinit(), FEXYZ< Dim >::reinit(), FE< Dim, T >::reinit(), DofMap::reinit(), REINIT_ERROR(), HPCoarsenTest::select_refinement(), InfFE< Dim, T_radial, T_map >::shape(), FEInterface::shape(), FE< Dim, T >::shape(), FE< Dim, T >::shape_deriv(), FE< Dim, T >::shape_second_deriv(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), GMVIO::write_ascii_new_impl(), ExodusII_IO_Helper::write_elements(), EnsightIO::write_geometry_ascii(), LegacyXdrIO::write_mesh(), GmshIO::write_mesh(), ExodusII_IO_Helper::write_sidesets(), and DivaIO::write_stream().

bool DofObject::valid_id (  )  const [inline, inherited]

Returns:
true if this DofObject has a valid id set, false otherwise.

Definition at line 466 of file dof_object.h.

References DofObject::_id, and DofObject::invalid_id.

Referenced by SerialMesh::add_elem(), ParallelMesh::add_elem(), SerialMesh::add_node(), ParallelMesh::add_node(), DofObject::id(), and libmesh_assert_valid_node_pointers().

00467 {
00468   return (DofObject::invalid_id != _id);
00469 }

bool DofObject::valid_processor_id (  )  const [inline, inherited]

Returns:
true if this DofObject has a valid id set, false otherwise.

Definition at line 509 of file dof_object.h.

References DofObject::_processor_id, and DofObject::invalid_processor_id.

00510 {
00511   return (DofObject::invalid_processor_id != _processor_id);
00512 }

Real Elem::volume (  )  const [virtual]

Returns:
the (length/area/volume) of the geometric element.

Reimplemented in Hex8, Prism6, Pyramid5, Tet4, Edge2, Edge3, Quad4, and Tri3.

Definition at line 1491 of file elem.C.

References FEBase::build(), default_order(), FEType::default_quadrature_order(), dim(), and libMeshEnums::LAGRANGE.

01492 {
01493   // The default implementation builds a finite element of the correct
01494   // order and sums up the JxW contributions.  This can be expensive,
01495   // so the various element types can overload this method and compute
01496   // the volume more efficiently.
01497   FEType fe_type (this->default_order() , LAGRANGE);
01498 
01499   AutoPtr<FEBase> fe (FEBase::build(this->dim(),
01500                                     fe_type));
01501 
01502    const std::vector<Real>& JxW = fe->get_JxW();
01503    
01504   // The default quadrature rule should integrate the mass matrix,
01505   // thus it should be plenty to compute the area
01506   QGauss qrule (this->dim(), fe_type.default_quadrature_order());
01507 
01508   fe->attach_quadrature_rule(&qrule);
01509 
01510   fe->reinit(this);
01511 
01512   Real vol=0.;
01513   for (unsigned int qp=0; qp<qrule.n_points(); ++qp)
01514     vol += JxW[qp];
01515   
01516   return vol;
01517   
01518 }

unsigned int Elem::which_child_am_i ( const Elem e  )  const

This function tells you which child you (e) are. I.e. if c = a->which_child_am_i(e); then a->child(c) will be e;

Referenced by UnstructuredMesh::copy_nodes_and_elements(), is_ancestor_of(), make_links_to_me_remote(), and Parallel::sync_element_data_by_parent_id().

unsigned int Elem::which_neighbor_am_i ( const Elem e  )  const [inline]

This function tells you which neighbor you (e) are. I.e. if s = a->which_neighbor_am_i(e); then a->neighbor(s) will be an ancestor of e;

Definition at line 1294 of file elem.h.

References libMesh::invalid_uint, level(), n_neighbors(), neighbor(), and parent().

Referenced by MetisPartitioner::_do_partition(), ParmetisPartitioner::build_graph(), FEBase::compute_proj_constraints(), MeshTools::find_hanging_nodes_and_parents(), libmesh_assert_valid_neighbors(), make_links_to_me_remote(), and nullify_neighbors().

01295 {
01296   libmesh_assert (e != NULL);
01297 
01298   const Elem* eparent = e;
01299 
01300   while (eparent->level() > this->level())
01301     {
01302       eparent = eparent->parent();
01303       libmesh_assert(eparent);
01304     }
01305   
01306   for (unsigned int s=0; s<this->n_neighbors(); s++)
01307     if (this->neighbor(s) == eparent)
01308       return s;
01309     
01310   return libMesh::invalid_uint;
01311 }

void Elem::write_connectivity ( std::ostream &  out,
const IOPackage  iop 
) const

Writes the element connectivity for various IO packages to the passed ostream "out". Not virtual, since it is implemented in the base class. This function supercedes the write_tecplot_connectivity(...) and write_ucd_connectivity(...) routines.

Definition at line 768 of file elem.C.

References _nodes, connectivity(), libMeshEnums::INVALID_IO_PACKAGE, n_nodes(), n_sub_elem(), node(), libMeshEnums::TECPLOT, and libMeshEnums::UCD.

00770 {
00771   libmesh_assert (out.good());
00772   libmesh_assert (_nodes != NULL);
00773   libmesh_assert (iop != INVALID_IO_PACKAGE);
00774 
00775   switch (iop)
00776     {
00777     case TECPLOT:
00778       {
00779         // This connectivity vector will be used repeatedly instead
00780         // of being reconstructed inside the loop.
00781         std::vector<unsigned int> conn;
00782         for (unsigned int sc=0; sc <this->n_sub_elem(); sc++)
00783           {
00784             this->connectivity(sc, TECPLOT, conn);
00785             
00786             std::copy(conn.begin(),
00787                       conn.end(),
00788                       std::ostream_iterator<unsigned int>(out, " "));
00789             
00790             out << '\n';
00791           }
00792         return;
00793       }
00794 
00795     case UCD:
00796       {
00797         for (unsigned int i=0; i<this->n_nodes(); i++)
00798           out << this->node(i)+1 << "\t";
00799         
00800         out << '\n';
00801         return;
00802       }
00803 
00804     default:
00805       libmesh_error();
00806     }
00807 
00808   libmesh_error();
00809 }


Friends And Related Function Documentation

friend class MeshRefinement [friend]

Make the classes that need to access our build member friends. These classes do not really fit the profile of what a "friend" should be, but if we are going to protect the constructor and the build method, there's no way around it.

Do we *really* need to protect the build member? It would seem that we are just getting around it by using friends!

Definition at line 1050 of file elem.h.


Member Data Documentation

const unsigned int Elem::_bp1 = 65449 [static, private]

Definition at line 1061 of file elem.h.

const unsigned int Elem::_bp2 = 48661 [static, private]

Definition at line 1062 of file elem.h.

Elem** Elem::_children [protected]

Pointers to this element's children.

Definition at line 1006 of file elem.h.

Referenced by add_child(), contract(), Elem(), has_ancestor_children(), has_children(), is_ancestor_of(), make_links_to_me_remote(), refine(), Tet4::reselect_diagonal(), and ~Elem().

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::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().

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().

Elem** Elem::_neighbors [protected]

Pointers to this element's neighbors.

Definition at line 994 of file elem.h.

Referenced by Elem(), neighbor(), set_neighbor(), and ~Elem().

unsigned char Elem::_p_level [protected]

p refinement level - the difference between the polynomial degree on this element and the minimum polynomial degree on the mesh. This is stored as an unsigned char to save space. In theory, these last four bytes might have been padding anyway.

Definition at line 1030 of file elem.h.

Referenced by is_ancestor_of().

Elem* Elem::_parent [protected]

A pointer to this element's parent.

Definition at line 999 of file elem.h.

Referenced by is_ancestor_of().

unsigned char Elem::_pflag [protected]

p refinement flag. This is stored as an unsigned char to save space.

Definition at line 1019 of file elem.h.

Referenced by is_ancestor_of().

unsigned char Elem::_rflag [protected]

h refinement flag. This is stored as an unsigned char to save space.

Definition at line 1012 of file elem.h.

Referenced by is_ancestor_of().

The subdomain to which this element belongs.

Definition at line 1037 of file elem.h.

Referenced by subdomain_id().

This object on the last mesh. Useful for projecting solutions from one mesh to another.

Definition at line 81 of file dof_object.h.

Referenced by DofObject::clear_old_dof_object(), DofMap::old_dof_indices(), DofMap::reinit(), and DofObject::set_old_dof_object().

const unsigned int Elem::type_to_n_nodes_map [static]

This array maps the integer representation of the ElemType enum to the number of nodes in the element.

Definition at line 289 of file elem.h.

Referenced by is_ancestor_of(), XdrIO::pack_element(), and XdrIO::read_serialized_connectivity().


The documentation for this class was generated from the following files:

Site Created By: libMesh Developers
Last modified: November 25 2009 03:44:10.

Hosted By:
SourceForge.net Logo