1 #ifndef INTREPID_HGRAD_LINE_CN_FEMDEF_HPP
2 #define INTREPID_HGRAD_LINE_CN_FEMDEF_HPP
53 template<
class Scalar,
class ArrayScalar>
55 const ArrayScalar &pts ):
56 latticePts_( n+1 , 1 ),
64 this ->
basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() );
71 for (
int i=0;i<n;i++) {
72 TEUCHOS_TEST_FOR_EXCEPTION( pts(i,0) >= pts(i+1,0) ,
74 "Intrepid::Basis_HGRAD_LINE_Cn_FEM Illegal points given to constructor" );
78 if (std::abs(pts(0,0)+1.0) < INTREPID_TOL) {
84 for (
int i=1;i<n;i++) {
87 if (std::abs(pts(n,0)-1.0) < INTREPID_TOL) {
100 Teuchos::SerialDenseMatrix<int,Scalar> Vsdm(N,N);
101 for (
int i=0;i<N;i++) {
102 for (
int j=0;j<N;j++) {
108 Teuchos::SerialDenseSolver<int,Scalar> solver;
109 solver.setMatrix( rcp( &Vsdm ,
false ) );
113 for (
int i=0;i<N;i++) {
114 for (
int j=0;j<N;j++) {
115 Vinv_(i,j) = Vsdm(j,i);
121 template<
class Scalar,
class ArrayScalar>
123 const EPointType &pointType ):
124 latticePts_( n+1 , 1 ),
132 this ->
basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() );
138 case POINTTYPE_EQUISPACED:
141 case POINTTYPE_SPECTRAL:
144 case POINTTYPE_SPECTRAL_OPEN:
145 PointTools::getGaussPoints<Scalar,FieldContainer<Scalar> >(
latticePts_ , n );
148 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument ,
"Basis_HGRAD_LINE_Cn_FEM:: invalid point type" );
158 Teuchos::SerialDenseMatrix<int,Scalar> Vsdm(N,N);
159 for (
int i=0;i<N;i++) {
160 for (
int j=0;j<N;j++) {
166 Teuchos::SerialDenseSolver<int,Scalar> solver;
167 solver.setMatrix( rcp( &Vsdm ,
false ) );
171 for (
int i=0;i<N;i++) {
172 for (
int j=0;j<N;j++) {
173 Vinv_(i,j) = Vsdm(j,i);
179 template<
class Scalar,
class ArrayScalar>
190 int *tags =
new int[ tagSize * this->getCardinality() ];
195 const int n = this->getDegree();
198 if (latticePts_(0,0) == -1.0) {
214 for (
int i=1;i<n;i++) {
217 tags[4*i+2] = -edge_dof + i;
218 tags[4*i+3] = internal_dof;
220 if (latticePts_(n,0) == 1.0) {
233 Intrepid::setOrdinalTagData(
this -> tagToOrdinal_,
234 this -> ordinalToTag_,
236 this -> basisCardinality_,
248 template<
class Scalar,
class ArrayScalar>
250 const ArrayScalar & inputPoints,
251 const EOperator operatorType)
const {
254 #ifdef HAVE_INTREPID_DEBUG
255 Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
258 this -> getBaseCellTopology(),
259 this -> getCardinality() );
261 const int numPts = inputPoints.dimension(0);
262 const int numBf = this->getCardinality();
265 switch (operatorType) {
269 Phis_.getValues( phisCur , inputPoints , operatorType );
270 for (
int i=0;i<outputValues.dimension(0);i++) {
271 for (
int j=0;j<outputValues.dimension(1);j++) {
272 outputValues(i,j) = 0.0;
273 for (
int k=0;k<this->getCardinality();k++) {
274 outputValues(i,j) += this->Vinv_(k,i) * phisCur(k,j);
293 (operatorType == OPERATOR_GRAD)? getDkCardinality(OPERATOR_D1,1): getDkCardinality(operatorType,1);
296 Phis_.getValues( phisCur , inputPoints , operatorType );
298 for (
int i=0;i<outputValues.dimension(0);i++) {
299 for (
int j=0;j<outputValues.dimension(1);j++) {
300 for (
int k=0;k<outputValues.dimension(2);k++) {
301 outputValues(i,j,k) = 0.0;
302 for (
int l=0;l<this->getCardinality();l++) {
303 outputValues(i,j,k) += this->Vinv_(l,i) * phisCur(l,j,k);
311 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
312 ">>> ERROR (Basis_HGRAD_LINE_Cn_FEM): Operator type not implemented" );
316 catch (std::invalid_argument &exception){
317 TEUCHOS_TEST_FOR_EXCEPTION(
true , std::invalid_argument,
318 ">>> ERROR (Basis_HGRAD_LINE_Cn_FEM): Operator failed");
325 template<
class Scalar,
class ArrayScalar>
327 const ArrayScalar & inputPoints,
328 const ArrayScalar & cellVertices,
329 const EOperator operatorType)
const {
330 TEUCHOS_TEST_FOR_EXCEPTION( (
true), std::logic_error,
331 ">>> ERROR (Basis_HGRAD_LINE_Cn_FEM): FEM Basis calling an FVD member function");
335 template<
class Scalar,
class ArrayScalar>
338 for (
int i=0;i<latticePts_.dimension(0);i++)
340 for (
int j=0;j<latticePts_.dimension(1);j++)
342 dofCoords(i,j) = latticePts_(i,j);
FieldContainer< Scalar > latticePts_
Holds the points defining the Lagrange basis.
Basis_HGRAD_LINE_Cn_FEM(int order, const ArrayScalar &pts)
Constructor.
EBasis basisType_
Type of the basis.
bool basisTagsAreSet_
"true" if tagToOrdinal_ and ordinalToTag_ have been initialized
FieldContainer< Scalar > V_
Generalized Vandermonde matrix V_{ij} = phis_i(x_j)
Basis_HGRAD_LINE_Cn_FEM_JACOBI< Scalar, FieldContainer< Scalar > > Phis_
orthogonal basis
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package http://trilinos...
virtual void getDofCoords(ArrayScalar &DofCoords) const
implements the dofcoords interface
void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const
Evaluation of a FEM basis on a reference Line cell.
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. ...
FieldContainer< Scalar > Vinv_
inverse of Generalized Vandermonde matrix, whose columns store the expansion coefficients of the noda...
void initializeTags()
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.