1 #ifndef INTREPID_HGRAD_TRI_CN_FEMDEF_HPP
2 #define INTREPID_HGRAD_TRI_CN_FEMDEF_HPP
53 template<
class Scalar,
class ArrayScalar>
55 const EPointType pointType ):
57 V((n+1)*(n+2)/2,(n+1)*(n+2)/2),
58 Vinv((n+1)*(n+2)/2,(n+1)*(n+2)/2),
59 latticePts( (n+1)*(n+2)/2 , 2 )
61 const int N = (n+1)*(n+2)/2;
64 this ->
basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
71 shards::CellTopology myTri_3( shards::getCellTopologyData< shards::Triangle<3> >() );
72 PointTools::getLattice<Scalar,FieldContainer<Scalar> >(
latticePts ,
82 Phis.getValues(
V , latticePts , OPERATOR_VALUE );
85 Teuchos::SerialDenseMatrix<int,Scalar> Vsdm(N,N);
86 for (
int i=0;i<N;i++) {
87 for (
int j=0;j<N;j++) {
93 Teuchos::SerialDenseSolver<int,Scalar> solver;
94 solver.setMatrix( rcp( &Vsdm ,
false ) );
98 for (
int i=0;i<N;i++) {
99 for (
int j=0;j<N;j++) {
100 Vinv(i,j) = Vsdm(j,i);
107 template<
class Scalar,
class ArrayScalar>
118 int *tags =
new int[ tagSize * this->getCardinality() ];
120 const int degree = this->getDegree();
125 tag_cur[0] = 0; tag_cur[1] = 0; tag_cur[2] = 0; tag_cur[3] = 1;
129 for (
int i=1;i<degree;i++) {
130 tag_cur[0] = 1; tag_cur[1] = 0; tag_cur[2] = i-1; tag_cur[3] = degree-1;
135 tag_cur[0] = 0; tag_cur[1] = 1; tag_cur[2] = 0; tag_cur[3] = 1;
144 int internal_dof_cur = 0;
147 for (
int i=1;i<degree;i++) {
149 tag_cur[0] = 1; tag_cur[1] = 2; tag_cur[2] = i-1; tag_cur[3] = degree-1;
153 for (
int j=1;j<degree-i;j++) {
154 tag_cur[0] = 2; tag_cur[1] = 0; tag_cur[2] = internal_dof_cur; tag_cur[3] = num_internal_dof;
160 tag_cur[0] = 1; tag_cur[1] = 1; tag_cur[2] = i-1; tag_cur[3] = degree-1;
167 tag_cur[0] = 0; tag_cur[1] = 2; tag_cur[2] = 0; tag_cur[3] = 1;
171 Intrepid::setOrdinalTagData(
this -> tagToOrdinal_,
172 this -> ordinalToTag_,
174 this -> basisCardinality_,
186 template<
class Scalar,
class ArrayScalar>
188 const ArrayScalar & inputPoints,
189 const EOperator operatorType)
const {
192 #ifdef HAVE_INTREPID_DEBUG
193 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
196 this -> getBaseCellTopology(),
197 this -> getCardinality() );
199 const int numPts = inputPoints.dimension(0);
200 const int numBf = this->getCardinality();
203 switch (operatorType) {
207 Phis.getValues( phisCur , inputPoints , operatorType );
208 for (
int i=0;i<outputValues.dimension(0);i++) {
209 for (
int j=0;j<outputValues.dimension(1);j++) {
210 outputValues(i,j) = 0.0;
211 for (
int k=0;k<this->getCardinality();k++) {
212 outputValues(i,j) += this->Vinv(k,i) * phisCur(k,j);
231 (operatorType == OPERATOR_GRAD)? getDkCardinality(OPERATOR_D1,2): getDkCardinality(operatorType,2);
234 Phis.getValues( phisCur , inputPoints , operatorType );
236 for (
int i=0;i<outputValues.dimension(0);i++) {
237 for (
int j=0;j<outputValues.dimension(1);j++) {
238 for (
int k=0;k<outputValues.dimension(2);k++) {
239 outputValues(i,j,k) = 0.0;
240 for (
int l=0;l<this->getCardinality();l++) {
241 outputValues(i,j,k) += this->Vinv(l,i) * phisCur(l,j,k);
251 Phis.getValues( phisCur , inputPoints , OPERATOR_D1 );
253 for (
int i=0;i<outputValues.dimension(0);i++) {
254 for (
int j=0;j<outputValues.dimension(1);j++) {
255 outputValues(i,j,0) = 0.0;
256 outputValues(i,j,1) = 0.0;
257 for (
int k=0;k<this->getCardinality();k++) {
258 outputValues(i,j,0) = this->Vinv(k,i) * phisCur(k,j,1);
260 for (
int k=0;k<this->getCardinality();k++) {
261 outputValues(i,j,1) -= this->Vinv(k,i) * phisCur(k,j,0);
268 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
269 ">>> ERROR (Basis_HGRAD_TRI_Cn_FEM): Operator type not implemented");
273 catch (std::invalid_argument &exception){
274 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
275 ">>> ERROR (Basis_HGRAD_TRI_Cn_FEM): Operator type not implemented");
282 template<
class Scalar,
class ArrayScalar>
284 const ArrayScalar & inputPoints,
285 const ArrayScalar & cellVertices,
286 const EOperator operatorType)
const {
287 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
288 ">>> ERROR (Basis_HGRAD_TRI_Cn_FEM): FEM Basis calling an FVD member function");
FieldContainer< Scalar > latticePts
stores the points at which degrees of freedom are located.
EBasis basisType_
Type of the basis.
Basis_HGRAD_TRI_Cn_FEM(const int n, const EPointType pointType)
Constructor.
bool basisTagsAreSet_
"true" if tagToOrdinal_ and ordinalToTag_ have been initialized
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
FieldContainer< Scalar > V
The Vandermonde matrix with V_{ij} = phi_i(x_j), where x_j is the j_th point in the lattice...
FieldContainer< Scalar > Vinv
The inverse of V. The columns of Vinv express the Lagrange basis in terms of the orthogonal basis...
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package http://trilinos...
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Triangle cell.
virtual void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
Basis_HGRAD_TRI_Cn_FEM_ORTH< Scalar, FieldContainer< Scalar > > Phis
The orthogonal basis on triangles, out of which the nodal basis is constructed.
int basisDegree_
Degree of the largest complete polynomial space that can be represented by the basis.
int basisCardinality_
Cardinality of the basis, i.e., the number of basis functions/degrees-of-freedom. ...