oomph::QuadMeshBase Class Reference

Base class for quad meshes (meshes made of 2D quad elements). More...

#include <quad_mesh.h>

+ Inheritance diagram for oomph::QuadMeshBase:

Public Member Functions

 QuadMeshBase ()
 Constructor (empty) More...
 
 QuadMeshBase (const QuadMeshBase &node)=delete
 Broken copy constructor. More...
 
void operator= (const QuadMeshBase &)=delete
 Broken assignment operator. More...
 
virtual ~QuadMeshBase ()
 Destructor (empty) More...
 
void setup_boundary_element_info ()
 
void setup_boundary_element_info (std::ostream &outfile)
 
- Public Member Functions inherited from oomph::Mesh
 Mesh ()
 Default constructor. More...
 
 Mesh (const Vector< Mesh * > &sub_mesh_pt)
 
void merge_meshes (const Vector< Mesh * > &sub_mesh_pt)
 
virtual void reset_boundary_element_info (Vector< unsigned > &ntmp_boundary_elements, Vector< Vector< unsigned >> &ntmp_boundary_elements_in_region, Vector< FiniteElement * > &deleted_elements)
 Virtual function to perform the reset boundary elements info rutines. More...
 
template<class BULK_ELEMENT >
void doc_boundary_coordinates (const unsigned &b, std::ofstream &the_file)
 
virtual void scale_mesh (const double &factor)
 
 Mesh (const Mesh &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Mesh &)=delete
 Broken assignment operator. More...
 
virtual ~Mesh ()
 Virtual Destructor to clean up all memory. More...
 
void flush_element_and_node_storage ()
 
void flush_element_storage ()
 
void flush_node_storage ()
 
Node *& node_pt (const unsigned long &n)
 Return pointer to global node n. More...
 
Nodenode_pt (const unsigned long &n) const
 Return pointer to global node n (const version) More...
 
GeneralisedElement *& element_pt (const unsigned long &e)
 Return pointer to element e. More...
 
GeneralisedElementelement_pt (const unsigned long &e) const
 Return pointer to element e (const version) More...
 
const Vector< GeneralisedElement * > & element_pt () const
 Return reference to the Vector of elements. More...
 
Vector< GeneralisedElement * > & element_pt ()
 Return reference to the Vector of elements. More...
 
FiniteElementfinite_element_pt (const unsigned &e) const
 
Node *& boundary_node_pt (const unsigned &b, const unsigned &n)
 Return pointer to node n on boundary b. More...
 
Nodeboundary_node_pt (const unsigned &b, const unsigned &n) const
 Return pointer to node n on boundary b. More...
 
void set_nboundary (const unsigned &nbound)
 Set the number of boundaries in the mesh. More...
 
void remove_boundary_nodes ()
 Clear all pointers to boundary nodes. More...
 
void remove_boundary_nodes (const unsigned &b)
 
void remove_boundary_node (const unsigned &b, Node *const &node_pt)
 Remove a node from the boundary b. More...
 
void add_boundary_node (const unsigned &b, Node *const &node_pt)
 Add a (pointer to) a node to the b-th boundary. More...
 
void copy_boundary_node_data_from_nodes ()
 
bool boundary_coordinate_exists (const unsigned &i) const
 Indicate whether the i-th boundary has an intrinsic coordinate. More...
 
unsigned long nelement () const
 Return number of elements in the mesh. More...
 
unsigned long nnode () const
 Return number of nodes in the mesh. More...
 
unsigned ndof_types () const
 Return number of dof types in mesh. More...
 
unsigned elemental_dimension () const
 Return number of elemental dimension in mesh. More...
 
unsigned nodal_dimension () const
 Return number of nodal dimension in mesh. More...
 
void add_node_pt (Node *const &node_pt)
 Add a (pointer to a) node to the mesh. More...
 
void add_element_pt (GeneralisedElement *const &element_pt)
 Add a (pointer to) an element to the mesh. More...
 
virtual void node_update (const bool &update_all_solid_nodes=false)
 
virtual void reorder_nodes (const bool &use_old_ordering=true)
 
virtual void get_node_reordering (Vector< Node * > &reordering, const bool &use_old_ordering=true) const
 
template<class BULK_ELEMENT , template< class > class FACE_ELEMENT>
void build_face_mesh (const unsigned &b, Mesh *const &face_mesh_pt)
 
unsigned self_test ()
 Self-test: Check elements and nodes. Return 0 for OK. More...
 
