BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
scalar_function_value_times_normal_functor.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 #ifndef fiber_scalar_function_value_times_normal_functor_hpp
22 #define fiber_scalar_function_value_times_normal_functor_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "basis_data.hpp"
27 #include "geometrical_data.hpp"
28 #include "collection_of_3d_arrays.hpp"
29 #include "shape_transformation_functor_wrappers.hpp"
30 
31 namespace Fiber
32 {
33 
34 template <typename CoordinateType_>
36 {
37 public:
38  typedef CoordinateType_ CoordinateType;
39 
40  int argumentDimension() const { return 1; }
41  int resultDimension() const { return 3; }
42 
43  void addDependencies(size_t& basisDeps, size_t& geomDeps) const {
44  basisDeps |= VALUES;
45  geomDeps |= NORMALS;
46  }
47 
48  template <typename ValueType>
49  void evaluate(
50  const ConstBasisDataSlice<ValueType>& basisData,
52  _1dSliceOf3dArray<ValueType>& result) const {
53  assert(basisData.componentCount() == 1);
54  const int dimWorld = geomData.dimWorld();
55  for (int dim = 0; dim < dimWorld; ++dim)
56  result(dim) = basisData.values(0) * geomData.normal(dim);
57  }
58 };
59 
60 // Note: in C++11 we'll be able to make a "template typedef", or more precisely
61 // a using declaration, instead of this spurious inheritance
65 template <typename CoordinateType_>
68  ScalarFunctionValueTimesNormalElementaryFunctor<CoordinateType_> >
69 {
70 public:
71  typedef CoordinateType_ CoordinateType;
72 };
73 
74 } // namespace Fiber
75 
76 #endif
Definition: shape_transformation_functor_wrappers.hpp:33
int componentCount() const
Return the number of components of the function.
Definition: basis_data.hpp:111
Lightweight encapsulation of a 1D slice of a 3D array.
Definition: _3d_array.hpp:155
ValueType values(int dim) const
Return the value of the dim&#39;th component of the function.
Definition: basis_data.hpp:100
Functor calculating the value of a scalar basis function multiplied by the unit vector normal to the ...
Definition: scalar_function_value_times_normal_functor.hpp:66
Access to slices of geometrical data.
Definition: geometrical_data.hpp:88
Access to values and/or derivatives of shape functions.
Definition: basis_data.hpp:91
Definition: scalar_function_value_times_normal_functor.hpp:35