20 #include "SheafSystem/quadratic_2d.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;
61 _basis_values = _basis_value_buffer;
62 _basis_deriv_values = _basis_deriv_value_buffer;
63 _jacobian_values = _jacobian_value_buffer;
121 require(xlocal_coord != 0);
122 require(xlocal_coord_ub >= db());
123 require(basis_values() != 0);
129 double l0 = xlocal_coord[0];
130 double l1 = xlocal_coord[1];
131 double l2 = 1.0 - (l0 + l1);
135 _basis_values[0] = (2.0*l0-1.0)*l0;
136 _basis_values[1] = (2.0*l1-1.0)*l1;
137 _basis_values[2] = (2.0*l2-1.0)*l2;
141 _basis_values[3] = 4.0*l0*l1;
142 _basis_values[4] = 4.0*l1*l2;
143 _basis_values[5] = 4.0*l2*l0;
157 require(xlocal_coord != 0);
158 require(xlocal_coord_ub >= db());
159 require(basis_deriv_values() != 0);
191 require(xcoord_dofs != 0);
192 require(xcoord_dofs_ub >= db()*dl());
193 require(xlocal_coords != 0);
194 require(xlocal_coords_ub >= db());
221 require(xcoord_dofs != 0);
222 require(xcoord_dofs_ub >= dl()*db());
223 require(xdf == 2 || xdf == 3);
257 require(xcoord_dofs != 0);
258 require(xcoord_dofs_ub >= dl()*db());
259 require(xintegrands != 0);
260 require(xintegrands_ub >= dl());
261 require(xresult_integrals != 0);
262 require(xresult_integrals_ub > 0);
293 require(xcoord_dofs != 0);
294 require(xcoord_dofs_ub >= dl()*db());
295 require(xresult_integrals != 0);
296 require(xresult_integrals_ub >= dl());
322 require((0 <= xindex) && (xindex < dof_ct()));
323 require(xresult_ub >= db());
333 ensure(in_standard_domain(xresult, xresult_ub));
356 require(xlocal_coord_index < db());
357 require(xsource_dofs != 0);
359 require(xresult_dofs != 0);
366 dof_type derivative = xsource_dofs[xlocal_coord_index] - xsource_dofs[2];
368 for(
int i=0; i<3; ++i)
369 xresult_dofs[i] = derivative;
389 require(xcoord_dofs != 0);
390 require(xcoord_dofs_ub >= db()*dl());
391 require(xlocal_coords != 0);
392 require(xlocal_coords_ub >= db());
393 require(jacobian_values() != 0);
445 require((0 <= xindex) && (xindex < dof_ct()));
446 require(xresult_ub >= db());
455 , {0.0, 1.0}, {0.0, 0.0}, {0.5, 0.5}, {0.0, 0.5}, {0.5, 0.0}
458 xresult[0] = lcoords[xindex][0];
459 xresult[1] = lcoords[xindex][1];
463 ensure(in_standard_domain(xresult, xresult_ub));
478 require(xlocal_coords != 0);
479 require(xlocal_coords_ub >= 2);
489 dof_type zero = 0.0 - 1000.0*numeric_limits<dof_type>::epsilon();
490 dof_type one = 1.0 + 1000.0*numeric_limits<dof_type>::epsilon();
492 bool result = (u >= zero) && (u <= one) && (v >= zero) && (v <= one);
519 require(xdofs_ub >= 12);
520 require(xglobal_coords != 0);
521 require(xglobal_coord_ub >= 2);
522 require(xlocal_coords != 0);
523 require(xlocal_coords_ub >= 2);
527 cout <<
"quadratic_2d::coord_at_value()" << endl;
562 dof_type x_global = xglobal_coords[0];
563 dof_type y_global = xglobal_coords[1];
567 double a0 = x1*y2 - x2*y1;
568 double a1 = x2*y0 - x0*y2;
569 double a2 = x0*y1 - x1*y0;
579 double area_x_2 = a0 + a1 + a2;
581 double shape0 = (a0 + b0*x_global + c0*y_global) / area_x_2;
582 double shape1 = (a1 + b1*x_global + c1*y_global) / area_x_2;
587 cout <<
"shape0 = " << shape0 << endl;
588 cout <<
"shape1 = " << shape1 << endl;
589 cout <<
"shape2 = " << 1.0 - (shape0 + shape1) << endl;
594 xlocal_coords[0] = shape0;
595 xlocal_coords[1] = shape1;
639 ensure(is_same_type(result));
653 require(is_ancestor_of(&xother));
674 require(is_ancestor_of(&xother));
702 result = result && linear_fcn_space::invariant();
704 if(invariant_check())
708 disable_invariant_check();
710 invariance(basis_values() != 0);
714 enable_invariant_check();
730 require(xother != 0);
736 bool result =
dynamic_cast<const quadratic_2d*
>(xother) != 0;
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...
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 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.
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 ~quadratic_2d()
Destructor.
virtual int dl() const
The dimension of this function space.
sec_vd_dof_type dof_type
The type of degree of freedom.
virtual quadratic_2d * clone() const
Virtual constructor, creates a new instance of the same type as this.
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 local_coordinates(pod_index_type xindex, coord_type xresult[], size_type xresult_ub) const
The local coordinates of the dof with local index xindex.
quadratic_2d()
Default constructor.
Abstract base class with useful features for all objects.
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.
virtual int db() const
The base dimension; the dimension of the local coordinates (independent variable).
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...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
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...
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.
A section evaluator using quadratic interpolation over a triangular 2D domain.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
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.
virtual bool invariant() const
Class invariant.
int_type pod_index_type
The plain old data index type.
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...
Namespace for the fiber_bundles component of the sheaf system.
virtual quadratic_2d & operator=(const section_evaluator &xother)
Assignment operator.