void max_and_min_element_size (double &max_size, double &min_size)
 
double total_size ()
 
void check_inverted_elements (bool &mesh_has_inverted_elements, std::ofstream &inverted_element_file)
 
void check_inverted_elements (bool &mesh_has_inverted_elements)
 
unsigned check_for_repeated_nodes (const double &epsilon=1.0e-12)
 
Vector< Node * > prune_dead_nodes ()
 
unsigned nboundary () const
 Return number of boundaries. More...
 
unsigned long nboundary_node (const unsigned &ibound) const
 Return number of nodes on a particular boundary. More...
 
FiniteElementboundary_element_pt (const unsigned &b, const unsigned &e) const
 Return pointer to e-th finite element on boundary b. More...
 
Nodeget_some_non_boundary_node () const
 
unsigned nboundary_element (const unsigned &b) const
 Return number of finite elements that are adjacent to boundary b. More...
 
int face_index_at_boundary (const unsigned &b, const unsigned &e) const
 
virtual void dump (std::ofstream &dump_file, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
void dump (const std::string &dump_file_name, const bool &use_old_ordering=true) const
 Dump the data in the mesh into a file for restart. More...
 
virtual void read (std::ifstream &restart_file)
 Read solution from restart file. More...
 
void output_paraview (std::ofstream &file_out, const unsigned &nplot) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt) const
 
void output_fct_paraview (std::ofstream &file_out, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt) const
 
void output (std::ostream &outfile)
 Output for all elements. More...
 
void output (std::ostream &outfile, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output (FILE *file_pt)
 Output for all elements (C-style output) More...
 
void output (FILE *file_pt, const unsigned &nplot)
 Output at f(n_plot) points in each element (C-style output) More...
 
void output (const std::string &output_filename)
 Output for all elements. More...
 
void output (const std::string &output_filename, const unsigned &n_plot)
 Output at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt)
 Output a given Vector function at f(n_plot) points in each element. More...
 
void output_fct (std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt)
 
void output_boundaries (std::ostream &outfile)
 Output the nodes on the boundaries (into separate tecplot zones) More...
 
void output_boundaries (const std::string &output_filename)
 
void assign_initial_values_impulsive ()
 Assign initial values for an impulsive start. More...
 
void shift_time_values ()
 
void calculate_predictions ()
 
void set_nodal_and_elemental_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
virtual void set_mesh_level_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void set_consistent_pinned_values_for_continuation (ContinuationStorageScheme *const &continuation_stepper_pt)
 Set consistent values for pinned data in continuation. More...
 
bool does_pointer_correspond_to_mesh_data (double *const &parameter_pt)
 Does the double pointer correspond to any mesh data. More...
 
void set_nodal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 Set the timestepper associated with the nodal data in the mesh. More...
 
void set_elemental_internal_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
virtual void compute_norm (double &norm)
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
 
