libMesh
Public Types | Public Member Functions | Public Attributes | List of all members
libMesh::SyncRefinementFlags Struct Reference

#include <sync_refinement_flags.h>

Public Types

typedef unsigned char datum
 
typedef Elem::RefinementState(Elem::* get_a_flag) () const
 
typedef void(Elem::* set_a_flag) (const Elem::RefinementState)
 

Public Member Functions

 SyncRefinementFlags (MeshBase &_mesh, get_a_flag _getter, set_a_flag _setter)
 
void gather_data (const std::vector< dof_id_type > &ids, std::vector< datum > &flags) const
 
void act_on_data (const std::vector< dof_id_type > &ids, std::vector< datum > &flags)
 

Public Attributes

MeshBasemesh
 
bool parallel_consistent
 
get_a_flag get_flag
 
set_a_flag set_flag
 

Detailed Description

Definition at line 38 of file sync_refinement_flags.h.

Member Typedef Documentation

typedef unsigned char libMesh::SyncRefinementFlags::datum

Definition at line 40 of file sync_refinement_flags.h.

typedef Elem::RefinementState(Elem::* libMesh::SyncRefinementFlags::get_a_flag) () const

Definition at line 41 of file sync_refinement_flags.h.

typedef void(Elem::* libMesh::SyncRefinementFlags::set_a_flag) (const Elem::RefinementState)

Definition at line 42 of file sync_refinement_flags.h.

Constructor & Destructor Documentation

libMesh::SyncRefinementFlags::SyncRefinementFlags ( MeshBase _mesh,
get_a_flag  _getter,
set_a_flag  _setter 
)

Member Function Documentation

void libMesh::SyncRefinementFlags::act_on_data ( const std::vector< dof_id_type > &  ids,
std::vector< datum > &  flags 
)

Definition at line 75 of file sync_refinement_flags.h.

References libMesh::MeshBase::elem_ref(), get_flag, and set_flag.

77  {
78  for (std::size_t i=0; i != ids.size(); ++i)
79  {
80  Elem & elem = mesh.elem_ref(ids[i]);
81 
82  datum old_flag = (elem.*get_flag)();
83  datum & new_flag = flags[i];
84 
85  if (old_flag != new_flag)
86  {
87  // It's possible for foreign flags to be (temporarily) more
88  // conservative than our own, such as when a refinement in
89  // one of the foreign processor's elements is mandated by a
90  // refinement in one of our neighboring elements it can see
91  // which was mandated by a refinement in one of our
92  // neighboring elements it can't see
93  // libmesh_assert (!(new_flag != Elem::REFINE &&
94  // old_flag == Elem::REFINE));
95  //
96  (elem.*set_flag)
97  (static_cast<Elem::RefinementState>(new_flag));
98  parallel_consistent = false;
99  }
100  }
101  }
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:490
void libMesh::SyncRefinementFlags::gather_data ( const std::vector< dof_id_type > &  ids,
std::vector< datum > &  flags 
) const

Definition at line 59 of file sync_refinement_flags.h.

References libMesh::MeshBase::elem_ref(), and get_flag.

61  {
62  flags.resize(ids.size());
63 
64  for (std::size_t i=0; i != ids.size(); ++i)
65  {
66  // Look for this element in the mesh
67  // We'd better find every element we're asked for
68  Elem & elem = mesh.elem_ref(ids[i]);
69 
70  // Return the element's refinement flag
71  flags[i] = (elem.*get_flag)();
72  }
73  }
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:490

Member Data Documentation

get_a_flag libMesh::SyncRefinementFlags::get_flag

Definition at line 52 of file sync_refinement_flags.h.

Referenced by act_on_data(), and gather_data().

MeshBase& libMesh::SyncRefinementFlags::mesh

Definition at line 50 of file sync_refinement_flags.h.

bool libMesh::SyncRefinementFlags::parallel_consistent
set_a_flag libMesh::SyncRefinementFlags::set_flag

Definition at line 53 of file sync_refinement_flags.h.

Referenced by act_on_data().


The documentation for this struct was generated from the following file: