Intrepid
Intrepid_Basis.hpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Intrepid Package
5// Copyright (2007) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Pavel Bochev (pbboche@sandia.gov)
38// Denis Ridzal (dridzal@sandia.gov), or
39// Kara Peterson (kjpeter@sandia.gov)
40//
41// ************************************************************************
42// @HEADER
43
48
49#ifndef INTREPID_BASIS_HPP
50#define INTREPID_BASIS_HPP
51#include "Intrepid_ConfigDefs.hpp"
53#include "Intrepid_Utils.hpp"
54#include "Shards_CellTopology.hpp"
55
56namespace Intrepid {
57
65
68 As a result, FVD bases require the vertex coordinates of the physical cell but the cell
69 itself is not required to have a reference cell.
70
71 Every DoF and its corresponding basis function from a given FEM or FVD basis set is
72 assigned an ordinal number which which specifies its numerical position in the DoF set,
73 and a 4-field DoF tag whose first 3 fields establish association between the DoF and a
74 subcell of particular dimension, and the last field gives the total number of basis
75 functions associated with that subcell; see Section \ref basis_dof_tag_ord_sec for details.
76
77 \remark To limit memory use by factory-type objects (basis factories will be included in future
78 releases of Intrepid), tag data is not initialized by basis ctors,
79 instead, whenever a function that requires tag data is invoked for a first time, it calls
80 initializeTags() to fill <var>ordinalToTag_</var> and <var>tagToOrdinal_</var>. Because
81 tag data is basis specific, every concrete basis class requires its own implementation
82 of initializeTags().
83
84 \todo restore test for inclusion of reference points in their resective reference cells in
85 getValues_HGRAD_Args, getValues_CURL_Args, getValues_DIV_Args
86
87 */
88template<class Scalar, class ArrayScalar>
89class Basis {
90private:
91
94 virtual void initializeTags() = 0;
95
96protected:
97
105
107 http://trilinos.sandia.gov/packages/shards for definition of base cell topology.
108 */
109 shards::CellTopology basisCellTopology_;
110
114
117 ECoordinates basisCoordinates_;
118
119 /** \brief "true" if <var>tagToOrdinal_</var> and <var>ordinalToTag_</var> have been initialized
120 */
122
125 Rank-2 array with dimensions (basisCardinality_, 4) containing the DoF tags. This array
126 is left empty at instantiation and filled by initializeTags() only when tag data is
127 requested.
128
129 \li ordinalToTag_[DofOrd][0] = dim. of the subcell associated with the specified DoF
130 \li ordinalToTag_[DofOrd][1] = ordinal of the subcell defined in the cell topology
131 \li ordinalToTag_[DodOrd][2] = ordinal of the specified DoF relative to the subcell
132 \li ordinalToTag_[DofOrd][3] = total number of DoFs associated with the subcell
133 */
134 std::vector<std::vector<int> > ordinalToTag_;
135
138 Rank-3 array with dimensions (maxScDim + 1, maxScOrd + 1, maxDfOrd + 1), i.e., the
139 columnwise maximums of the 1st three columns in the DoF tag table for the basis plus 1.
140 For every triple (subscDim, subcOrd, subcDofOrd) that is valid DoF tag data this array
141 stores the corresponding DoF ordinal. If the triple does not correspond to tag data,
142 the array stores -1. This array is left empty at instantiation and filled by
143 initializeTags() only when tag data is requested.
144
145 \li tagToOrdinal_[subcDim][subcOrd][subcDofOrd] = Degree-of-freedom ordinal
146 */
147 std::vector<std::vector<std::vector<int> > > tagToOrdinal_;
148
149public:
150
153 virtual ~Basis() {}
154
155
174 virtual void getValues(ArrayScalar & outputValues,
175 const ArrayScalar & inputPoints,
176 const EOperator operatorType) const = 0;
177
178
198 virtual void getValues(ArrayScalar & outputValues,
199 const ArrayScalar & inputPoints,
200 const ArrayScalar & cellVertices,
201 const EOperator operatorType = OPERATOR_VALUE) const = 0;
202
207 virtual int getCardinality() const;
208
209
214 virtual int getDegree() const;
215
216
222 virtual const shards::CellTopology getBaseCellTopology() const;
223
224
229 virtual EBasis getBasisType() const;
230
231
236 virtual ECoordinates getCoordinateSystem() const;
237
238
247 virtual int getDofOrdinal(const int subcDim,
248 const int subcOrd,
249 const int subcDofOrd);
250
252 virtual const std::vector<std::vector<std::vector<int> > > &getDofOrdinalData( );
253
254
257 \param dofOrd [in] - ordinal of the DoF whose tag is being retrieved
258
259 \return reference to a vector with dimension (4) such that \n
260 \li element [0] = tag field 0 -> dim. of the subcell associated with the specified DoF
261 \li element [1] = tag field 1 -> ordinal of the subcell defined by cell topology
262 \li element [2] = tag field 2 -> ordinal of the specified DoF relative to the subcell
263 \li element [3] = tag field 3 -> total number of DoFs associated with the subcell
264 */
265 virtual const std::vector<int>& getDofTag(const int dofOrd);
266
267
276 virtual const std::vector<std::vector<int> >& getAllDofTags();
277
278
279
280
281}; // class Basis
282
283
284//--------------------------------------------------------------------------------------------//
285// //
286// Helper functions of the Basis class //
287// //
288//--------------------------------------------------------------------------------------------//
289
290//--------------------------------------------------------------------------------------------//
291// //
292// Argument checks //
293// //
294//--------------------------------------------------------------------------------------------//
295
306template<class Scalar, class ArrayScalar>
307void getValues_HGRAD_Args(ArrayScalar & outputValues,
308 const ArrayScalar & inputPoints,
309 const EOperator operatorType,
310 const shards::CellTopology& cellTopo,
311 const int basisCard);
312
323template<class Scalar, class ArrayScalar>
324void getValues_HCURL_Args(ArrayScalar & outputValues,
325 const ArrayScalar & inputPoints,
326 const EOperator operatorType,
327 const shards::CellTopology& cellTopo,
328 const int basisCard);
329
340template<class Scalar, class ArrayScalar>
341void getValues_HDIV_Args(ArrayScalar & outputValues,
342 const ArrayScalar & inputPoints,
343 const EOperator operatorType,
344 const shards::CellTopology& cellTopo,
345 const int basisCard);
346
347
352template<class ArrayScalar>
354public:
359 virtual ~DofCoordsInterface() = 0;
360
367 virtual void getDofCoords(ArrayScalar & DofCoords) const = 0;
368};
369
370
371// include templated definitions
372#include <Intrepid_BasisDef.hpp>
373
374
375}// namespace Intrepid
376
377
378//--------------------------------------------------------------------------------------------//
379// //
380// D O C U M E N T A T I O N P A G E S //
381// //
382//--------------------------------------------------------------------------------------------//
399
483#endif
484
485#if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
486#ifdef __GNUC__
487#warning "The Intrepid package is deprecated"
488#endif
489#endif
490
Implementation file for the abstract base class Intrepid::Basis.
void getValues_HDIV_Args(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType, const shards::CellTopology &cellTopo, const int basisCard)
Runtime check of the arguments for the getValues method in an HDIV-conforming FEM basis....
void getValues_HCURL_Args(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType, const shards::CellTopology &cellTopo, const int basisCard)
Runtime check of the arguments for the getValues method in an HCURL-conforming FEM basis....
void getValues_HGRAD_Args(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType, const shards::CellTopology &cellTopo, const int basisCard)
Runtime check of the arguments for the getValues method in an HGRAD-conforming FEM basis....
Contains definitions of custom data types in Intrepid.
Intrepid utilities.
virtual const std::vector< std::vector< std::vector< int > > > & getDofOrdinalData()
DoF tag to ordinal data structure.
virtual int getDofOrdinal(const int subcDim, const int subcOrd, const int subcDofOrd)
DoF tag to ordinal lookup.
virtual int getDegree() const
Returns the degree of the basis.
virtual ECoordinates getCoordinateSystem() const
Returns the type of coordinate system for which the basis is defined.
virtual const std::vector< std::vector< int > > & getAllDofTags()
Retrieves all DoF tags.
virtual const shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation http://trilin...
virtual const std::vector< int > & getDofTag(const int dofOrd)
DoF ordinal to DoF tag lookup.
virtual int getCardinality() const
Returns cardinality of the basis.
virtual EBasis getBasisType() const
Returns the basis type.
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
virtual void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const ArrayScalar &cellVertices, const EOperator operatorType=OPERATOR_VALUE) const =0
Evaluation of an FVD basis evaluation on a physical cell.
virtual void initializeTags()=0
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
bool basisTagsAreSet_
"true" if tagToOrdinal_ and ordinalToTag_ have been initialized
std::vector< std::vector< std::vector< int > > > tagToOrdinal_
DoF tag to ordinal lookup table.
virtual void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const =0
Evaluation of a FEM basis on a reference cell.
int basisCardinality_
Cardinality of the basis, i.e., the number of basis functions/degrees-of-freedom.
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
EBasis basisType_
Type of the basis.
int basisDegree_
Degree of the largest complete polynomial space that can be represented by the basis.
std::vector< std::vector< int > > ordinalToTag_
DoF ordinal to tag lookup table.
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package http://trilinos....
virtual ~Basis()
Destructor.
This is an interface class for bases whose degrees of freedom can be associated with spatial location...
virtual void getDofCoords(ArrayScalar &DofCoords) const =0
Returns spatial locations (coordinates) of degrees of freedom on a reference cell; defined for interp...
virtual ~DofCoordsInterface()=0
Pure virtual destructor (gives warnings if not included). Following "Effective C++: 3rd Ed....