virtual void compute_error (FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
 Returns the norm of the error and that of the exact solution. More...
 
virtual void compute_error (FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, Vector< double > &error, Vector< double > &norm)
 
bool is_mesh_distributed () const
 Boolean to indicate if Mesh has been distributed. More...
 
OomphCommunicatorcommunicator_pt () const
 
void delete_all_external_storage ()
 Wipe the storage for all externally-based elements. More...
 

Additional Inherited Members

- Public Types inherited from oomph::Mesh
typedef void(FiniteElement::* SteadyExactSolutionFctPt) (const Vector< double > &x, Vector< double > &soln)
 
typedef void(FiniteElement::* UnsteadyExactSolutionFctPt) (const double &time, const Vector< double > &x, Vector< double > &soln)
 
- Static Public Attributes inherited from oomph::Mesh
static Steady< 0 > Default_TimeStepper
 The Steady Timestepper. More...
 
static bool Suppress_warning_about_empty_mesh_level_time_stepper_function
 Static boolean flag to control warning about mesh level timesteppers. More...
 
- Protected Member Functions inherited from oomph::Mesh
unsigned long assign_global_eqn_numbers (Vector< double * > &Dof_pt)
 Assign (global) equation numbers to the nodes. More...
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 Assign local equation numbers in all elements. More...
 
void convert_to_boundary_node (Node *&node_pt, const Vector< FiniteElement * > &finite_element_pt)
 
void convert_to_boundary_node (Node *&node_pt)
 
- Protected Attributes inherited from oomph::Mesh
Vector< Vector< Node * > > Boundary_node_pt
 
bool Lookup_for_elements_next_boundary_is_setup
 
Vector< Vector< FiniteElement * > > Boundary_element_pt
 
Vector< Vector< int > > Face_index_at_boundary
 
Vector< Node * > Node_pt
 Vector of pointers to nodes. More...
 
Vector< GeneralisedElement * > Element_pt
 Vector of pointers to generalised elements. More...
 
std::vector< boolBoundary_coordinate_exists
 

Detailed Description

Base class for quad meshes (meshes made of 2D quad elements).

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ QuadMeshBase() [1/2]

oomph::QuadMeshBase::QuadMeshBase ( )
inline

Constructor (empty)

60 {}

◆ QuadMeshBase() [2/2]

oomph::QuadMeshBase::QuadMeshBase ( const QuadMeshBase node)
delete

Broken copy constructor.

◆ ~QuadMeshBase()

virtual oomph::QuadMeshBase::~QuadMeshBase ( )
inlinevirtual

Destructor (empty)

69 {}

Member Function Documentation

◆ operator=()

void oomph::QuadMeshBase::operator= ( const QuadMeshBase )
delete

Broken assignment operator.

◆ setup_boundary_element_info() [1/2]

void oomph::QuadMeshBase::setup_boundary_element_info ( )
inlinevirtual

Setup lookup schemes which establish whic elements are located next to mesh's boundaries (wrapper to suppress doc).

Reimplemented from oomph::Mesh.

74  {
75  std::ofstream outfile;
77  }
void setup_boundary_element_info()
Definition: quad_mesh.h:73

Referenced by oomph::ChannelWithLeafletMesh< ELEMENT >::ChannelWithLeafletMesh(), oomph::CollapsibleChannelMesh< ELEMENT >::CollapsibleChannelMesh(), oomph::FSIDrivenCavityMesh< ELEMENT >::FSIDrivenCavityMesh(), oomph::FullCircleMesh< ELEMENT >::FullCircleMesh(), and oomph::QuarterCircleSectorMesh< ELEMENT >::QuarterCircleSectorMesh().

◆ setup_boundary_element_info() [2/2]

void oomph::QuadMeshBase::setup_boundary_element_info ( std::ostream &  outfile)
virtual

Setup lookup schemes which establish whic elements are located next to mesh's boundaries. Doc in outfile (if it's open).

