oomph::SimpleCubicTetMesh< ELEMENT > Class Template Reference

MySimple 3D tet mesh for TElements. More...

#include <simple_cubic_tet_mesh.template.h>

+ Inheritance diagram for oomph::SimpleCubicTetMesh< ELEMENT >:

Public Member Functions

 SimpleCubicTetMesh (const unsigned &n_x, const unsigned &n_y, const unsigned &n_z, const double &l_x, const double &l_y, const double &l_z, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
- Public Member Functions inherited from oomph::TetMeshBase
 TetMeshBase ()
 Constructor. More...
 
 TetMeshBase (const TetMeshBase &node)=delete
 Broken copy constructor. More...
 
void operator= (const TetMeshBase &)=delete
 Broken assignment operator. More...
 
virtual ~TetMeshBase ()
 Destructor (empty) More...
 
void assess_mesh_quality (std::ofstream &some_file)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, const bool &switch_normal)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, const bool &switch_normal, std::ofstream &outfile)
 
template<class ELEMENT >
void setup_boundary_coordinates (const unsigned &b, std::ofstream &outfile)
 
unsigned nboundary_element_in_region (const unsigned &b, const unsigned &r) const
 Return the number of elements adjacent to boundary b in region r. More...
 
FiniteElementboundary_element_in_region_pt (const unsigned &b, const unsigned &r, const unsigned &e) const
 Return pointer to the e-th element adjacent to boundary b in region r. More...
 
int face_index_at_boundary_in_region (const unsigned &b, const unsigned &r, const unsigned &e) const
 Return face index of the e-th element adjacent to boundary b in region r. More...
 
unsigned nregion ()
 Return the number of regions specified by attributes. More...
 
unsigned nregion_element (const unsigned &r)
 Return the number of elements in region r. More...
 
double region_attribute (const unsigned &i)
 
FiniteElementregion_element_pt (const unsigned &r, const unsigned &e)
 Return the e-th element in the r-th region. More...
 
template<class ELEMENT >
void snap_to_quadratic_surface (const Vector< unsigned > &boundary_id, const std::string &quadratic_surface_file_name, const bool &switch_normal, DocInfo &doc_info)
 
template<class ELEMENT >
void snap_to_quadratic_surface (const Vector< unsigned > &boundary_id, const std::string &quadratic_surface_file_name, const bool &switch_normal)
 
void snap_nodes_onto_geometric_objects ()
 
