29 #ifndef OOMPH_HERMITE_ELEMENT_HEADER
30 #define OOMPH_HERMITE_ELEMENT_HEADER
34 #include <oomph-lib-config.h>
84 template<
unsigned DIM>
101 unsigned n_node =
static_cast<unsigned>(pow(2.0,
static_cast<int>(DIM)));
122 unsigned ncoord =
dim();
123 for (
unsigned i = 0;
i < ncoord;
i++)
138 unsigned ncoord =
dim();
139 for (
unsigned i = 0;
i < ncoord;
i++)
186 return invert_jacobian<DIM>(jacobian, inverse_jacobian);
199 transform_second_derivatives_template<DIM>(
200 jacobian, inverse_jacobian, jacobian2, dbasis, d2basis);
222 unsigned NNODE_1D = 2;
223 const double S_min = this->
s_min();
224 const double S_range = this->
s_max() - S_min;
225 for (
unsigned i = 0;
i < DIM;
i++)
227 j_sub[
i] = j_copy % NNODE_1D;
228 j_copy = (j_copy - j_sub[
i]) / NNODE_1D;
229 s[
i] = S_min + double(j_sub[
i]) / (double)(NNODE_1D - 1) * S_range;
236 s_fraction.resize(DIM);
239 unsigned NNODE_1D = 2;
240 for (
unsigned i = 0;
i < DIM;
i++)
242 j_sub[
i] = j_copy % NNODE_1D;
243 j_copy = (j_copy - j_sub[
i]) / NNODE_1D;
244 s_fraction[
i] = j_sub[
i];
267 void output(std::ostream& outfile,
const unsigned& n_plot);
273 void output(FILE* file_pt,
const unsigned& n_plot);
279 const unsigned& nplot,
281 const bool& use_equally_spaced_interior_sample_points =
false)
const;
324 const unsigned& nplot,
326 const bool& use_equally_spaced_interior_sample_points)
const
330 s[0] = -1.0 + 2.0 * double(
i) / double(nplot - 1);
331 if (use_equally_spaced_interior_sample_points)
334 double dx_new = range / double(nplot);
335 double range_new = double(nplot - 1) * dx_new;
336 s[0] = -1.0 + 0.5 * dx_new + range_new * (1.0 +
s[0]) / range;
351 const unsigned& nplot)
const
353 std::ostringstream header;
354 header <<
"ZONE I=" << nplot <<
"\n";
376 const unsigned& nplot,
378 const bool& use_equally_spaced_interior_sample_points)
const
382 unsigned i0 =
i % nplot;
383 unsigned i1 = (
i - i0) / nplot;
385 s[0] = -1.0 + 2.0 * double(i0) / double(nplot - 1);
386 s[1] = -1.0 + 2.0 * double(i1) / double(nplot - 1);
388 if (use_equally_spaced_interior_sample_points)
391 double dx_new = range / double(nplot);
392 double range_new = double(nplot - 1) * dx_new;
393 s[0] = -1.0 + 0.5 * dx_new + range_new * (1.0 +
s[0]) / range;
394 s[1] = -1.0 + 0.5 * dx_new + range_new * (1.0 +
s[1]) / range;
410 const unsigned& nplot)
const
412 std::ostringstream header;
413 header <<
"ZONE I=" << nplot <<
", J=" << nplot <<
"\n";
424 return nplot * nplot;
433 template<
unsigned DIM>
443 return FiniteElement::invert_jacobian<DIM>(jacobian, inverse_jacobian);
454 dpsids, jacobian, inverse_jacobian);
474 FiniteElement::transform_second_derivatives_diagonal<DIM>(
475 jacobian, inverse_jacobian, jacobian2, dbasis, d2basis);
501 template<
unsigned DIM>
510 unsigned n_node =
nnode();
524 void output(std::ostream& outfile);
527 void output(std::ostream& outfile,
const unsigned& n_plot);
530 void output(FILE* file_pt);
533 void output(FILE* file_pt,
const unsigned& n_plot);
567 template<
unsigned DIM>
592 dpsids, jacobian, inverse_jacobian);
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
These elements are exactly the same as QHermiteElements, but they employ the simplifying assumption t...
double invert_jacobian_mapping(const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the template-free interface for the calculation of the inverse jacobian. Pass the dimension ...
double local_to_eulerian_mapping(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the local to eulerian mapping so that it uses diagonal terms only.
DiagQHermiteElement()
Constructor.
void operator=(const DiagQHermiteElement &)=delete
Broken assignment operator.
void transform_second_derivatives(const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
Overload the template-free interface for the calculation of transformation of second derivatives.
DiagQHermiteElement(const DiagQHermiteElement &dummy)=delete
Broken copy constructor.
void transform_derivatives(const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
Overload the template-free interface for the transformation of derivatives, so that the diagonal vers...
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
void set_nnodal_position_type(const unsigned &nposition_type)
Set the number of types required to interpolate the coordinate.
virtual double local_to_eulerian_mapping_diagonal(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Calculate the mapping from local to Eulerian coordinates given the derivatives of the shape functions...
void set_dimension(const unsigned &dim)
Set the dimension of the element and initially set the dimension of the nodes to be the same as the d...
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
unsigned nnode() const
Return the number of nodes.
void set_n_node(const unsigned &n)
Set the number of nodes in the element to n, by resizing the storage for pointers to the Node objects...
virtual void set_integration_scheme(Integral *const &integral_pt)
Set the spatial integration scheme.
void transform_derivatives_diagonal(const DenseMatrix< double > &inverse_jacobian, DShape &dbasis) const
Convert derivative w.r.t local coordinates to derivatives w.r.t the coordinates used to assemble the ...
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
Empty base class for QHermiteElements (created so that we can use dynamic_cast<>() to figure out if a...
QHermiteElementBase()
Empty default constructor.
void operator=(const QHermiteElementBase &)=delete
Broken assignment operator.
QHermiteElementBase(const QHermiteElementBase &)=delete
Broken copy constructor.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
Get the local fraction of any node in the n-th position in a one dimensional expansion along the i-th...
void shape(const Vector< double > &s, Shape &psi) const
Function to calculate the geometric shape functions at local coordinate s.
void transform_second_derivatives(const DenseMatrix< double > &jacobian, const DenseMatrix< double > &inverse_jacobian, const DenseMatrix< double > &jacobian2, DShape &dbasis, DShape &d2basis) const
Overload the template-free interface for the calculation of transformation of second derivatives....
void output(FILE *file_pt, const unsigned &n_plot)
C_style output at n_plot points.
double invert_jacobian_mapping(const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the template-free interface for the calculation of the inverse jacobian. The element dimensi...
QHermiteElement()
Constructor.
std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction)
bool local_coord_is_valid(const Vector< double > &s)
Check whether the local coordinate are valid or not.
void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &use_equally_spaced_interior_sample_points=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
void move_local_coord_back_into_element(Vector< double > &s) const
Adjust local coordinates so that they're located inside the element.
unsigned nnode_1d() const
Return number of nodes along each element edge.
void local_coordinate_of_node(const unsigned &j, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size.
unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction)
void operator=(const QHermiteElement &)=delete
Broken assignment operator.
static Gauss< DIM, 3 > Default_integration_scheme
Default integration rule: Gaussian integration of same 'order' as the element.
void local_fraction_of_node(const unsigned &j, Vector< double > &s_fraction)
Get local fraction of node j in the element; vector sets its own size.
void build_face_element(const int &face_index, FaceElement *face_element_pt)
Build the lower-dimensional FaceElement of the type QHermiteElement<DIM-1>. The face index takes a va...
void output(std::ostream &outfile, const unsigned &n_plot)
Output at n_plot points.
void dshape_local(const Vector< double > &s, Shape &psi, DShape &dpsids) const
Function to compute the geometric shape functions and derivatives w.r.t. local coordinates at local c...
double s_min() const
Min. value of local coordinate.
double s_max() const
Max. value of local coordinate.
void output(FILE *file_pt)
C-style output.
void output(std::ostream &outfile)
Output.
void d2shape_local(const Vector< double > &s, Shape &psi, DShape &dpsids, DShape &d2psids) const
Function to compute the geometric shape functions and also first and second derivatives wrt local coo...
QHermiteElement(const QHermiteElement &dummy)=delete
Broken copy constructor.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
SolidQHermiteElements in which we assume the local and global coordinates to be aligned so that the J...
void operator=(const SolidDiagQHermiteElement &)=delete
Broken assignment operator.
double local_to_lagrangian_mapping(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the local to lagrangian mapping so that it uses diagonal terms only.
SolidDiagQHermiteElement()
Constructor.
SolidDiagQHermiteElement(const SolidDiagQHermiteElement &dummy)=delete
Broken copy constructor.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
void set_nnodal_lagrangian_type(const unsigned &nlagrangian_type)
Set the number of types required to interpolate the Lagrangian coordinates.
virtual double local_to_lagrangian_mapping_diagonal(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Calculate the mapping from local to Lagrangian coordinates given the derivatives of the shape functio...
void set_lagrangian_dimension(const unsigned &lagrangian_dimension)
Set the lagrangian dimension of the element — the number of lagrangian coordinates stored at the node...
////////////////////////////////////////////////////////////////////
void output(FILE *file_pt, const unsigned &n_plot)
C_style output at n_plot points.
SolidQHermiteElement(const SolidQHermiteElement &dummy)=delete
Broken copy constructor.
void build_face_element(const int &face_index, FaceElement *face_element_pt)
Build the lower-dimensional FaceElement of the type SolidQHermiteElement<DIM-1>. The face index takes...
void output(std::ostream &outfile)
Overload the output function.
void operator=(const SolidQHermiteElement &)=delete
Broken assignment operator.
SolidQHermiteElement()
Constructor.
void output(std::ostream &outfile, const unsigned &n_plot)
Output at n_plot points.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...