20 #include "SheafSystem/quadratic_1d.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;
124 require(xlocal_coord != 0);
125 require(xlocal_coord_ub >= db());
133 _basis_values[0] = 0.5*r*(r - 1.0);
134 _basis_values[1] = 1.0 - r*r;
135 _basis_values[2] = 0.5*r*(r + 1.0);
150 require(xlocal_coord != 0);
151 require(xlocal_coord_ub >= db());
152 require(basis_deriv_values() != 0);
158 _basis_deriv_values[0] = r - 0.5;
159 _basis_deriv_values[1] = -2.0*r;
160 _basis_deriv_values[2] = r + 0.5;
186 require(xcoord_dofs != 0);
187 require(xcoord_dofs_ub >= db()*dl());
188 require(xlocal_coords != 0);
189 require(xlocal_coords_ub >= db());
218 require(xcoord_dofs != 0);
219 require(xcoord_dofs_ub >= dl()*db());
220 require(xdf == 1 || xdf == 2 || xdf == 3);
236 for(
int i=0; i<xdf; ++i)
240 double c0 = xcoord_dofs[index];
241 double c1 = xcoord_dofs[index+xdf];
242 double c10 = c1 - c0;
255 ensure(result >= 0.0);
277 require(xcoord_dofs != 0);
278 require(xcoord_dofs_ub >= dl()*db());
279 require(xintegrands != 0);
280 require(xintegrands_ub >= dl());
281 require(xresult_integrals != 0);
282 require(xresult_integrals_ub > 0);
313 require(xcoord_dofs != 0);
314 require(xcoord_dofs_ub >= dl()*db());
315 require(xresult_integrals != 0);
316 require(xresult_integrals_ub >= dl());
342 require((0 <= xindex) && (xindex < dof_ct()));
343 require(xresult_ub >= db());
353 ensure(in_standard_domain(xresult, xresult_ub));
376 require(xlocal_coord_index < db());
377 require(xsource_dofs != 0);
378 require(xsource_dofs_ub >= 3);
379 require(xresult_dofs != 0);
380 require(xresult_dofs_ub >= 3);
386 double u0 = xsource_dofs[0];
387 double u1 = xsource_dofs[1];
388 double u2 = xsource_dofs[2];
390 xresult_dofs[0] = -1.5*u0 + 2.0*u1 - 0.5*u2;
391 xresult_dofs[1] = 0.5*(u2 - u0);
392 xresult_dofs[2] = 0.5*u0 - 2.0*u1 + 1.5*u2;
412 require(xcoord_dofs != 0);
413 require(xcoord_dofs_ub >= db()*dl());
414 require(xlocal_coords != 0);
415 require(xlocal_coords_ub >= db());
416 require(jacobian_values() != 0);
468 require((0 <= xindex) && (xindex < dof_ct()));
469 require(xresult_ub >= db());
478 xresult[0] = lcoords[xindex];
482 ensure(in_standard_domain(xresult, xresult_ub));
497 require(xlocal_coords != 0);
498 require(xlocal_coords_ub >= 1);
507 dof_type one = 1.0 + 1000.0*numeric_limits<dof_type>::epsilon();
509 bool result = (u >= -one) && (u <= one);
536 require(xdofs_ub >= 3);
537 require(xglobal_coords != 0);
538 require(xglobal_coord_ub >= 1);
539 require(xlocal_coords != 0);
540 require(xlocal_coords_ub >= 1);
544 cout <<
"quadratic_1d::coord_at_value()" << endl;
550 dof_type x_global = xglobal_coords[0];
552 cout <<
"##### x0 = " << x0 << endl;
553 cout <<
"##### x1 = " << x1 << endl;
554 cout <<
"##### x2 = " << x2 << endl;
555 cout <<
"##### x_global = " << x_global << endl;
560 double a = x0 - 2.0*x1 + x2;
562 double c = 2.0*(x1 - x_global);
564 cout <<
"#### a = " << a << endl;
565 cout <<
"#### b = " << b << endl;
566 cout <<
"#### c = " << c << endl;
570 double local_coord = -c/b;
572 cout <<
"#### local_coord = " << local_coord << endl;
574 xlocal_coords[0] = local_coord;
615 ensure(is_same_type(result));
630 require(is_ancestor_of(&xother));
651 require(is_ancestor_of(&xother));
679 result = result && linear_fcn_space::invariant();
681 if(invariant_check())
685 disable_invariant_check();
687 invariance(basis_values() != 0);
691 enable_invariant_check();
707 require(xother != 0);
713 bool result =
dynamic_cast<const quadratic_1d*
>(xother) != 0;
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 quadratic_1d & operator=(const section_evaluator &xother)
Assignment operator.
virtual int db() const
The base dimension; the dimension of the local coordinates (independent variable).
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 ~quadratic_1d()
Destructor.
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 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...
sec_vd_dof_type dof_type
The type of degree of freedom.
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 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 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...
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 bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
quadratic_1d()
Default constructor.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
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 1D domain.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
virtual int dl() const
The dimension of this function space.
int_type pod_index_type
The plain old data index type.
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 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 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_1d * clone() const
Virtual constructor, creates a new instance of the same type as this.
Namespace for the fiber_bundles component of the sheaf system.
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 bool invariant() const
Class invariant.