20 #include "SheafSystem/linear_1d.h" 21 #include "SheafSystem/assert_contract.h" 22 #include "SheafSystem/std_limits.h" 23 #include "SheafSystem/std_cmath.h" 40 _basis_values = _basis_value_buffer;
41 _basis_deriv_values = _basis_deriv_value_buffer;
42 _jacobian_values = _jacobian_value_buffer;
60 _basis_values = _basis_value_buffer;
61 _basis_deriv_values = _basis_deriv_value_buffer;
62 _jacobian_values = _jacobian_value_buffer;
86 #ifndef DOXYGEN_SKIP_UNKNOWN 92 double xinverse_jacobian[1])
94 double j00 = xjacobian[0];
108 #endif // ifndef DOXYGEN_SKIP_UNKNOWN 143 require(xlocal_coord != 0);
144 require(xlocal_coord_ub >= db());
150 _basis_values[0] = 0.5*(1.0 - xlocal_coord[0]);
151 _basis_values[1] = 0.5*(1.0 + xlocal_coord[0]);
179 _basis_deriv_value_buffer[0] = -0.5;
180 _basis_deriv_value_buffer[1] = 0.5;
208 require(xcoord_dofs != 0);
209 require(xcoord_dofs_ub >= dl()*db());
210 require(xdf == 2 || xdf == 3);
214 jacobian(xcoord_dofs, xcoord_dofs_ub, xdf, xlocal_coords, xlocal_coords_ub);
215 const value_type* jvalues = jacobian_values();
233 require(xcoord_dofs != 0);
234 require(xcoord_dofs_ub >= dl()*db());
235 require(xdf == 1 || xdf == 2 || xdf == 3);
249 for(
int i=0; i<xdf; ++i)
253 double c0 = xcoord_dofs[index];
254 double c1 = xcoord_dofs[index+xdf];
256 double c10 = c1 - c0;
267 ensure(result >= 0.0);
289 require(xcoord_dofs != 0);
290 require(xcoord_dofs_ub >= dl()*db());
291 require(xintegrands != 0);
292 require(xintegrands_ub >= dl());
293 require(xresult_integrals != 0);
294 require(xresult_integrals_ub > 0);
302 for(
int i=0; i<xresult_integrals_ub; ++i)
305 const dof_type* integrands_n = &xintegrands[i*2];
307 for(
int k=0; k<2; ++k)
309 fn += integrands_n[k];
312 xresult_integrals[i] = fn*half_length;
338 require(xcoord_dofs != 0);
339 require(xcoord_dofs_ub >= dl()*db());
340 require(xresult_integrals != 0);
341 require(xresult_integrals_ub >= dl());
349 value_type nodal_value = xintegrand * half_length;
350 xresult_integrals[0] = nodal_value;
351 xresult_integrals[1] = nodal_value;
371 require((0 <= xindex) && (xindex < dof_ct()));
372 require(xresult_ub >= 1);
378 static const double d = 1.0 /
sqrt(3.0);
384 xresult[0] = gauss_coords[xindex];
388 ensure(in_standard_domain(xresult, xresult_ub));
410 require(xlocal_coord_index < db());
411 require(xsource_dofs != 0);
413 require(xresult_dofs != 0);
420 dof_type derivative = 0.5 * (xsource_dofs[1] - xsource_dofs[0]);
422 xresult_dofs[0] = derivative;
423 xresult_dofs[1] = derivative;
445 require(xcoord_dofs != 0);
446 require(xcoord_dofs_ub >= xdf*dl());
447 require(xdf == 1 || xdf == 2 || xdf == 3);
448 require(xlocal_coords != 0);
449 require(xlocal_coords_ub >= 1);
450 require(jacobian_values() != 0);
455 for(
int i=0; i<xdf; ++i)
459 double c0 = xcoord_dofs[index];
460 double c1 = xcoord_dofs[index+xdf];
462 _jacobian_values[i] = 0.5*(c1-c0);
510 require((0 <= xindex) && (xindex < dof_ct()));
511 require(xresult_ub >= db());
520 xresult[0] = lcoords[xindex];
524 ensure(in_standard_domain(xresult, xresult_ub));
539 require(xlocal_coords != 0);
540 require(xlocal_coords_ub >= 1);
549 dof_type one = 1.0 + 1000.0*numeric_limits<dof_type>::epsilon();
551 bool result = (u >= -one) && (u <= one);
578 require(xdofs_ub >= 2);
579 require(xglobal_coords != 0);
580 require(xglobal_coord_ub >= 1);
581 require(xlocal_coords != 0);
582 require(xlocal_coords_ub >= 1);
591 dof_type x_global = xglobal_coords[0];
595 xlocal_coords[0] = (2.0*x_global - (x0 + x1)) /
length;
632 ensure(is_same_type(result));
645 require(is_ancestor_of(&xother));
666 require(is_ancestor_of(&xother));
695 result = result && linear_fcn_space::invariant();
697 if(invariant_check())
701 disable_invariant_check();
703 invariance(basis_values() != 0);
707 enable_invariant_check();
723 require(xother != 0);
729 bool result =
dynamic_cast<const linear_1d*
>(xother) != 0;
linear_1d()
Default constructor.
SHEAF_DLL_SPEC void sqrt(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sqrt of x0 (sqrt(x0)) (pre-allocated version).
virtual void coord_at_value(const dof_type xdofs[], size_type xdofs_ub, const dof_type xglobal_coords[], size_type xglobal_coord_ub, dof_type xlocal_coords[], size_type xlocal_coords_ub) const
The local coordinates of a point at which the field has the value xvalue.
virtual linear_1d & operator=(const section_evaluator &xother)
Assignment operator.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
void jacobian(const dof_type xcoord_dofs[], size_type xcoord_dofs_ub, size_type xdf, const dof_type xlocal_coords[], size_type xlocal_coords_ub)
Jacobian matrix.
virtual void basis_at_coord(const dof_type xlocal_coord[], size_type xlocal_coord_ub)
Computes the value of each basis function at local coordinates xlocal_coord.
sec_vd_dof_type dof_type
The type of degree of freedom.
virtual void gauss_point(pod_index_type xindex, coord_type xresult[], size_type xresult_ub)
The local coordinates of the gauss point with index xindex.
virtual ~linear_1d()
Destructor.
SHEAF_DLL_SPEC void determinant(const st2 &x0, vd_value_type &xresult, bool xauto_access)
The determinant of a symmetric tensor (pre-allocated version for persistent types).
virtual void local_coordinates(pod_index_type xindex, coord_type xresult[], size_type xresult_ub) const
The local coordinates of the dof with local index xindex.
SHEAF_DLL_SPEC vd_value_type length(const ed &x0, bool xauto_access)
The Euclidean length (magnitude) of x0 (version for persistent types).
Abstract base class with useful features for all objects.
value_type volume(const dof_type xcoord_dofs[], size_type xcoord_dofs_ub, size_type xdf)
Volume...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual linear_1d * clone() const
Virtual constructor, creates a new instance of the same type as this.
chart_point_coord_type coord_type
The type of local coordinate; the scalar type for the local coordinate vector space.
vd_value_type value_type
The type of component in the value; the scalar type in the range vector space.
virtual int db() const
The base dimension; the dimension of the local coordinates (independent variable).
virtual int dl() const
The dimension of this function space.
value_type jacobian_determinant(const dof_type xcoord_dofs[], size_type xcoord_dofs_ub, size_type xdf, const coord_type xlocal_coords[], size_type xlocal_coords_ub)
Determinant of Jacobian matrix (square)
virtual bool invariant() const
Class invariant.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
virtual void dxi_local(size_type xlocal_coord_index, const dof_type xsource_dofs[], size_type xsource_dofs_ub, dof_type xresult_dofs[], size_type xresult_dofs_ub) const
First partial derivative of this with respect to local coordinate xlocal_coord_index.
void basis_derivs_at_coord(const dof_type xlocal_coords[], size_type xlocal_coords_ub)
Computes the value of the derivatives of each basis function at local coordinates xlocal_coords...
int_type pod_index_type
The plain old data index type.
A section evaluator using linear interpolation over a 1D domain.
virtual void integrate(const dof_type xcoord_dofs[], size_type xcoord_dofs_ub, size_type xdf, const dof_type xintegrands[], size_type xintegrands_ub, value_type xresult_integrals[], size_type xresult_integrals_ub)
Computes the value of the integral of the integrand array...
virtual bool in_standard_domain(const dof_type xlocal_coords[], size_type xlocal_coords_ub) const
Return true if the specified local coordinates are in the "standard" domain; otherwise return false...
double inverse_jacobian(const double xjacobian[], double xinverse_jacobian[])
Determinant of Jacobian matrix (square)
Namespace for the fiber_bundles component of the sheaf system.