1 #ifndef INTREPID_HGRAD_TRI_CN_FEM_ORTHDEF_HPP
2 #define INTREPID_HGRAD_TRI_CN_FEM_ORTHDEF_HPP
54 template<
class Scalar,
class ArrayScalar>
57 this -> basisCardinality_ = (degree+1)*(degree+2)/2;
58 this -> basisDegree_ = degree;
59 this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
60 this -> basisType_ = BASIS_FEM_HIERARCHICAL;
61 this -> basisCoordinates_ = COORDINATES_CARTESIAN;
62 this -> basisTagsAreSet_ =
false;
67 template<
class Scalar,
class ArrayScalar>
77 int *tags =
new int[tagSize * this->getCardinality()];
78 for (
int i=0;i<this->getCardinality();i++) {
82 tags[4*i+3] = this->getCardinality();
86 Intrepid::setOrdinalTagData(
this -> tagToOrdinal_,
87 this -> ordinalToTag_,
89 this -> basisCardinality_,
98 template<
class Scalar,
class ArrayScalar>
100 const ArrayScalar & inputPoints,
101 const EOperator operatorType)
const {
104 #ifdef HAVE_INTREPID_DEBUG
105 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
108 this -> getBaseCellTopology(),
109 this -> getCardinality() );
111 const int deg = this->getDegree();
114 void (*tabulators[])(ArrayScalar &,
const int,
const ArrayScalar &)
120 switch (operatorType) {
122 tabulators[0]( outputValues , deg , inputPoints );
125 tabulators[1]( outputValues , deg , inputPoints );
131 tabulators[operatorType-OPERATOR_D1+1]( outputValues , deg , inputPoints );
134 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
135 ">>> ERROR (Basis_HGRAD_TRI_Cn_FEM_ORTH): invalid or unsupported operator" );
144 template<
class Scalar,
class ArrayScalar>
146 const ArrayScalar & inputPoints,
147 const ArrayScalar & cellVertices,
148 const EOperator operatorType)
const {
149 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
150 ">>> ERROR (Basis_HGRAD_TRI_Cn_FEM): FEM Basis calling an FVD member function");
155 template<
typename Scalar,
typename ArrayScalar>
158 const ArrayScalar &z )
160 const int np = z.dimension( 0 );
168 int idx_curp1,idx_curm1;
171 for (
int i=0;i<np;i++) {
172 outputValues(idx_cur,i) = Scalar( 1.0 ) + z(i,0) - z(i,0) + z(i,1) - z(i,1);
177 Teuchos::Array<Scalar> f1(np),f2(np),f3(np);
179 for (
int i=0;i<np;i++) {
180 f1[i] = 0.5 * (1.0+2.0*(2.0*z(i,0)-1.0)+(2.0*z(i,1)-1.0));
181 f2[i] = 0.5 * (1.0-(2.0*z(i,1)-1.0));
182 f3[i] = f2[i] * f2[i];
187 for (
int i=0;i<np;i++) {
188 outputValues(idx_cur,i) = f1[i];
192 for (
int p=1;p<deg;p++) {
196 Scalar a = (2.0*p+1.0)/(1.0+p);
197 Scalar b = p / (p+1.0);
199 for (
int i=0;i<np;i++) {
200 outputValues(idx_curp1,i) = a * f1[i] * outputValues(idx_cur,i)
201 - b * f3[i] * outputValues(idx_curm1,i);
206 for (
int p=0;p<deg;p++) {
209 for (
int i=0;i<np;i++) {
210 outputValues(idxp1,i) = outputValues(idxp0,i)
211 *0.5*(1.0+2.0*p+(3.0+2.0*p)*(2.0*z(i,1)-1.0));
217 for (
int p=0;p<deg-1;p++) {
218 for (
int q=1;q<deg-p;q++) {
224 for (
int i=0;i<np;i++) {
225 outputValues(idxpqp1,i)
226 = (a*(2.0*z(i,1)-1.0)+b)*outputValues(idxpq,i)
227 - c*outputValues(idxpqm1,i);
234 for (
int p=0;p<=deg;p++) {
235 for (
int q=0;q<=deg-p;q++) {
236 for (
int i=0;i<np;i++) {
247 template<
typename Scalar,
typename ArrayScalar>
250 const ArrayScalar &z )
252 const int np = z.dimension(0);
253 const int card = outputValues.dimension(0);
255 for (
int i=0;i<np;i++) {
256 for (
int j=0;j<2;j++) {
257 dZ(i,j) = Sacado::Fad::DFad<Scalar>( z(i,j) );
267 for (
int i=0;i<card;i++) {
268 for (
int j=0;j<np;j++) {
269 for (
int k=0;k<2;k++) {
270 outputValues(i,j,k) = dResult(i,j).dx(k);
281 template<
typename Scalar,
typename ArrayScalar,
unsigned derivOrder>
284 const ArrayScalar &z )
286 const int np = z.dimension(0);
287 const int card = outputValues.dimension(0);
289 for (
int i=0;i<np;i++) {
290 for (
int j=0;j<2;j++) {
291 dZ(i,j) = Sacado::Fad::DFad<Scalar>( z(i,j) );
301 for (
int i=0;i<card;i++) {
302 for (
int j=0;j<np;j++) {
303 outputValues(i,j,0) = dResult(i,j,0).dx(0);
304 for (
unsigned k=0;k<derivOrder;k++) {
305 outputValues(i,j,k+1) = dResult(i,j,k).dx(1);
Basis_HGRAD_TRI_Cn_FEM_ORTH(int degree)
Constructor.
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Triangle cell.
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
static void tabulate(ArrayScalar &outputValues, const int deg, const ArrayScalar &inputPoints)
basic tabulate mathod evaluates the derivOrder^th derivatives of the basis functions at inputPoints i...
Implementation of a templated lexicographical container for a multi-indexed scalar quantity...
This is an internal class with a static member function for tabulating derivatives of orthogonal expa...