Setup lookup schemes which establish which elements are located next to which boundaries (Doc to outfile if it's open).

Reimplemented from oomph::Mesh.

38  {
39  bool doc = false;
40  if (outfile) doc = true;
41 
42  // Number of boundaries
43  unsigned nbound = nboundary();
44 
45  // Wipe/allocate storage for arrays
46  Boundary_element_pt.clear();
47  Face_index_at_boundary.clear();
48  Boundary_element_pt.resize(nbound);
49  Face_index_at_boundary.resize(nbound);
50 
51  // Temporary vector of vectors to pointers to elements on the boundaries:
52  // This is not a set to ensure UNIQUE ordering
53  Vector<Vector<FiniteElement*>> vector_of_boundary_element_pt;
54  vector_of_boundary_element_pt.resize(nbound);
55 
56  // Matrix map for working out the fixed local coord for elements on boundary
57  MapMatrixMixed<unsigned, FiniteElement*, Vector<int>*> boundary_identifier;
58 
59 
60  // Loop over elements
61  //-------------------
62  unsigned nel = nelement();
63  for (unsigned e = 0; e < nel; e++)
64  {
65  // Get pointer to element
66  FiniteElement* fe_pt = finite_element_pt(e);
67 
68  if (doc) outfile << "Element: " << e << " " << fe_pt << std::endl;
69 
70  // Only include 2D elements! Some meshes contain interface elements too.
71  if (fe_pt->dim() == 2)
72  {
73  // Loop over the element's nodes and find out which boundaries they're
74  // on
75  // ----------------------------------------------------------------------
76  unsigned nnode_1d = fe_pt->nnode_1d();
77 
78  // Loop over nodes in order
79  for (unsigned i0 = 0; i0 < nnode_1d; i0++)
80  {
81  for (unsigned i1 = 0; i1 < nnode_1d; i1++)
82  {
83  // Local node number
84  unsigned j = i0 + i1 * nnode_1d;
85 
86  // Get pointer to vector of boundaries that this
87  // node lives on
88  std::set<unsigned>* boundaries_pt = 0;
89  fe_pt->node_pt(j)->get_boundaries_pt(boundaries_pt);
90 
91  // If the node lives on some boundaries....
92  if (boundaries_pt != 0)
93  {
94  // Loop over boundaries
95  // unsigned nbound=(*boundaries_pt).size();
96  for (std::set<unsigned>::iterator it = boundaries_pt->begin();
97  it != boundaries_pt->end();
98  ++it)
99  {
100  // Add pointer to finite element to vector for the appropriate
101  // boundary
102 
103  // Does the pointer already exits in the vector
104  Vector<FiniteElement*>::iterator b_el_it =
105  std::find(vector_of_boundary_element_pt[*it].begin(),
106  vector_of_boundary_element_pt[*it].end(),
107  fe_pt);
108  // Only insert if we have not found it (i.e. got to the end)
109  if (b_el_it == vector_of_boundary_element_pt[*it].end())
110  {
111  vector_of_boundary_element_pt[*it].push_back(fe_pt);
112  }
113 
114  // For the current element/boundary combination, create
115  // a vector that stores an indicator which element boundaries
116  // the node is located (boundary_identifier=-/+1 for nodes
117  // on the left/right boundary; boundary_identifier=-/+2 for
118  // nodes on the lower/upper boundary. We determine these indices
119  // for all corner nodes of the element and add them to a vector
120  // to a vector. This allows us to decide which face of the
121  // element coincides with the boundary since the (quad!) element
122  // must have exactly two corner nodes on the boundary.
123  if (boundary_identifier(*it, fe_pt) == 0)
124  {
125  boundary_identifier(*it, fe_pt) = new Vector<int>;
126  }
127 
128  // Are we at a corner node?
129  if (((i0 == 0) || (i0 == nnode_1d - 1)) &&
130  ((i1 == 0) || (i1 == nnode_1d - 1)))
131  {
132  // Create index to represent position relative to s_0
133  (*boundary_identifier(*it, fe_pt))
134  .push_back(1 * (2 * i0 / (nnode_1d - 1) - 1));
135 
136  // Create index to represent position relative to s_1
137  (*boundary_identifier(*it, fe_pt))
138  .push_back(2 * (2 * i1 / (nnode_1d - 1) - 1));
139  }
140  }
141  }
142  // else
143  // {
144  // oomph_info << "...does not live on any boundaries " <<
145  // std::endl;
146  // }
147  }
148  }
149  }
150  // else
151  //{
152  // oomph_info << "Element " << e << " does not qualify" << std::endl;
153  //}
154  }
155 
156  // Now copy everything across into permanent arrays
157  //-------------------------------------------------
158 
159  // Note: vector_of_boundary_element_pt contains all elements
160  // that have (at least) one corner node on a boundary -- can't copy
161  // them across into Boundary_element_pt
162  // yet because some of them might have only one node on the
163  // the boundary in which case they don't qualify as
164  // boundary elements!
165 
166  // Loop over boundaries
167  //---------------------
168  for (unsigned i = 0; i < nbound; i++)
169  {
170  // Number of elements on this boundary
171  // nel is unused, so I've commented it out - RWhite.
172  // unsigned nel=vector_of_boundary_element_pt[i].size();
173 
174  // Allocate storage for the face identifiers
175  // Face_index_at_boundary[i].resize(nel);
176 
177  // Loop over elements that have at least one corner node on this boundary
178  //-----------------------------------------------------------------------
179  // unsigned e_count=0;
180  typedef Vector<FiniteElement*>::iterator IT;
181  for (IT it = vector_of_boundary_element_pt[i].begin();
182  it != vector_of_boundary_element_pt[i].end();
183  it++)
184  {
185  // Recover pointer to element
186  FiniteElement* fe_pt = *it;
187 
188  // Initialise count for boundary identiers (-2,-1,1,2)
189  std::map<int, unsigned> count;
190 
191  // Loop over coordinates
192  for (unsigned ii = 0; ii < 2; ii++)
193  {
194  // Loop over upper/lower end of coordinates
195  for (int sign = -1; sign < 3; sign += 2)
196  {
197  count[(ii + 1) * sign] = 0;
198  }
199  }
200 
201  // Loop over boundary indicators for this element/boundary
202  unsigned n_indicators = (*boundary_identifier(i, fe_pt)).size();
203  for (unsigned j = 0; j < n_indicators; j++)
204  {
205  count[(*boundary_identifier(i, fe_pt))[j]]++;
206  }
207  delete boundary_identifier(i, fe_pt);
208 
209  // Determine the correct boundary indicator by checking that it
210  // occurs twice (since two corner nodes of the element's boundary
211  // need to be located on the domain boundary
212  int indicator = -10;
213 
214  // Check that we're finding exactly one boundary indicator
215  // bool found=false;
216 
217  // Loop over coordinates
218  for (unsigned ii = 0; ii < 2; ii++)
219  {
220  // Loop over upper/lower end of coordinates
221  for (int sign = -1; sign < 3; sign += 2)
222  {
223  // If an index occurs twice then that face is on the boundary
224  // But we can have multiple faces on the same boundary id, so just
225  // add all the ones that we have
226  if (count[(ii + 1) * sign] == 2)
227  {
228  // Check that we haven't found multiple boundaries
229  /*if (found)
230  {
231  std::string error_message=
232  "Trouble: Multiple boundary identifiers!\n";
233  error_message +=
234  "Elements should only have at most 2 corner ";
235  error_message +=
236  "nodes on any one boundary.\n";
237 
238  throw OomphLibError(
239  error_message,
240  OOMPH_CURRENT_FUNCTION,
241  OOMPH_EXCEPTION_LOCATION);
242  }
243  found=true;*/
244  indicator = (ii + 1) * sign;
245 
246  // Copy into the data structure
247  Boundary_element_pt[i].push_back(*it);
248  Face_index_at_boundary[i].push_back(indicator);
249  }
250  }
251  }
252 
253  // Element has exactly two corner nodes on boundary
254  /*if (found)
255  {
256  // Add to permanent storage
257  Boundary_element_pt[i].push_back(fe_pt);
258 
259  // Now convert boundary indicator into information required
260  // for FaceElements
261  switch (indicator)
262  {
263  //South face
264  case -2:
265 
266  // s_1 is fixed at -1.0:
267  Face_index_at_boundary[i][e_count] = -2;
268  break;
269 
270  //West face
271  case -1:
272 
273  // s_0 is fixed at -1.0:
274  Face_index_at_boundary[i][e_count] = -1;
275  break;
276 
277  //East face
278  case 1:
279 
280  // s_0 is fixed at 1.0:
281  Face_index_at_boundary[i][e_count] = 1;
282  break;
283 
284  //North face
285  case 2:
286 
287  // s_1 is fixed at 1.0:
288  Face_index_at_boundary[i][e_count] = 2;
289  break;
290 
291  default:
292 
293  throw OomphLibError("Never get here",
294  OOMPH_CURRENT_FUNCTION,
295  OOMPH_EXCEPTION_LOCATION);
296  }
297 
298  // Increment counter
299  e_count++;
300  }*/
301  }
302  }
303 
304 
305  // Doc?
306  //-----
307  if (doc)
308  {
309  // Loop over boundaries
310  for (unsigned i = 0; i < nbound; i++)
311  {
312  unsigned nel = Boundary_element_pt[i].size();
313  outfile << "Boundary: " << i << " is adjacent to " << nel << " elements"
314  << std::endl;
315 
316  // Loop over elements on given boundary
317  for (unsigned e = 0; e < nel; e++)
318  {
319  FiniteElement* fe_pt = Boundary_element_pt[i][e];
320  outfile << "Boundary element:" << fe_pt
321  << " Face index on boundary is "
322  << Face_index_at_boundary[i][e] << std::endl;
323  }
324  }
325  }
326 
327 
328  // Lookup scheme has now been setup
330  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Vector< Vector< FiniteElement * > > Boundary_element_pt
Definition: mesh.h:91
bool Lookup_for_elements_next_boundary_is_setup
Definition: mesh.h:87
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
Vector< Vector< int > > Face_index_at_boundary
Definition: mesh.h:95
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
T sign(T x)
Definition: cxx11_tensor_builtins_sycl.cpp:172
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References oomph::Mesh::Boundary_element_pt, oomph::FiniteElement::dim(), e(), Eigen::placeholders::end, oomph::Mesh::Face_index_at_boundary, oomph::Mesh::finite_element_pt(), oomph::Node::get_boundaries_pt(), i, j, oomph::Mesh::Lookup_for_elements_next_boundary_is_setup, oomph::Mesh::nboundary(), oomph::Mesh::nelement(), oomph::FiniteElement::nnode_1d(), oomph::FiniteElement::node_pt(), SYCL::sign(), and size.


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