BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
default_collection_of_shapeset_transformations_imp.hpp
1 // Copyright (C) 2011-2012 by the BEM++ Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #include "default_collection_of_shapeset_transformations.hpp"
22 
23 namespace Fiber
24 {
25 
26 template <typename Functor>
28  size_t& basisDeps, size_t& geomDeps) const
29 {
30  m_functor.addDependencies(basisDeps, geomDeps);
31 }
32 
33 template <typename Functor>
36 {
37  return m_functor.transformationCount();
38 }
39 
40 template <typename Functor>
43 {
44  return m_functor.argumentDimension();
45 }
46 
47 template <typename Functor>
49 resultDimension(int transformationIndex) const
50 {
51  return m_functor.resultDimension(transformationIndex);
52 }
53 
54 template <typename Functor>
55 template <typename ValueType>
57  const BasisData<ValueType>& basisData,
58  const GeometricalData<CoordinateType>& geomData,
59  CollectionOf3dArrays<ValueType>& result) const
60 {
61  const int pointCount = basisData.pointCount();
62  const int functionCount = basisData.functionCount();
63  const int transformationCount = m_functor.transformationCount();
64  result.set_size(transformationCount);
65  for (int t = 0; t < transformationCount; ++t)
66  result[t].set_size(m_functor.resultDimension(t),
67  functionCount,
68  pointCount);
69 
70  for (int p = 0; p < pointCount; ++p)
71  for (int f = 0; f < functionCount; ++f)
72  m_functor.evaluate(basisData.const_slice(f, p),
73  geomData.const_slice(p),
74  result.slice(f, p).self());
75 }
76 
77 template <typename Functor>
78 void DefaultCollectionOfShapesetTransformations<Functor>::evaluateImplReal(
79  const BasisData<CoordinateType>& basisData,
80  const GeometricalData<CoordinateType>& geomData,
81  CollectionOf3dArrays<CoordinateType>& result) const
82 {
83  evaluateImpl(basisData, geomData, result);
84 }
85 
86 template <typename Functor>
87 void DefaultCollectionOfShapesetTransformations<Functor>::evaluateImplComplex(
88  const BasisData<ComplexType>& basisData,
89  const GeometricalData<CoordinateType>& geomData,
90  CollectionOf3dArrays<ComplexType>& result) const
91 {
92  evaluateImpl(basisData, geomData, result);
93 }
94 
95 } // namespace Fiber
int functionCount() const
Return number of shape functions.
Definition: basis_data.hpp:67
ConstBasisDataSlice< ValueType > const_slice(int function, int point) const
Return a constant slice of the data, corresponding to a given shape function and point.
Definition: basis_data.hpp:79
int pointCount() const
Return number of points at which the shape functions have been calculated.
Definition: basis_data.hpp:73
Storage of geometrical data.
Definition: geometrical_data.hpp:54
Definition: collection_of_3d_arrays.hpp:39
Default implementation of a collection of shape function transformations.
Definition: default_collection_of_shapeset_transformations.hpp:77
virtual int resultDimension(int transformationIndex) const
Return the number of components of the result of i&#39;th transformation.
Definition: default_collection_of_shapeset_transformations_imp.hpp:49
virtual void addDependencies(size_t &basisDeps, size_t &geomDeps) const
Retrieve the types of data on which the transformations depend.
Definition: default_collection_of_shapeset_transformations_imp.hpp:27
Storage of values and/or derivatives of shape functions.
Definition: basis_data.hpp:44
virtual int transformationCount() const
Return the number of transformations belonging to the collection.
Definition: default_collection_of_shapeset_transformations_imp.hpp:35
virtual int argumentDimension() const
Return the number of components of shape functions acted upon.
Definition: default_collection_of_shapeset_transformations_imp.hpp:42