OneDimMesh< ELEMENT > Class Template Reference

A simple one dimensional mesh: uniformly spaced nodes in the domain x=0,1. More...

+ Inheritance diagram for OneDimMesh< ELEMENT >:

Public Member Functions

 OneDimMesh (const unsigned &n_element, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 Mesh Constructor. The argument is the desired number of elements. More...
 
void output_faces (std::ostream &outfile)
 Output the face element. More...
 
void neighbour_finder (FiniteElement *const &bulk_element_pt, const int &face_index, const Vector< double > &s_bulk, FaceElement *&face_element_pt, Vector< double > &s_face)
 
 OneDimMesh (const unsigned &n_element, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
 Mesh Constructor. The argument is the desired number of elements. More...
 
void output_faces (std::ostream &outfile)
 Output the face element. More...
 
void neighbour_finder (FiniteElement *const &bulk_element_pt, const int &face_index, const Vector< double > &s_bulk, FaceElement *&face_element_pt, Vector< double > &s_face)
 
 OneDimMesh (const unsigned &n_element)
 Mesh Constructor. The argument is the desired number of elements. More...
 
- Public Member Functions inherited from oomph::DGMesh
 DGMesh ()
 
virtual ~DGMesh ()
 
void setup_face_neighbour_info (const bool &add_face_data_as_external=false)
 
void limit_slopes (SlopeLimiter *const &slope_limiter_pt)
 
- 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 setup_boundary_element_info ()
 
virtual void setup_boundary_element_info (std::ostream &outfile)
 
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::DGMesh
static double FaceTolerance = 1.0e-10
 
- 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

template<class ELEMENT>
class OneDimMesh< ELEMENT >

A simple one dimensional mesh: uniformly spaced nodes in the domain x=0,1.

Constructor & Destructor Documentation

◆ OneDimMesh() [1/3]

template<class ELEMENT >
OneDimMesh< ELEMENT >::OneDimMesh ( const unsigned n_element,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Mesh Constructor. The argument is the desired number of elements.

72  {
73  double X_min = 0.0;
74  double X_max = 1.0;
75 
76  //Resize the vector of pointers to elements: there are n_element elements
77  Element_pt.resize(n_element);
78  //Loop over and construct all elements
79  for(unsigned e=0;e<n_element;e++)
80  {
81  Element_pt[e] = new ELEMENT;
82  }
83 
84  //Construct nodes and faces for the elements
85  {
86  //First element
87  std::vector<bool> boundary_info(finite_element_pt(0)->nnode(),false);
88  boundary_info[0] = true;
89  dynamic_cast<ELEMENT*>(element_pt(0))
90  ->construct_boundary_nodes_and_faces(this,boundary_info,time_stepper_pt);
91 
92  //Construct normal nodes for middle elements
93  for(unsigned e=1;e<n_element-1;e++)
94  {
95  dynamic_cast<ELEMENT*>(element_pt(e))->
96  construct_nodes_and_faces(this,time_stepper_pt);
97  }
98 
99  //Final element
100  unsigned n_node = finite_element_pt(n_element-1)->nnode();
101  boundary_info.resize(n_node,false);
102  boundary_info[0] = false;
103  boundary_info[n_node-1] = true;
104  dynamic_cast<ELEMENT*>(element_pt(n_element-1))
105  ->construct_boundary_nodes_and_faces(this,boundary_info,time_stepper_pt);
106  }
107 
108 
109  //We've now created all the nodes -- let's set their positions:
110  //Elements are uniformly spaced
111  double el_length = (X_max - X_min)/(double)n_element;
112  //Storage for fractional position of node
113  Vector<double> s_fraction;
114 
115  //Loop over the elements again
116  for(unsigned e=0;e<n_element;e++)
117  {
118  //Locally cache the element
119  FiniteElement* elem_pt = finite_element_pt(e);
120  //Locally cache the pointer to the first node
121  Node* nod_pt = elem_pt->node_pt(0);
122  //Set it's position
123  nod_pt->x(0) = e*el_length;
124  //Add to the Mesh's list of nodes
125  Node_pt.push_back(nod_pt);
126 
127  unsigned n_node = elem_pt->nnode();
128  //Now we must loop over all other nodes
129  for(unsigned n=1;n<n_node;n++)
130  {
131  //Get the pointer to the n-th node
132  nod_pt = elem_pt->node_pt(n);
133 
134  //Find the fractional position of the node
135  elem_pt->local_fraction_of_node(n,s_fraction);
136 
137  //Now set the position of the node
138  nod_pt->x(0) = (e + s_fraction[0])*el_length;
139 
140  //Add to the list of nodes in the mesh
141  Node_pt.push_back(nod_pt);
142  }
143  }
144 
145 
146  //Find the total number of nodes created
147  const unsigned n_node = this->nnode();
148 
149  //There are two boundaries
150  set_nboundary(2);
151 
152  //Boundary 0 contains the first node in the mesh:
154 
155  //Boundary 1 contains the final node in the mesh:
156  add_boundary_node(1,Node_pt[n_node-1]);
157 
158  //Check
159  std::cout << "Constructed mesh with " << this->nelement()
160  << " Elements and " << this->nnode() << " Nodes" << std::endl;
161 
162 
163  } // End of constructor
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
virtual void local_fraction_of_node(const unsigned &j, Vector< double > &s_fraction)
Definition: elements.cc:3191
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 long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:596
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
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
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
int X_min
Definition: two_d_biharmonic.cc:41
int X_max
Definition: two_d_biharmonic.cc:42

References e(), oomph::FiniteElement::local_fraction_of_node(), n, oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), oomph::Node::x(), RayParam::X_max, and RayParam::X_min.

◆ OneDimMesh() [2/3]

template<class ELEMENT >
OneDimMesh< ELEMENT >::OneDimMesh ( const unsigned n_element,
TimeStepper time_stepper_pt = &Mesh::Default_TimeStepper 
)
inline

Mesh Constructor. The argument is the desired number of elements.

114  {
115  double X_min = -1.0;
116  double X_max = 1.0;
117 
118  //Resize the vector of pointers to elements: there are n_element elements
119  Element_pt.resize(n_element);
120  //Loop over and construct all elements
121  for(unsigned e=0;e<n_element;e++)
122  {
123  Element_pt[e] = new ELEMENT;
124  }
125 
126  //Construct nodes and faces for the elements
127  {
128  //First element
129  std::vector<bool> boundary_info(finite_element_pt(0)->nnode(),false);
130  boundary_info[0] = true;
131  dynamic_cast<ELEMENT*>(element_pt(0))
132  ->construct_boundary_nodes_and_faces(this,boundary_info,time_stepper_pt);
133 
134  //Construct normal nodes for middle elements
135  for(unsigned e=1;e<n_element-1;e++)
136  {
137  dynamic_cast<ELEMENT*>(element_pt(e))->
138  construct_nodes_and_faces(this,time_stepper_pt);
139  }
140 
141  //Final element
142  unsigned n_node = finite_element_pt(n_element-1)->nnode();
143  boundary_info.resize(n_node,false);
144  boundary_info[0] = false;
145  boundary_info[n_node-1] = true;
146  dynamic_cast<ELEMENT*>(element_pt(n_element-1))
147  ->construct_boundary_nodes_and_faces(this,boundary_info,time_stepper_pt);
148  }
149 
150 
151  //We've now created all the nodes -- let's set their positions:
152  //Elements are uniformly spaced
153  double el_length = (X_max - X_min)/(double)n_element;
154  //Storage for fractional position of node
155  Vector<double> s_fraction;
156 
157  //Loop over the elements again
158  for(unsigned e=0;e<n_element;e++)
159  {
160  //Locally cache the element
161  FiniteElement* elem_pt = finite_element_pt(e);
162  //Locally cache the pointer to the first node
163  Node* nod_pt = elem_pt->node_pt(0);
164  //Set it's position
165  nod_pt->x(0) = X_min + e*el_length;
166  //Add to the Mesh's list of nodes
167  Node_pt.push_back(nod_pt);
168 
169  unsigned n_node = elem_pt->nnode();
170  //Now we must loop over all other nodes
171  for(unsigned n=1;n<n_node;n++)
172  {
173  //Get the pointer to the n-th node
174  nod_pt = elem_pt->node_pt(n);
175 
176  //Find the fractional position of the node
177  elem_pt->local_fraction_of_node(n,s_fraction);
178 
179  //Now set the position of the node
180  nod_pt->x(0) = X_min + (e + s_fraction[0])*el_length;
181 
182  //Add to the list of nodes in the mesh
183  Node_pt.push_back(nod_pt);
184  }
185  }
186 
187 
188  //Find the total number of nodes created
189  const unsigned n_node = this->nnode();
190 
191  //There are two boundaries
192  set_nboundary(2);
193 
194  //Boundary 0 contains the first node in the mesh:
196 
197  //Boundary 1 contains the final node in the mesh:
198  add_boundary_node(1,Node_pt[n_node-1]);
199 
200  //Check
201  std::cout << "Constructed mesh with " << this->nelement()
202  << " Elements and " << this->nnode() << " Nodes" << std::endl;
203 
204  //Now set up the neighbour information
206 
207  } // End of constructor
void setup_face_neighbour_info(const bool &add_face_data_as_external=false)
Definition: dg_elements.h:489

References e(), oomph::FiniteElement::local_fraction_of_node(), n, oomph::FiniteElement::nnode(), oomph::FiniteElement::node_pt(), oomph::Node::x(), RayParam::X_max, and RayParam::X_min.

◆ OneDimMesh() [3/3]

template<class ELEMENT >
OneDimMesh< ELEMENT >::OneDimMesh ( const unsigned n_element)
inline

Mesh Constructor. The argument is the desired number of elements.

397  {
398  //Resize the vector of pointers to elements: there are n_element elements
399  Element_pt.resize(n_element);
400 
401  //Construct the first element (Note the use of the template parameter)
402  Element_pt[0] = new ELEMENT;
403 
404  //Construct the first node and add it to the Mesh::Node_pt vector
405  //Note: The FiniteElement::construct_boundary_node(j) function
406  //builds the element's j-th local node, and provides the functionality
407  //that allows it to be located on a Mesh boundary -- essentially this
408  //involves allocating additional storage to the Node.
409  //The function obtains the Node's
410  //characteristics (e.g. its spatial dimension, the number of
411  //values to be stored, etc) from various virtual FiniteElement
412  //member functions, such as FiniteElement::required_nvalue().
413  //FiniteElement::construct_boundary_node(...) also
414  //stores a pointer to the newly created Node in the element's own
415  //Node_pt vector.
416  //Finally, the function returns the pointer to the
417  //newly created Node, so that it can be stored in the Mesh's Node_pt
418  //vector, as done here:
419  Node_pt.push_back(finite_element_pt(0)->construct_boundary_node(0));
420 
421  //Find the number of nodes per element (N.B. all elements are identical
422  //so we can determine this value once and for all).
423  unsigned n_node = finite_element_pt(0)->nnode();
424 
425  //Loop over the remaning nodes of the first element
426  for(unsigned n=1;n<n_node;n++)
427  {
428  //Construct the next node and add it to the Mesh::Node_pt vector
429  //Note that these interior nodes need not (and should not)
430  //be boundary nodes, so they are created using the construct_node
431  //function, which has the same interface as
432  //construct_boundary_node()
433  Node_pt.push_back(finite_element_pt(0)->construct_node(n));
434  }
435 
436  //Loop over the remaining elements apart from the last
437  for(unsigned e=1;e<(n_element-1);e++)
438  {
439  //Construct the e-th element
440  Element_pt[e] = new ELEMENT;
441 
442  //The first local node of the e-th element is the last local node
443  //of the (e-1)-th element. We MUST NOT construct the node twice.
444  //Instead, we set the pointer in the e-th element to point to the
445  //previously created node in the (e-1)-th element.
446  finite_element_pt(e)->node_pt(0) =
447  finite_element_pt(e-1)->node_pt(n_node-1);
448 
449  //Loop over the remaining nodes of the e-th element
450  for(unsigned n=1;n<n_node;n++)
451  {
452  //Construct the next node and add it to the Mesh::Node_pt vector
453  //Note that these interior nodes need not (and should not)
454  //be boundary nodes, so they are created using the construct_node
455  //function, which has the same interface as
456  //construct_boundary_node()
457  Node_pt.push_back(finite_element_pt(e)->construct_node(n));
458  }
459  } //End of loop over elements
460 
461 
462  //Construct the final element
463  Element_pt[n_element-1] = new ELEMENT;
464 
465  //The first local node of the final element is the last local node
466  //of the penultimate element. We MUST NOT construct the node twice.
467  //Instead, we set the pointer in the final element to point to the
468  //previously created node in the penultimate element.
469  finite_element_pt(n_element-1)->node_pt(0) =
470  finite_element_pt(n_element-2)->node_pt(n_node-1);
471 
472  //Loop over the remaining central nodes of the final element
473  for(unsigned n=1;n<(n_node-1);n++)
474  {
475  //Construct the next node and add it to the Mesh::Node_pt vector
476  //Note that these interior nodes need not (and should not)
477  //be boundary nodes, so they are created using the construct_node
478  //function()
479  Node_pt.push_back(finite_element_pt(n_element-1)->construct_node(n));
480  }
481 
482  //Construct the final node and add it to the Mesh::Node_pt vector.
483  //This node will be located on a boundary, and hence we use
484  //the construct_boundary_node function.
485  Node_pt.push_back(finite_element_pt(n_element-1)
486  ->construct_boundary_node(n_node-1));
487 
488  //We've now created all the nodes -- let's set their positions:
489 
490  //Find the total number of nodes
491  unsigned n_global_node = nnode();
492 
493  //Loop over all nodes
494  for(unsigned n=0;n<n_global_node;n++)
495  {
496  //Set the position of the node (equally spaced through the unit interval)
497  Node_pt[n]->x(0) = double(n)/double(n_global_node-1);
498  }
499 
500  //Set the boundary data:
501 
502  //There are two boundaries in this mesh
503  set_nboundary(2);
504 
505  //Boundary 0 contains the first node in the mesh:
507 
508  //Boundary 1 contains the final node in the mesh:
509  add_boundary_node(1,Node_pt[n_global_node-1]);
510 
511  } // End of constructor
virtual Node * construct_node(const unsigned &n)
Definition: elements.h:2509
virtual Node * construct_boundary_node(const unsigned &n)
Definition: elements.h:2538

References e(), and n.

Member Function Documentation

◆ neighbour_finder() [1/2]

template<class ELEMENT >
void OneDimMesh< ELEMENT >::neighbour_finder ( FiniteElement *const &  bulk_element_pt,
const int face_index,
const Vector< double > &  s_bulk,
FaceElement *&  face_element_pt,
Vector< double > &  s_face 
)
inlinevirtual

Reimplemented from oomph::DGMesh.

182  {
183  //The face coordinate is always a vector of size zero
184  s_face.resize(0);
185 
186  //Not efficient but will work
187  const unsigned n_element = this->nelement();
188  for(unsigned e=0;e<n_element;e++)
189  {
190  if(finite_element_pt(e)==bulk_element_pt)
191  {
192  //Now what's up
193  switch(face_index)
194  {
195  //left face
196  case -1:
197  //If not the first
198  if(e!=0)
199  {
200  //Right face of previous element
201  face_element_pt =
202  dynamic_cast<ELEMENT*>(Element_pt[e-1])->face_element_pt(1);
203  }
204  //Otherwie make periodic
205  else
206  {
207  face_element_pt =
208  dynamic_cast<ELEMENT*>(Element_pt[n_element-1])->face_element_pt(1);
209  //dynamic_cast<ELEMENT*>(Element_pt[e])->face_element_pt(0);
210  }
211  break;
212 
213  //Right face
214  case 1:
215  //If not the last
216  if(e!=n_element-1)
217  {
218  //Left face of next element
219  face_element_pt =
220  dynamic_cast<ELEMENT*>(Element_pt[e+1])->face_element_pt(0);
221  }
222  //Otherwie make periodic
223  else
224  {
225  face_element_pt =
226  dynamic_cast<ELEMENT*>(Element_pt[0])->face_element_pt(0);
227  //dynamic_cast<ELEMENT*>(Element_pt[e])->face_element_pt(1);
228  }
229  break;
230 
231 
232  //Otherwise complain
233  default:
234  throw OomphLibError(
235  "Coordinate is not on any face",
238  }
239 
240  //Break out of the for loop
241  break;
242  }
243  }
244 
245  }
Definition: oomph_definitions.h:222
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References e(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ neighbour_finder() [2/2]

template<class ELEMENT >
void OneDimMesh< ELEMENT >::neighbour_finder ( FiniteElement *const &  bulk_element_pt,
const int face_index,
const Vector< double > &  s_bulk,
FaceElement *&  face_element_pt,
Vector< double > &  s_face 
)
inlinevirtual

Reimplemented from oomph::DGMesh.

226  {
227  //The face coordinate is always a vector of size zero
228  s_face.resize(0);
229 
230  //Not efficient but will work
231  const unsigned n_element = this->nelement();
232  for(unsigned e=0;e<n_element;e++)
233  {
234  if(finite_element_pt(e)==bulk_element_pt)
235  {
236  //Now what's up
237  switch(face_index)
238  {
239  //left face
240  case -1:
241  //If not the first
242  if(e!=0)
243  {
244  //Right face of previous element
245  face_element_pt =
246  dynamic_cast<ELEMENT*>(Element_pt[e-1])->face_element_pt(1);
247  }
248  //Otherwie just set the face to be the face of the first element
249  else
250  {
251  face_element_pt =
252  //dynamic_cast<ELEMENT*>(Element_pt[n_element-1])->face_element_pt(1);
253  dynamic_cast<ELEMENT*>(Element_pt[e])->face_element_pt(0);
254  }
255  break;
256 
257  //Right face
258  case 1:
259  //If not the last
260  if(e!=n_element-1)
261  {
262  //Left face of next element
263  face_element_pt =
264  dynamic_cast<ELEMENT*>(Element_pt[e+1])->face_element_pt(0);
265  }
266  //Otherwie make periodic
267  else
268  {
269  face_element_pt =
270  //dynamic_cast<ELEMENT*>(Element_pt[0])->face_element_pt(0);
271  dynamic_cast<ELEMENT*>(Element_pt[e])->face_element_pt(1);
272  }
273  break;
274 
275 
276  //Otherwise complain
277  default:
278  throw OomphLibError(
279  "Coordinate is not on any face",
282  }
283 
284  //Break out of the for loop
285  break;
286  }
287  }
288 
289  }

References e(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ output_faces() [1/2]

template<class ELEMENT >
void OneDimMesh< ELEMENT >::output_faces ( std::ostream &  outfile)
inline

Output the face element.

167  {
168  //Loop over the elements
169  unsigned n_element = this->nelement();
170  for(unsigned e=0;e<n_element;e++)
171  {
172  dynamic_cast<ELEMENT*>(element_pt(e))->output_faces(outfile);
173  }
174  }
void output_faces(std::ostream &outfile)
Output the face element.
Definition: one_d_advection.cc:166

References e().

◆ output_faces() [2/2]

template<class ELEMENT >
void OneDimMesh< ELEMENT >::output_faces ( std::ostream &  outfile)
inline

Output the face element.

211  {
212  //Loop over the elements
213  unsigned n_element = this->nelement();
214  for(unsigned e=0;e<n_element;e++)
215  {
216  dynamic_cast<ELEMENT*>(element_pt(e))->output_faces(outfile);
217  }
218  }

References e().


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