20 #include "SheafSystem/quadratic_3d.h" 21 #include "SheafSystem/assert_contract.h" 22 #include "SheafSystem/std_cmath.h" 23 #include "SheafSystem/std_iostream.h" 24 #include "SheafSystem/std_limits.h" 41 _basis_values = _basis_value_buffer;
42 _basis_deriv_values = _basis_deriv_value_buffer;
43 _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;
106 ensure(result == 10);
119 require(xlocal_coord != 0);
120 require(xlocal_coord_ub >= db());
125 double L0 = xlocal_coord[0];
126 double L1 = xlocal_coord[1];
127 double L2 = xlocal_coord[2];
128 double L3 = 1.0 - (L0 + L1 + L2);
132 _basis_values[0] = (2.0*L0-1.0)*L0;
133 _basis_values[1] = (2.0*L1-1.0)*L1;
134 _basis_values[2] = (2.0*L2-1.0)*L2;
135 _basis_values[3] = (2.0*L3-1.0)*L3;
139 _basis_values[4] = 4.0*L0*L1;
140 _basis_values[5] = 4.0*L0*L2;
141 _basis_values[6] = 4.0*L0*L3;
142 _basis_values[7] = 4.0*L1*L2;
143 _basis_values[8] = 4.0*L2*L3;
144 _basis_values[9] = 4.0*L3*L1;
158 require(xlocal_coord != 0);
159 require(xlocal_coord_ub >= db());
160 require(basis_deriv_values() != 0);
192 require(xcoord_dofs != 0);
193 require(xcoord_dofs_ub >= db()*dl());
194 require(xlocal_coords != 0);
195 require(xlocal_coords_ub >= db());
222 require(xcoord_dofs != 0);
223 require(xcoord_dofs_ub >= dl()*db());
224 require(xdf == 2 || xdf == 3);
258 require(xcoord_dofs != 0);
259 require(xcoord_dofs_ub >= dl()*db());
260 require(xintegrands != 0);
261 require(xintegrands_ub >= dl());
262 require(xresult_integrals != 0);
263 require(xresult_integrals_ub > 0);
294 require(xcoord_dofs != 0);
295 require(xcoord_dofs_ub >= dl()*db());
296 require(xresult_integrals != 0);
297 require(xresult_integrals_ub >= dl());
323 require((0 <= xindex) && (xindex < dof_ct()));
324 require(xresult_ub >= db());
334 ensure(in_standard_domain(xresult, xresult_ub));
357 require(xlocal_coord_index < db());
358 require(xsource_dofs != 0);
360 require(xresult_dofs != 0);
367 dof_type derivative = xsource_dofs[xlocal_coord_index] - xsource_dofs[3];
369 for(
int i=0; i<4; ++i)
370 xresult_dofs[i] = derivative;
390 require(xcoord_dofs != 0);
391 require(xcoord_dofs_ub >= db()*dl());
392 require(xlocal_coords != 0);
393 require(xlocal_coords_ub >= db());
394 require(jacobian_values() != 0);
446 require((0 <= xindex) && (xindex < dof_ct()));
447 require(xresult_ub >= db());
470 xresult[0] = lcoords[xindex][0];
471 xresult[1] = lcoords[xindex][1];
472 xresult[2] = lcoords[xindex][2];
476 ensure(in_standard_domain(xresult, xresult_ub));
491 require(xlocal_coords != 0);
492 require(xlocal_coords_ub >= 3);
503 dof_type zero = 0.0 - 1000.0*numeric_limits<dof_type>::epsilon();
504 dof_type one = 1.0 + 1000.0*numeric_limits<dof_type>::epsilon();
506 bool result = (u >= zero) && (u <= one) &&
507 (v >= zero) && (v <= one) &&
508 (w >= zero) && (w <= one);
535 require(xdofs_ub >= 30);
536 require(xglobal_coords != 0);
537 require(xglobal_coord_ub >= 3);
538 require(xlocal_coords != 0);
539 require(xlocal_coords_ub >= 3);
543 cout <<
"quadratic_3d::coord_at_value()" << endl;
597 dof_type x_global = xglobal_coords[0];
598 dof_type y_global = xglobal_coords[1];
599 dof_type z_global = xglobal_coords[2];
605 double a01 = x0*y1-x1*y0;
606 double a02 = x0*y2-x2*y0;
607 double a03 = x0*y3-x3*y0;
608 double a12 = x1*y2-x2*y1;
609 double a13 = x1*y3-x3*y1;
610 double a23 = x2*y3-x3*y2;
663 double z00 = a23*z1 + a31*z2 + a12*z3;
664 double z01 = b23*z1 + b31*z2 + b12*z3;
665 double z02 = c32*z1 + c13*z2 + c21*z3;
666 double z03 = a32 + a21 + a13;
668 double z10 = a32*z0 + a03*z2 + a20*z3;
669 double z11 = b32*z0 + b03*z2 + b20*z3;
670 double z12 = c23*z0 + c30*z2 + c02*z3;
671 double z13 = a23 + a02 + a30;
673 double z20 = a13*z0 + a30*z1 + a01*z3;
674 double z21 = b13*z0 + b30*z1 + b01*z3;
675 double z22 = c31*z0 + c03*z1 + c10*z3;
676 double z23 = a31 + a10 + a03;
678 double z30 = a21*z0 + a02*z1 + a10*z2;
691 double det = z00 + z10 + z20 + z30;
693 cout <<
" det = " << det << endl;
695 double shape0 = (z00 + z01*x_global + z02*y_global + z03*z_global) / det;
696 double shape1 = (z10 + z11*x_global + z12*y_global + z13*z_global) / det;
697 double shape2 = (z20 + z21*x_global + z22*y_global + z23*z_global) / det;
700 double shape3 = 1.0 - (shape0 + shape1 + shape2);
702 cout <<
"shape0 = " << shape0 << endl;
703 cout <<
"shape1 = " << shape1 << endl;
704 cout <<
"shape2 = " << shape2 << endl;
705 cout <<
"shape3 = " << shape3 << endl;
712 xlocal_coords[0] = shape0;
713 xlocal_coords[1] = shape1;
714 xlocal_coords[2] = shape1;
758 ensure(is_same_type(result));
772 require(is_ancestor_of(&xother));
793 require(is_ancestor_of(&xother));
821 result = result && linear_fcn_space::invariant();
823 if(invariant_check())
827 disable_invariant_check();
829 invariance(basis_values() != 0);
833 enable_invariant_check();
849 require(xother != 0);
855 bool result =
dynamic_cast<const quadratic_3d*
>(xother) != 0;
virtual quadratic_3d & operator=(const section_evaluator &xother)
Assignment operator.
virtual ~quadratic_3d()
Destructor.
A section evaluator using quadratic interpolation over a tetrahedral 3D domain.
virtual 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)
Computes the the determinant of the jacobian matrix at local coordinates xlocal_coords with coordinat...
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 bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
sec_vd_dof_type dof_type
The type of degree of freedom.
Abstract base class with useful features for all objects.
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.
virtual int dl() const
The dimension of this function space.
virtual 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...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual quadratic_3d * 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.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
virtual int db() const
The base dimension; the dimension of the local coordinates (independent variable).
virtual bool invariant() const
Class invariant.
virtual 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)
Computes the the jacobian matrix at local coordinates xlocal_coords with coordinate dofs xcoord_dofs...
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.
int_type pod_index_type
The plain old data index type.
quadratic_3d()
Default constructor.
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...
virtual void dxi_local(size_type xcrd, const dof_type xsource_dofs[], size_type xsource_dofs_ub, dof_type xresult_dofs[], size_type xresult_dofs_ub) const
1st partial derivative of this with respect to local coordinate xcrd.
virtual value_type volume(const dof_type xcoord_dofs[], size_type xcoord_dofs_ub, size_type xdf)
Volume for specified coordinate dofs xcoord_dofs and fiber space dimension xdf.
Namespace for the fiber_bundles component of the sheaf system.
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. The dofs are assumed to be ...
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...