template<class ELEMENT >
void split_elements_in_corners (TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 
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...
 

Private Member Functions

void build_from_scaffold (TimeStepper *time_stepper_pt)
 Build mesh from scaffold mesh. More...
 

Private Attributes

MeshTmp_mesh_pt
 Temporary scaffold mesh. 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::TetMeshBase
static double Tolerance_for_boundary_finding = 1.0e-5
 
- 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::TetMeshBase
Vector< Vector< FiniteElement * > > Region_element_pt
 
Vector< doubleRegion_attribute
 
Vector< std::map< unsigned, Vector< FiniteElement * > > > Boundary_region_element_pt
 Storage for elements adjacent to a boundary in a particular region. More...
 
Vector< std::map< unsigned, Vector< int > > > Face_index_region_at_boundary
 
TetMeshFacetedClosedSurfaceOuter_boundary_pt
 Faceted surface that defines outer boundaries. More...
 
Vector< TetMeshFacetedSurface * > Internal_surface_pt
 Vector to faceted surfaces that define internal boundaries. More...
 
std::map< unsigned, TetMeshFacetedSurface * > Tet_mesh_faceted_surface_pt
 
std::map< unsigned, TetMeshFacet * > Tet_mesh_facet_pt
 
std::map< unsigned, Vector< Vector< double > > > Triangular_facet_vertex_boundary_coordinate
 
TimeStepperTime_stepper_pt
 Timestepper used to build nodes. More...
 
- 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

template<class ELEMENT>
class oomph::SimpleCubicTetMesh< ELEMENT >

MySimple 3D tet mesh for TElements.

Constructor & Destructor Documentation

◆ SimpleCubicTetMesh()

template<class ELEMENT >
oomph::SimpleCubicTetMesh< ELEMENT >::SimpleCubicTetMesh ( const unsigned n_x,
const unsigned n_y,
const unsigned n_z,
const double l_x,
const double l_y,
const double l_z,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Constructor: Pass number of element blocks in the x, y and z directions and the corresponding dimensions. Timestepper defaults to Steady.

53  {
54  // Mesh can only be built with 3D Telements.
55  MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
56 
57 
58  std::ostringstream warn_message;
59  warn_message
60  << "Note: The SimpleCubicTetMesh() is quite inefficient.\n"
61  << " If your code takes a long time in the constructor\n"
62  << " consider using another tet mesh\n";
63  OomphLibWarning(warn_message.str(),
64  "SimpleCubicTetMesh::SimpleCubicTetMesh()",
66  oomph_info << "Starting mesh construction..." << std::endl;
67  double start_t = TimingHelpers::timer();
68 
69  // Build scaffold mesh
70  Tmp_mesh_pt =
71  new SimpleCubicScaffoldTetMesh(n_x, n_y, n_z, l_x, l_y, l_z);
72 
73  // Build actual mesh from scaffold mesh
74  build_from_scaffold(time_stepper_pt);
75 
76  delete Tmp_mesh_pt;
77 
78  double end_t = TimingHelpers::timer();
79  oomph_info << "...finished mesh construction. Total time [sec] "
80  << end_t - start_t << std::endl;
81  }
Mesh * Tmp_mesh_pt
Temporary scaffold mesh.
Definition: simple_cubic_tet_mesh.template.h:89
void build_from_scaffold(TimeStepper *time_stepper_pt)
Build mesh from scaffold mesh.
Definition: simple_cubic_tet_mesh.template.cc:44
double timer()
returns the time in seconds after some point in past
Definition: oomph_utilities.cc:1295
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61

References oomph::SimpleCubicTetMesh< ELEMENT >::build_from_scaffold(), OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::TimingHelpers::timer(), and oomph::SimpleCubicTetMesh< ELEMENT >::Tmp_mesh_pt.

Member Function Documentation

◆ build_from_scaffold()

template<class ELEMENT >
void oomph::SimpleCubicTetMesh< ELEMENT >::build_from_scaffold ( TimeStepper time_stepper_pt)
private

Build mesh from scaffold mesh.

Simple tetrahedral mesh - with 24 tet elements constructed within a "brick" form for each element block.

46  {
47  // Mesh can only be built with 3D Telements.
48  MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
49 
50  // Create space for elements
51  unsigned nelem = Tmp_mesh_pt->nelement();
52  Element_pt.resize(nelem);
53 
54  // Create space for nodes
55  unsigned nnode_scaffold = Tmp_mesh_pt->nnode();
56  Node_pt.resize(nnode_scaffold);
57 
58  // Set number of boundaries
59  unsigned nbound = Tmp_mesh_pt->nboundary();
60  set_nboundary(nbound);
61 
62  // Loop over elements in scaffold mesh, visit their nodes
63  for (unsigned e = 0; e < nelem; e++)
64  {
65  Element_pt[e] = new ELEMENT;
66  }
67 
68  // In the first instance build all nodes from within all the elements
69  unsigned nnod_el = Tmp_mesh_pt->finite_element_pt(0)->nnode();
70  // Loop over elements in scaffold mesh, visit their nodes
71  for (unsigned e = 0; e < nelem; e++)
72  {
73  // Loop over all nodes in element
74  for (unsigned j = 0; j < nnod_el; j++)
75  {
76  // Create new node, using the NEW element's construct_node
77  // member function
78  finite_element_pt(e)->construct_node(j, time_stepper_pt);
79  }
80  }
81 
82 
83  // Setup map to check the (pseudo-)global node number
84  // Nodes whose number is zero haven't been copied across
85  // into the mesh yet.
86  std::map<Node*, unsigned> global_number;
87  unsigned global_count = 0;
88  // Loop over elements in scaffold mesh, visit their nodes
89  for (unsigned e = 0; e < nelem; e++)
90  {
91  // Loop over all nodes in element
92  for (unsigned j = 0; j < nnod_el; j++)
93  {
94  // Pointer to node in the scaffold mesh
95  Node* scaffold_node_pt = Tmp_mesh_pt->finite_element_pt(e)->node_pt(j);
96 
97  // Get the (pseudo-)global node number in scaffold mesh
98  // (It's zero [=default] if not visited this one yet)
99  unsigned j_global = global_number[scaffold_node_pt];
100 
101  // Haven't done this one yet
102  if (j_global == 0)
103  {
104  // Give it a number (not necessarily the global node
105  // number in the scaffold mesh -- we just need something
106  // to keep track...)
107  global_count++;
108  global_number[scaffold_node_pt] = global_count;
109 
110  // Copy new node, created using the NEW element's construct_node
111  // function into global storage, using the same global
112  // node number that we've just associated with the
113  // corresponding node in the scaffold mesh
114  Node_pt[global_count - 1] = finite_element_pt(e)->node_pt(j);
115 
116  // Assign coordinates
117  Node_pt[global_count - 1]->x(0) = scaffold_node_pt->x(0);
118  Node_pt[global_count - 1]->x(1) = scaffold_node_pt->x(1);
119  Node_pt[global_count - 1]->x(2) = scaffold_node_pt->x(2);
120 
121  // Get pointer to set of mesh boundaries that this
122  // scaffold node occupies; NULL if the node is not on any boundary
123  std::set<unsigned>* boundaries_pt;
124  scaffold_node_pt->get_boundaries_pt(boundaries_pt);
125 
126  // Loop over the mesh boundaries that the node in the scaffold mesh
127  // occupies and assign new node to the same ones.
128  if (boundaries_pt != 0)
129  {
130  this->convert_to_boundary_node(Node_pt[global_count - 1]);
131  for (std::set<unsigned>::iterator it = boundaries_pt->begin();
132  it != boundaries_pt->end();
133  ++it)
134  {
135  add_boundary_node(*it, Node_pt[global_count - 1]);
136  }
137  }
138  }
139  // This one has already been done: Kill it
140  else
141  {
142  // Kill it
143  delete finite_element_pt(e)->node_pt(j);
144 
145  // Overwrite the element's pointer to local node by
146  // pointer to the already existing node -- identified by
147  // the number kept in the map
148  finite_element_pt(e)->node_pt(j) = Node_pt[j_global - 1];
149  }
150  }
151  }
152 
153 
154  // At this point we've created all the elements and
155  // created their vertex nodes. Now we need to create
156  // the additional (midside and internal) nodes!
157 
158 
159  // We'll first create all local nodes for all elements
160  // and then delete the superfluous ones that have
161  // a matching node in an adjacent element.
162 
163  // Get number of nodes along element edge and dimension of element (3)
164  // from first element
165  unsigned nnode_1d = finite_element_pt(0)->nnode_1d();
166 
167  // At the moment we're only able to deal with nnode_1d=2 or 3.
168  if ((nnode_1d != 2) && (nnode_1d != 3))
169  {
170  std::ostringstream error_message;
171  error_message << "Mesh generation currently only works\n";
172  error_message << "for nnode_1d = 2 or 3. You're trying to use it\n";
173  error_message << "for nnode_1d=" << nnode_1d << std::endl;
174 
175  throw OomphLibError(
176  error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
177  }
178 
179  // Spatial dimension of element = number of local coordinates
180  unsigned dim = finite_element_pt(0)->dim();
181 
182  // Storage for the local coordinate of the new node
183  Vector<double> s(dim);
184 
185  // Get number of nodes in the element from first element
186  unsigned nnode = finite_element_pt(0)->nnode();
187 
188  // Loop over all elements
189  for (unsigned e = 0; e < nelem; e++)
190  {
191  // Loop over the new nodes in the element and create them.
192  for (unsigned j = 4; j < nnode; j++)
193  {
194  // Create new node
195  Node* new_node_pt =
196  finite_element_pt(e)->construct_node(j, time_stepper_pt);
197 
198  // What are the node's local coordinates?
200 
201  // Find the coordinates of the new node from the existing
202  // and fully-functional element in the scaffold mesh
203  for (unsigned i = 0; i < dim; i++)
204  {
205  new_node_pt->x(i) =
207  }
208  } // end of loop over new nodes
209  } // end of loop over elements
210 
211 
212  // Bracket this away so the edge map goes out of scope
213  // when we're done
214  {
215  // Storage for pointer to mid-edge node
216  MapMatrix<Node*, Node*> central_edge_node_pt;
217  Node* edge_node1_pt = 0;
218  Node* edge_node2_pt = 0;
219 
220  // Loop over elements
221  for (unsigned e = 0; e < nelem; e++)
222  {
223  // Loop over new local nodes
224  for (unsigned j = 4; j < nnode; j++)
225  {
226  // Pointer to the element's local node
227  Node* node_pt = finite_element_pt(e)->node_pt(j);
228 
229  // By default, we assume the node is not new
230  bool is_new = false;
231 
232  // This will have to be changed for higher-order elements
233  //=======================================================
234 
235  // Switch on local node number (all located on edges)
236  switch (j)
237  {
238  // Node 4 is located between nodes 0 and 1
239  case 4:
240 
241  edge_node1_pt = finite_element_pt(e)->node_pt(0);
242  edge_node2_pt = finite_element_pt(e)->node_pt(1);
243  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
244  {
245  is_new = true;
246  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
247  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
248  }
249  break;
250 
251 
252  // Node 5 is located between nodes 0 and 2
253  case 5:
254 
255  edge_node1_pt = finite_element_pt(e)->node_pt(0);
256  edge_node2_pt = finite_element_pt(e)->node_pt(2);
257  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
258  {
259  is_new = true;
260  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
261  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
262  }
263  break;
264 
265 
266  // Node 6 is located between nodes 0 and 3
267  case 6:
268 
269  edge_node1_pt = finite_element_pt(e)->node_pt(0);
270  edge_node2_pt = finite_element_pt(e)->node_pt(3);
271  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
272  {
273  is_new = true;
274  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
275  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
276  }
277  break;
278 
279 
280  // Node 7 is located between nodes 1 and 2
281  case 7:
282 
283  edge_node1_pt = finite_element_pt(e)->node_pt(1);
284  edge_node2_pt = finite_element_pt(e)->node_pt(2);
285  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
286  {
287  is_new = true;
288  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
289  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
290  }
291  break;
292 
293 
294  // Node 8 is located between nodes 2 and 3
295  case 8:
296 
297  edge_node1_pt = finite_element_pt(e)->node_pt(2);
298  edge_node2_pt = finite_element_pt(e)->node_pt(3);
299  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
300  {
301  is_new = true;
302  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
303  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
304  }
305  break;
306 
307 
308  // Node 9 is located between nodes 1 and 3
309  case 9:
310 
311  edge_node1_pt = finite_element_pt(e)->node_pt(1);
312  edge_node2_pt = finite_element_pt(e)->node_pt(3);
313  if (central_edge_node_pt(edge_node1_pt, edge_node2_pt) == 0)
314  {
315  is_new = true;
316  central_edge_node_pt(edge_node1_pt, edge_node2_pt) = node_pt;
317  central_edge_node_pt(edge_node2_pt, edge_node1_pt) = node_pt;
318  }
319  break;
320 
321  default:
322  throw OomphLibError("More than ten nodes in Tet Element",
325  }
326 
327  if (is_new)
328  {
329  // New node: Add it to mesh
330  Node_pt.push_back(node_pt);
331  }
332  else
333  {
334  // Delete local node in element...
335  delete finite_element_pt(e)->node_pt(j);
336 
337  // ... and reset pointer to the existing node
339  central_edge_node_pt(edge_node1_pt, edge_node2_pt);
340  }
341  }
342  }
343  }
344 
345 
346  // Boundary conditions
347 
348  // Matrix map to check if a node has already been added to
349  // the boundary number b (NOTE: Enumerated by pointer to ORIGINAL
350  // node before transfer to boundary node)
351  MapMatrixMixed<Node*, unsigned, bool> bound_node_done;
352 
353  // Create lookup scheme for pointers to original local nodes
354  // in elements
355  Vector<Vector<Node*>> orig_node_pt(nelem);
356 
357  // Loop over elements
358  for (unsigned e = 0; e < nelem; e++)
359  {
360  orig_node_pt[e].resize(nnode, 0);
361 
362  // Loop over new local nodes
363  for (unsigned j = 4; j < nnode; j++)
364  {
365  // Pointer to the element's local node
366  orig_node_pt[e][j] = finite_element_pt(e)->node_pt(j);
367  }
368  }
369 
370 
371  // Loop over elements
372  for (unsigned e = 0; e < nelem; e++)
373  {
374  // Loop over new local nodes
375  for (unsigned j = 4; j < nnode; j++)
376  {
377  // Loop over the boundaries
378  for (unsigned bo = 0; bo < nbound; bo++)
379  {
380  // Pointer to the element's local node
381  Node* loc_node_pt = finite_element_pt(e)->node_pt(j);
382 
383  // Pointer to original node
384  Node* orig_loc_node_pt = orig_node_pt[e][j];
385 
386  // value of the map for the node and boundary specified
387  bool bound_test = bound_node_done(orig_loc_node_pt, bo);
388 
389  if (bound_test == false)
390  {
391  bound_node_done(orig_loc_node_pt, bo) = true;
392 
393  // This will have to be changed for higher-order elements
394  //=======================================================
395 
396  // Switch on local node number (all located on edges)
397  switch (j)
398  {
399  // Node 4 is located between nodes 0 and 1
400  case 4:
401 
402  if (finite_element_pt(e)->node_pt(0)->is_on_boundary(bo) &&
403  finite_element_pt(e)->node_pt(1)->is_on_boundary(bo))
404  {
405  this->convert_to_boundary_node(loc_node_pt);
406  add_boundary_node(bo, loc_node_pt);
407  }
408  break;
409 
410 
411  // Node 5 is located between nodes 0 and 2
412  case 5:
413 
414  if (finite_element_pt(e)->node_pt(0)->is_on_boundary(bo) &&
415  finite_element_pt(e)->node_pt(2)->is_on_boundary(bo))
416  {
417  this->convert_to_boundary_node(loc_node_pt);
418  add_boundary_node(bo, loc_node_pt);
419  }
420  break;
421 
422 
423  // Node 6 is located between nodes 0 and 3
424  case 6:
425 
426  if (finite_element_pt(e)->node_pt(0)->is_on_boundary(bo) &&
427  finite_element_pt(e)->node_pt(3)->is_on_boundary(bo))
428  {
429  this->convert_to_boundary_node(loc_node_pt);
430  add_boundary_node(bo, loc_node_pt);
431  }
432  break;
433 
434 
435  // Node 7 is located between nodes 1 and 2
436  case 7:
437 
438  if (finite_element_pt(e)->node_pt(1)->is_on_boundary(bo) &&
439  finite_element_pt(e)->node_pt(2)->is_on_boundary(bo))
440  {
441  this->convert_to_boundary_node(loc_node_pt);
442  add_boundary_node(bo, loc_node_pt);
443  }
444  break;
445 
446 
447  // Node 8 is located between nodes 2 and 3
448  case 8:
449 
450  if (finite_element_pt(e)->node_pt(2)->is_on_boundary(bo) &&
451  finite_element_pt(e)->node_pt(3)->is_on_boundary(bo))
452  {
453  this->convert_to_boundary_node(loc_node_pt);
454  add_boundary_node(bo, loc_node_pt);
455  }
456  break;
457 
458 
459  // Node 9 is located between nodes 1 and 3
460  case 9:
461 
462  if (finite_element_pt(e)->node_pt(1)->is_on_boundary(bo) &&
463  finite_element_pt(e)->node_pt(3)->is_on_boundary(bo))
464  {
465  this->convert_to_boundary_node(loc_node_pt);
466  add_boundary_node(bo, loc_node_pt);
467  }
468  break;
469 
470 
471  default:
472  throw OomphLibError("More than ten nodes in Tet Element",
475  }
476  }
477 
478  } // end for bo
479  } // end for j
480  } // end for e
481  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
virtual void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Definition: elements.h:1842
virtual Node * construct_node(const unsigned &n)
Definition: elements.h:2509
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3962
unsigned dim() const
Definition: elements.h:2611
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
virtual unsigned nnode_1d() const
Definition: elements.h:2218
void add_boundary_node(const unsigned &b, Node *const &node_pt)
Add a (pointer to) a node to the b-th boundary.
Definition: mesh.cc:243
Vector< Node * > Node_pt
Vector of pointers to nodes.
Definition: mesh.h:183
FiniteElement * finite_element_pt(const unsigned &e) const
Definition: mesh.h:473
void set_nboundary(const unsigned &nbound)
Set the number of boundaries in the mesh.
Definition: mesh.h:505
unsigned nboundary() const
Return number of boundaries.
Definition: mesh.h:827
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
void convert_to_boundary_node(Node *&node_pt, const Vector< FiniteElement * > &finite_element_pt)
Definition: mesh.cc:2590
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:436
Vector< GeneralisedElement * > Element_pt
Vector of pointers to generalised elements.
Definition: mesh.h:186
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
RealScalar s
Definition: level1_cplx_impl.h:130
list bo
Definition: plotDoE.py:19
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References plotDoE::bo, e(), oomph::Node::get_boundaries_pt(), i, j, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, and oomph::Node::x().

Referenced by oomph::SimpleCubicTetMesh< ELEMENT >::SimpleCubicTetMesh().

Member Data Documentation

◆ Tmp_mesh_pt

template<class ELEMENT >
Mesh* oomph::SimpleCubicTetMesh< ELEMENT >::Tmp_mesh_pt
private

Temporary scaffold mesh.

Referenced by oomph::SimpleCubicTetMesh< ELEMENT >::SimpleCubicTetMesh().


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