1 #ifndef DUNE_FEM_SHAPEFUNCTIONSET_VECTORIAL_HH 2 #define DUNE_FEM_SHAPEFUNCTIONSET_VECTORIAL_HH 22 template<
class Scalar,
class Vectorial >
25 template<
class K,
int dimR >
31 typedef typename FieldTraits< VectorialType >::field_type
field_type;
33 typedef typename VectorialType::size_type
size_type;
35 static const size_type factor = dimR;
37 static ComponentType
begin () {
return ComponentType( 0 ); }
38 static ComponentType
end () {
return ComponentType( factor ); }
40 static VectorialType
zeroVectorial () {
return VectorialType( K( field_type( 0 ) ) ); }
42 static const K &
access (
const ScalarType &x ) {
return x[ 0 ]; }
43 static K &
access ( ScalarType &x ) {
return x[ 0 ]; }
45 static const K &
access (
const VectorialType &x,
const ComponentType &i ) {
return x[ i ]; }
46 static K &
access ( VectorialType &x,
const ComponentType &i ) {
return x[ i ]; }
48 static size_type
index (
const ComponentType &i ) {
return i; }
51 template<
class K,
int dimR,
int dimD >
57 typedef typename FieldTraits< VectorialType >::field_type
field_type;
59 typedef typename VectorialType::size_type
size_type;
61 static const size_type factor = dimR;
63 static ComponentType
begin () {
return ComponentType( 0 ); }
64 static ComponentType
end () {
return ComponentType( factor ); }
66 static VectorialType
zeroVectorial () {
return VectorialType( K( field_type( 0 ) ) ); }
68 static const FieldVector< K, dimD > &
access (
const ScalarType &x ) {
return x[ 0 ]; }
69 static FieldVector< K, dimD > &
access ( ScalarType &x ) {
return x[ 0 ]; }
71 static const FieldVector< K, dimD > &
access (
const VectorialType &x,
const ComponentType &i ) {
return x[ i ]; }
72 static FieldVector< K, dimD > &
access ( VectorialType &x,
const ComponentType &i ) {
return x[ i ]; }
74 static size_type
index (
const ComponentType &i ) {
return i; }
82 template<
class Scalar,
class Vectorial >
98 : component_( component ),
102 operator VectorialType ()
const 104 VectorialType vectorial = Traits::zeroVectorial();
105 Traits::access( vectorial, component() ) = Traits::access( scalar() );
109 const ThisType &operator*= (
const field_type &s )
115 const ThisType &operator/= (
const field_type &s )
121 const ComponentType &
component ()
const {
return component_; }
123 const ScalarType &
scalar ()
const {
return scalar_; }
124 ScalarType &
scalar () {
return scalar_; }
136 template<
class Scalar,
class Vectorial >
148 : BaseType( component, scalar )
152 template<
class K,
int dimR >
167 using BaseType::component;
168 using BaseType::scalar;
171 : BaseType( component, scalar )
176 return (component() == other.
component() ? scalar() * other.
scalar() : field_type( 0 ));
179 field_type
operator* (
const VectorialType &other )
const 181 return (scalar()[ 0 ] * other[ component() ]);
184 field_type
one_norm ()
const {
return scalar().one_norm(); }
185 field_type
two_norm ()
const {
return scalar().two_norm(); }
186 field_type
two_norm2 ()
const {
return scalar().two_norm2(); }
189 size_type
size ()
const {
return dimR; }
191 friend field_type
operator* (
const VectorialType &a, ThisType &b ) {
return b*a; }
194 template<
class K,
int dimR,
int dimD >
209 using BaseType::component;
210 using BaseType::scalar;
213 : BaseType( component, scalar )
216 template<
class X,
class Y >
217 void mv (
const X &x, Y &y )
const 219 for( size_type i = 0; i < rows(); ++i )
220 y[ i ] = field_type( 0 );
221 for( size_type j= 0; j < cols(); ++j )
222 y[ component() ] += scalar()[ component() ][ j ] * x[ j ];
225 template<
class X,
class Y >
226 void mtv (
const X &x, Y &y )
const 228 for( size_type i = 0; i < rows(); ++i )
229 y[ i ] = scalar()[ i ][ component() ] * x[ component() ];
232 template<
class X,
class Y >
233 void umv (
const X &x, Y &y )
const 235 for( size_type j= 0; j < cols(); ++j )
236 y[ component() ] += scalar()[ component() ][ j ] * x[ j ];
239 template<
class X,
class Y >
240 void umtv (
const X &x, Y &y )
const 242 for( size_type i = 0; i < rows(); ++i )
243 y[ i ] += scalar()[ i ][ component() ] * x[ component() ];
246 template<
class X,
class Y >
247 void mmv (
const X &x, Y &y )
const 249 for( size_type j= 0; j < cols(); ++j )
250 y[ component() ] -= scalar()[ component() ][ j ] * x[ j ];
253 template<
class X,
class Y >
254 void mmtv (
const X &x, Y &y )
const 256 for( size_type i = 0; i < rows(); ++i )
257 y[ i ] -= scalar()[ i ][ component() ] * x[ component() ];
266 size_type
N ()
const {
return rows(); }
267 size_type
M ()
const {
return cols(); }
269 size_type
rows ()
const {
return dimR; }
270 size_type
cols ()
const {
return scalar().cols(); }
278 template<
class Scalar,
class Vectorial >
286 template<
class Scalar,
class Vectorial >
294 template<
class Scalar,
class Vectorial >
299 return (a == static_cast< Vectorial >( b ));
302 template<
class Scalar,
class Vectorial >
307 return (a != static_cast< Vectorial >( b ));
310 template<
class Scalar,
class Vectorial >
315 return (static_cast< Vectorial >( a ) == b);
318 template<
class Scalar,
class Vectorial >
323 return (static_cast< Vectorial >( a ) != b);
326 template<
class Scalar,
class Vectorial >
336 template<
class GeometryJacobianInverseTransposed,
class K,
int ROWS >
338 const MakeVectorialExpression< FieldMatrix< K, 1, GeometryJacobianInverseTransposed::cols >, FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::cols > > &a,
339 FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::rows > &b )
343 b = RgTraits::zeroVectorial();
344 gjit.mv( Traits::access( a.scalar() ), b[ a.component() ] );
347 template<
class GeometryJacobianInverseTransposed,
class K,
int SIZE >
349 const MakeVectorialExpression< FieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::cols, GeometryJacobianInverseTransposed::cols >, 1 >, FieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::cols, GeometryJacobianInverseTransposed::cols >, SIZE > > &a,
350 FieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::rows, GeometryJacobianInverseTransposed::rows >, SIZE > &b )
352 const int dimLocal = GeometryJacobianInverseTransposed::cols;
353 const int dimGlobal = GeometryJacobianInverseTransposed::rows;
357 b = RgTraits::zeroVectorial();
360 FieldMatrix< K, dimLocal, dimGlobal > c;
361 for(
int i = 0; i < dimLocal; ++i )
362 gjit.mv( Traits::access( a.scalar() )[ i ], c[ i ] );
365 for(
int i = 0; i < dimGlobal; ++i )
373 for(
int k = 0; k < GeometryJacobianInverseTransposed::cols; ++k )
375 FieldVector< K, GeometryJacobianInverseTransposed::rows > c;
376 gjit.mv( Traits::access( a.scalar() )[ k ], c );
377 for(
int j = 0; j < GeometryJacobianInverseTransposed::rows; ++j )
378 RgTraits::access( b, a.component() )[ j ].
axpy( gjit[ j ][ k ], c );
383 template<
class Scalar,
class Vectorial >
391 template<
class Scalar,
class Vectorial >
399 template<
class Scalar,
class Vectorial >
413 template<
class ScalarFunctionSpace,
class RangeVector >
416 template<
class DomainField,
class RangeField,
int dimD,
int dimR >
427 template<
class ScalarShapeFunctionSet,
class RangeVector >
440 template<
class Functor,
class Vectorial >
446 template<
class ... Args >
448 : scalarShapeFunctionSet_(
std::forward< Args > ( args ) ... )
452 : scalarShapeFunctionSet_( scalarShapeFunctionSet )
457 int order ()
const {
return scalarShapeFunctionSet().order(); }
460 std::size_t
size ()
const {
return dimRangeFactor * scalarShapeFunctionSet().size(); }
462 template<
class Po
int,
class Functor >
463 void evaluateEach (
const Point &x, Functor functor )
const;
465 template<
class Po
int,
class Functor >
466 void jacobianEach (
const Point &x, Functor functor )
const;
468 template<
class Po
int,
class Functor >
469 void hessianEach (
const Point &x, Functor functor )
const;
480 template<
class ScalarShapeFunctionSet,
class RangeVector >
481 template<
class Functor,
class Vectorial >
485 : functor_( functor )
488 template<
class Scalar >
489 void operator() (
const std::size_t i,
const Scalar &value )
493 const typename Traits::ComponentType end = Traits::end();
494 for(
typename Traits::ComponentType k = Traits::begin(); k != end; ++k )
495 functor_( i*Traits::factor + Traits::index( k ), Expression( k, value ) );
507 template<
class ScalarShapeFunctionSet,
class RangeVector >
508 template<
class Po
int,
class Functor >
512 typedef typename FunctionSpaceType::RangeType VectorialType;
517 template<
class ScalarShapeFunctionSet,
class RangeVector >
518 template<
class Po
int,
class Functor >
522 typedef typename FunctionSpaceType::JacobianRangeType VectorialType;
527 template<
class ScalarShapeFunctionSet,
class RangeVector >
528 template<
class Po
int,
class Functor >
532 typedef typename FunctionSpaceType::HessianRangeType VectorialType;
540 #endif // #ifndef DUNE_FEM_SHAPEFUNCTIONSET_VECTORIAL_HH static const FieldVector< K, dimD > & access(const VectorialType &x, const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:71
ComponentType component_
Definition: shapefunctionset/vectorial.hh:127
field_type two_norm2() const
Definition: shapefunctionset/vectorial.hh:186
FieldVector< K, dimR > VectorialType
Definition: shapefunctionset/vectorial.hh:29
void mmtv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:254
void mv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:217
field_type frobenius_norm2() const
Definition: shapefunctionset/vectorial.hh:261
size_type size() const
Definition: shapefunctionset/vectorial.hh:189
FunctionSpace< DomainField, RangeField, dimD, dimR > Type
Definition: shapefunctionset/vectorial.hh:419
MakeVectorialExpression(const ComponentType &component, const ScalarType &scalar)
Definition: shapefunctionset/vectorial.hh:170
const ComponentType & component() const
Definition: shapefunctionset/vectorial.hh:121
Definition: shapefunctionset/vectorial.hh:137
static const FieldVector< K, dimD > & access(const ScalarType &x)
Definition: shapefunctionset/vectorial.hh:68
size_type rows() const
Definition: shapefunctionset/vectorial.hh:269
static size_type index(const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:74
A vector valued function space.
Definition: functionspace.hh:16
VectorialShapeFunctionSet(Args &&...args)
Definition: shapefunctionset/vectorial.hh:447
ScalarShapeFunctionSet scalarShapeFunctionSet_
Definition: shapefunctionset/vectorial.hh:472
VectorialType::size_type size_type
Definition: shapefunctionset/vectorial.hh:33
Definition: shapefunctionset/vectorial.hh:23
VectorialType::size_type size_type
Definition: shapefunctionset/vectorial.hh:59
BaseType::field_type field_type
Definition: shapefunctionset/vectorial.hh:163
field_type two_norm() const
Definition: shapefunctionset/vectorial.hh:185
MakeVectorialExpression(const ComponentType &component, const ScalarType &scalar)
Definition: shapefunctionset/vectorial.hh:212
Definition: shapefunctionset/vectorial.hh:428
BasicMakeVectorialExpression(const ComponentType &component, const ScalarType &scalar)
Definition: shapefunctionset/vectorial.hh:97
FieldTraits< VectorialType >::field_type field_type
Definition: shapefunctionset/vectorial.hh:57
BaseType::ComponentType ComponentType
Definition: shapefunctionset/vectorial.hh:206
size_type cols() const
Definition: shapefunctionset/vectorial.hh:270
Traits::ScalarType ScalarType
Definition: shapefunctionset/vectorial.hh:90
ScalarType & scalar()
Definition: shapefunctionset/vectorial.hh:124
void jacobianEach(const Point &x, Functor functor) const
Definition: shapefunctionset/vectorial.hh:520
static ComponentType end()
Definition: shapefunctionset/vectorial.hh:64
const ScalarShapeFunctionSetType & scalarShapeFunctionSet() const
Definition: shapefunctionset/vectorial.hh:455
void mtv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:226
size_type M() const
Definition: shapefunctionset/vectorial.hh:267
ScalarType scalar_
Definition: shapefunctionset/vectorial.hh:128
static VectorialType zeroVectorial()
Definition: shapefunctionset/vectorial.hh:40
void hessianEach(const Point &x, Functor functor) const
Definition: shapefunctionset/vectorial.hh:530
static K & access(ScalarType &x)
Definition: shapefunctionset/vectorial.hh:43
void hessianTransformation(const GeometryJacobianInverseTransposed &gjit, const FieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::cols, GeometryJacobianInverseTransposed::cols >, SIZE > &a, FieldVector< FieldMatrix< K, GeometryJacobianInverseTransposed::rows, GeometryJacobianInverseTransposed::rows >, SIZE > &b)
Definition: transformation.hh:59
const ScalarType & scalar() const
Definition: shapefunctionset/vectorial.hh:123
MakeVectorialExpression(const ComponentType &component, const ScalarType &scalar)
Definition: shapefunctionset/vectorial.hh:147
BaseType::size_type size_type
Definition: shapefunctionset/vectorial.hh:165
void axpy(const T &a, const T &x, T &y)
Definition: space/basisfunctionset/functor.hh:37
FieldVector< K, 1 > ScalarType
Definition: shapefunctionset/vectorial.hh:28
static const K & access(const VectorialType &x, const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:45
BaseType::ScalarType ScalarType
Definition: shapefunctionset/vectorial.hh:145
static ComponentType end()
Definition: shapefunctionset/vectorial.hh:38
field_type infinity_norm() const
Definition: shapefunctionset/vectorial.hh:187
Traits::VectorialType VectorialType
Definition: shapefunctionset/vectorial.hh:91
bool operator!=(const Double &a, const Double &b)
Definition: double.hh:629
std::size_t size() const
Definition: shapefunctionset/vectorial.hh:460
FieldMatrix< K, 1, dimD > ScalarType
Definition: shapefunctionset/vectorial.hh:54
static VectorialType zeroVectorial()
Definition: shapefunctionset/vectorial.hh:66
bool operator==(const Double &a, const Double &b)
Definition: double.hh:589
VectorialFunctor(const Functor &functor)
Definition: shapefunctionset/vectorial.hh:484
ToNewRange< ScalarFunctionSpaceType, RangeVector >::Type FunctionSpaceType
Definition: shapefunctionset/vectorial.hh:441
Definition: coordinate.hh:4
Definition: shapefunctionset/vectorial.hh:83
BaseType::ComponentType ComponentType
Definition: shapefunctionset/vectorial.hh:164
field_type frobenius_norm() const
Definition: shapefunctionset/vectorial.hh:260
FieldTraits< VectorialType >::field_type field_type
Definition: shapefunctionset/vectorial.hh:31
Definition: shapefunctionset/vectorial.hh:153
static K & access(VectorialType &x, const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:46
Definition: shapefunctionset/vectorial.hh:441
void jacobianTransformation(const GeometryJacobianInverseTransposed &gjit, const FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::cols > &a, FieldMatrix< K, ROWS, GeometryJacobianInverseTransposed::rows > &b)
Definition: transformation.hh:20
BaseType::ComponentType ComponentType
Definition: shapefunctionset/vectorial.hh:144
static size_type index(const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:48
Double operator*(const Double &a, const Double &b)
Definition: double.hh:495
field_type one_norm() const
Definition: shapefunctionset/vectorial.hh:184
Traits::ComponentType ComponentType
Definition: shapefunctionset/vectorial.hh:94
static FieldVector< K, dimD > & access(VectorialType &x, const ComponentType &i)
Definition: shapefunctionset/vectorial.hh:72
BaseType::ScalarType ScalarType
Definition: shapefunctionset/vectorial.hh:202
BaseType::VectorialType VectorialType
Definition: shapefunctionset/vectorial.hh:203
FieldMatrix< K, dimR, dimD > VectorialType
Definition: shapefunctionset/vectorial.hh:55
static const K & access(const ScalarType &x)
Definition: shapefunctionset/vectorial.hh:42
Definition: fmatrixcol.hh:16
Traits::size_type size_type
Definition: shapefunctionset/vectorial.hh:95
field_type determinant() const
Definition: shapefunctionset/vectorial.hh:264
void evaluateEach(const Point &x, Functor functor) const
Definition: shapefunctionset/vectorial.hh:510
void umtv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:240
static ComponentType begin()
Definition: shapefunctionset/vectorial.hh:37
BaseType::ScalarType ScalarType
Definition: shapefunctionset/vectorial.hh:160
static ComponentType begin()
Definition: shapefunctionset/vectorial.hh:63
Definition: shapefunctionset/vectorial.hh:414
ScalarShapeFunctionSetType::FunctionSpaceType ScalarFunctionSpaceType
Definition: shapefunctionset/vectorial.hh:436
VectorialType::size_type ComponentType
Definition: shapefunctionset/vectorial.hh:32
VectorialType::size_type ComponentType
Definition: shapefunctionset/vectorial.hh:58
BaseType::field_type field_type
Definition: shapefunctionset/vectorial.hh:205
static FieldVector< K, dimD > & access(ScalarType &x)
Definition: shapefunctionset/vectorial.hh:69
void mmv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:247
Definition: shapefunctionset/vectorial.hh:195
ScalarShapeFunctionSet ScalarShapeFunctionSetType
Definition: shapefunctionset/vectorial.hh:433
void umv(const X &x, Y &y) const
Definition: shapefunctionset/vectorial.hh:233
BaseType::VectorialType VectorialType
Definition: shapefunctionset/vectorial.hh:161
int order() const
Definition: shapefunctionset/vectorial.hh:457
double scalarProduct(const double &a, const double &b)
Definition: space/basisfunctionset/functor.hh:64
BaseType::size_type size_type
Definition: shapefunctionset/vectorial.hh:207
size_type N() const
Definition: shapefunctionset/vectorial.hh:266
Traits::field_type field_type
Definition: shapefunctionset/vectorial.hh:93
field_type infinity_norm() const
Definition: shapefunctionset/vectorial.hh:262
VectorialShapeFunctionSet(const ScalarShapeFunctionSetType &scalarShapeFunctionSet)
Definition: shapefunctionset/vectorial.hh:451