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 
49 #ifndef INTREPID_BASIS_HPP
50 #define INTREPID_BASIS_HPP
51 #include "Intrepid_ConfigDefs.hpp"
52 #include "Intrepid_Types.hpp"
53 #include "Intrepid_Utils.hpp"
54 #include "Shards_CellTopology.hpp"
55 
56 namespace Intrepid {
57 
88 template<class Scalar, class ArrayScalar>
89 class Basis {
90 private:
91 
94  virtual void initializeTags() = 0;
95 
96 protected:
97 
101 
105 
109  shards::CellTopology basisCellTopology_;
110 
113  EBasis basisType_;
114 
117  ECoordinates basisCoordinates_;
118 
122 
134  std::vector<std::vector<int> > ordinalToTag_;
135 
147  std::vector<std::vector<std::vector<int> > > tagToOrdinal_;
148 
149 public:
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 
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 
306 template<class Scalar, class ArrayScalar>
307 void getValues_HGRAD_Args(ArrayScalar & outputValues,
308  const ArrayScalar & inputPoints,
309  const EOperator operatorType,
310  const shards::CellTopology& cellTopo,
311  const int basisCard);
312 
323 template<class Scalar, class ArrayScalar>
324 void getValues_HCURL_Args(ArrayScalar & outputValues,
325  const ArrayScalar & inputPoints,
326  const EOperator operatorType,
327  const shards::CellTopology& cellTopo,
328  const int basisCard);
329 
340 template<class Scalar, class ArrayScalar>
341 void getValues_HDIV_Args(ArrayScalar & outputValues,
342  const ArrayScalar & inputPoints,
343  const EOperator operatorType,
344  const shards::CellTopology& cellTopo,
345  const int basisCard);
346 
347 
352 template<class ArrayScalar>
354 public:
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 //--------------------------------------------------------------------------------------------//
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 
virtual ~Basis()
Destructor.
virtual EBasis getBasisType() const
Returns the basis type.
virtual const std::vector< int > & getDofTag(const int dofOrd)
DoF ordinal to DoF tag lookup.
virtual int getCardinality() const
Returns cardinality of the basis.
This is an interface class for bases whose degrees of freedom can be associated with spatial location...
EBasis basisType_
Type of the basis.
virtual const std::vector< std::vector< int > > & getAllDofTags()
Retrieves all DoF tags.
virtual ECoordinates getCoordinateSystem() const
Returns the type of coordinate system for which the basis is defined.
Contains definitions of custom data types in Intrepid.
bool basisTagsAreSet_
&quot;true&quot; if tagToOrdinal_ and ordinalToTag_ have been initialized
virtual void getDofCoords(ArrayScalar &DofCoords) const =0
Returns spatial locations (coordinates) of degrees of freedom on a reference cell; defined for interp...
ECoordinates basisCoordinates_
The coordinate system for which the basis is defined.
Intrepid utilities.
virtual ~DofCoordsInterface()=0
Pure virtual destructor (gives warnings if not included). Following &quot;Effective C++: 3rd Ed...
Implementation file for the abstract base class Intrepid::Basis.
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
shards::CellTopology basisCellTopology_
Base topology of the cells for which the basis is defined. See the Shards package http://trilinos...
virtual int getDegree() const
Returns the degree of the basis.
virtual int getDofOrdinal(const int subcDim, const int subcOrd, const int subcDofOrd)
DoF tag to ordinal lookup.
virtual void getValues(ArrayScalar &outputValues, const ArrayScalar &inputPoints, const EOperator operatorType) const =0
Evaluation of a FEM basis on a reference cell.
virtual const shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation http://trilin...
int basisDegree_
Degree of the largest complete polynomial space that can be represented by the basis.
virtual void initializeTags()=0
Initializes tagToOrdinal_ and ordinalToTag_ lookup arrays.
std::vector< std::vector< std::vector< int > > > tagToOrdinal_
DoF tag to ordinal lookup table.
int basisCardinality_
Cardinality of the basis, i.e., the number of basis functions/degrees-of-freedom. ...
virtual const std::vector< std::vector< std::vector< int > > > & getDofOrdinalData()
DoF tag to ordinal data structure.
std::vector< std::vector< int > > ordinalToTag_
DoF ordinal to tag lookup table.