40 #include<lifev/core/array/VectorSmall.hpp> 41 #include<lifev/core/array/MatrixSmall.hpp> 43 #define PI 3.14159265359
53 Real thetaFiber ( 0.0 );
57 Real thetaRotation(0);
58 Real thetaPosition(0);
59 thetaFree = std::atan( z / ( x - xT ) );
60 thetaPosition = thetaFree;
63 thetaPosition = thetaFree +
PI;
64 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
68 thetaRotation = thetaFree -
PI/2.0;
77 Real thetaFiber ( 0.0 );
81 Real thetaRotation(0);
82 Real thetaPosition(0);
83 thetaFree = std::atan( z / ( x - xT ) );
84 thetaPosition = thetaFree;
87 thetaPosition = thetaFree +
PI;
88 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
92 thetaRotation = thetaFree -
PI/2.0;
114 Real thetaFiber ( theta );
118 Real thetaRotation(0);
119 Real thetaPosition(0);
120 thetaFree = std::atan( z / ( x - xT ) );
121 thetaPosition = thetaFree;
124 thetaPosition = thetaFree +
PI;
125 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
129 thetaRotation = thetaFree -
PI/2.0;
134 xCenter = rT * std::cos( thetaPosition ) + xT;
135 zCenter = rT * std::sin( thetaPosition );
138 positionCenter
[0
] = xCenter;
139 positionCenter
[1
] = 0;
140 positionCenter
[2
] = zCenter;
147 MatrixSmall<3,3> changeOfVariable;
148 changeOfVariable(0,0) = std::cos( thetaRotation ); changeOfVariable(0,1) = 0.0; changeOfVariable(0,2) = std::sin( thetaRotation );
149 changeOfVariable(1,0) = 0.0; changeOfVariable(1,1) = 1.0; changeOfVariable(1,2) = 0.0;
150 changeOfVariable(2,0) = -std::sin( thetaRotation ); changeOfVariable(2,1) = 0.0; changeOfVariable(2,2) = std::cos( thetaRotation );
153 localPosition = changeOfVariable * ( position - positionCenter );
155 Real thetaPositionOnSection(0);
156 thetaPositionOnSection = std::atan( localPosition
[2
] / localPosition
[1
] );
158 if ( localPosition
[1
] < 0 )
159 thetaPositionOnSection +=
PI;
162 localFibers
[0
] = std::sin( thetaFiber );
163 localFibers
[1
] = std::cos( thetaFiber ) * std::sin( thetaPositionOnSection );
164 localFibers
[2
] = - std::cos( thetaFiber ) * std::cos( thetaPositionOnSection );
167 originFibers = changeOfVariable.transpose() * localFibers + positionCenter;
178 return originFibers
[0
];
188 return originFibers
[1
];
198 return originFibers
[2
];
204 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
214 Real thetaFiber (
PI / 2.0 );
218 Real thetaRotation(0);
219 Real thetaPosition(0);
220 thetaFree = std::atan( z / ( x - xT ) );
221 thetaPosition = thetaFree;
224 thetaPosition = thetaFree +
PI;
225 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
229 thetaRotation = thetaFree -
PI/2.0;
238 centerSphere
[0
] = 0.138;
239 centerSphere
[1
] = 0.0;
240 centerSphere
[2
] = 0.185;
243 centerOnTorusAxis
[0
] = rT * std::cos( thetaPosition ) + xT;
244 centerOnTorusAxis
[1
] = 0.0;
245 centerOnTorusAxis
[2
] = rT * std::sin( thetaPosition );
251 if( ( ( position
- centerSphere )
.norm() ) <= 0.05 )
254 tangentVectorToAxisTorus
[0
] = std::sin( thetaPosition ) ;
255 tangentVectorToAxisTorus
[1
] = 0.0;
256 tangentVectorToAxisTorus
[2
] = -std::cos( thetaPosition );
259 centerSphereOnSection
= centerSphere
- ( ( centerSphere
- centerOnTorusAxis )
.dot( tangentVectorToAxisTorus
) )
* tangentVectorToAxisTorus;
261 xCenter = centerSphereOnSection
[0
];
262 yCenter = centerSphereOnSection
[1
];
263 zCenter = centerSphereOnSection
[2
];
267 xCenter = centerOnTorusAxis
[0
];
268 yCenter = centerOnTorusAxis
[1
];
269 zCenter = centerOnTorusAxis
[2
];
273 MatrixSmall<3,3> changeOfVariable;
274 changeOfVariable(0,0) = std::cos( thetaRotation ); changeOfVariable(0,1) = 0.0; changeOfVariable(0,2) = std::sin( thetaRotation );
275 changeOfVariable(1,0) = 0.0; changeOfVariable(1,1) = 1.0; changeOfVariable(1,2) = 0.0;
276 changeOfVariable(2,0) = -std::sin( thetaRotation ); changeOfVariable(2,1) = 0.0; changeOfVariable(2,2) = std::cos( thetaRotation );
279 positionCenter
[0
] = xCenter;
280 positionCenter
[1
] = yCenter;
281 positionCenter
[2
] = zCenter;
284 localPosition = changeOfVariable * ( position - positionCenter );
286 Real thetaPositionOnSection(0);
287 thetaPositionOnSection = std::atan( localPosition
[2
] / localPosition
[1
] );
289 if ( localPosition
[1
] < 0 )
290 thetaPositionOnSection +=
PI;
293 localFibers
[0
] = std::sin( thetaFiber );
294 localFibers
[1
] = std::cos( thetaFiber ) * std::sin( thetaPositionOnSection );
295 localFibers
[2
] = - std::cos( thetaFiber ) * std::cos( thetaPositionOnSection );
298 originFibers = changeOfVariable.transpose() * localFibers + positionCenter;
309 return originFibers
[0
];
319 return originFibers
[1
];
329 return originFibers
[2
];
335 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
345 Real thetaFiber ( 0.0 );
349 Real thetaRotation(0);
350 Real thetaPosition(0);
351 thetaFree = std::atan( z / ( x - xT ) );
352 thetaPosition = thetaFree;
355 thetaPosition = thetaFree +
PI;
356 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
360 thetaRotation = thetaFree -
PI/2.0;
365 xCenter = rT * std::cos( thetaPosition ) + xT;
366 zCenter = rT * std::sin( thetaPosition );
389 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
401 Real thetaFiber ( 0.0 );
405 Real thetaRotation(0);
406 Real thetaPosition(0);
407 thetaFree = std::atan( z / ( x - xT ) );
408 thetaPosition = thetaFree;
411 thetaPosition = thetaFree +
PI;
412 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
416 thetaRotation = thetaFree -
PI/2.0;
425 centerSphere
[0
] = 0.138;
426 centerSphere
[1
] = 0.0;
427 centerSphere
[2
] = 0.185;
430 centerOnTorusAxis
[0
] = rT * std::cos( thetaPosition ) + xT;
431 centerOnTorusAxis
[1
] = 0.0;
432 centerOnTorusAxis
[2
] = rT * std::sin( thetaPosition );
438 if( ( ( position
- centerSphere )
.norm() ) <= 0.05 )
441 tangentVectorToAxisTorus
[0
] = std::sin( thetaPosition ) ;
442 tangentVectorToAxisTorus
[1
] = 0.0;
443 tangentVectorToAxisTorus
[2
] = -std::cos( thetaPosition );
446 centerSphereOnSection
= centerSphere
- ( ( centerSphere
- centerOnTorusAxis )
.dot( tangentVectorToAxisTorus
) )
* tangentVectorToAxisTorus;
448 xCenter = centerSphereOnSection
[0
];
449 yCenter = centerSphereOnSection
[1
];
450 zCenter = centerSphereOnSection
[2
];
454 xCenter = centerOnTorusAxis
[0
];
455 yCenter = centerOnTorusAxis
[1
];
456 zCenter = centerOnTorusAxis
[2
];
460 MatrixSmall<3,3> changeOfVariable;
461 changeOfVariable(0,0) = std::cos( thetaRotation ); changeOfVariable(0,1) = 0.0; changeOfVariable(0,2) = std::sin( thetaRotation );
462 changeOfVariable(1,0) = 0.0; changeOfVariable(1,1) = 1.0; changeOfVariable(1,2) = 0.0;
463 changeOfVariable(2,0) = -std::sin( thetaRotation ); changeOfVariable(2,1) = 0.0; changeOfVariable(2,2) = std::cos( thetaRotation );
466 positionCenter
[0
] = xCenter;
467 positionCenter
[1
] = yCenter;
468 positionCenter
[2
] = zCenter;
471 localPosition = changeOfVariable * ( position - positionCenter );
479 return localPosition
[0
];
485 return localPosition
[1
];
491 return localPosition
[2
];
496 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
506 Real thetaFiber ( 0.0 );
510 Real thetaRotation(0);
511 Real thetaPosition(0);
512 thetaFree = std::atan( z / ( x - xT ) );
513 thetaPosition = thetaFree;
516 thetaPosition = thetaFree +
PI;
517 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
521 thetaRotation = thetaFree -
PI/2.0;
526 xCenter = rT * std::cos( thetaPosition ) + xT;
527 zCenter = rT * std::sin( thetaPosition );
530 positionCenter
[0
] = xCenter;
531 positionCenter
[1
] = 0;
532 positionCenter
[2
] = zCenter;
539 MatrixSmall<3,3> changeOfVariable;
540 changeOfVariable(0,0) = std::cos( thetaRotation ); changeOfVariable(0,1) = 0.0; changeOfVariable(0,2) = std::sin( thetaRotation );
541 changeOfVariable(1,0) = 0.0; changeOfVariable(1,1) = 1.0; changeOfVariable(1,2) = 0.0;
542 changeOfVariable(2,0) = -std::sin( thetaRotation ); changeOfVariable(2,1) = 0.0; changeOfVariable(2,2) = std::cos( thetaRotation );
545 localPosition = changeOfVariable * ( position - positionCenter );
551 return localPosition
[0
];
557 return localPosition
[1
];
563 return localPosition
[2
];
568 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
585 centerSphere
[0
] = 0.138;
586 centerSphere
[1
] = 0.0;
587 centerSphere
[2
] = 0.185;
589 if( ( ( position
- centerSphere )
.norm() ) <= ( 0.05 ) )
604 Real thetaFiber ( 0.0 );
608 Real thetaRotation(0);
609 Real thetaPosition(0);
610 thetaFree = std::atan( z / ( x - xT ) );
611 thetaPosition = thetaFree;
614 thetaPosition = thetaFree +
PI;
615 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
619 thetaRotation = thetaFree -
PI/2.0;
628 centerSphere
[0
] = 0.138;
629 centerSphere
[1
] = 0.0;
630 centerSphere
[2
] = 0.185;
633 centerOnTorusAxis
[0
] = rT * std::cos( thetaPosition ) + xT;
634 centerOnTorusAxis
[1
] = 0.0;
635 centerOnTorusAxis
[2
] = rT * std::sin( thetaPosition );
641 if( ( ( position
- centerSphere )
.norm() ) <= 0.05 )
644 tangentVectorToAxisTorus
[0
] = std::sin( thetaPosition ) ;
645 tangentVectorToAxisTorus
[1
] = 0.0;
646 tangentVectorToAxisTorus
[2
] = -std::cos( thetaPosition );
649 centerSphereOnSection
= centerSphere
- ( ( centerSphere
- centerOnTorusAxis )
.dot( tangentVectorToAxisTorus
) )
* tangentVectorToAxisTorus;
651 xCenter = centerSphereOnSection
[0
];
652 yCenter = centerSphereOnSection
[1
];
653 zCenter = centerSphereOnSection
[2
];
657 xCenter = centerOnTorusAxis
[0
];
658 yCenter = centerOnTorusAxis
[1
];
659 zCenter = centerOnTorusAxis
[2
];
683 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
703 Real thetaFiber ( -
PI / 2.0 );
707 Real thetaRotation(0);
708 Real thetaPosition(0);
709 thetaFree = std::atan( z / ( x - xT ) );
710 thetaPosition = thetaFree;
713 thetaPosition = thetaFree +
PI;
714 thetaRotation =
PI/2.0 - std::fabs( thetaFree );
718 thetaRotation = thetaFree -
PI/2.0;
723 xCenter = rT * std::cos( thetaPosition ) + xT;
724 zCenter = rT * std::sin( thetaPosition );
727 positionCenter
[0
] = xCenter;
728 positionCenter
[1
] = 0;
729 positionCenter
[2
] = zCenter;
736 MatrixSmall<3,3> changeOfVariable;
737 changeOfVariable(0,0) = std::cos( thetaRotation ); changeOfVariable(0,1) = 0.0; changeOfVariable(0,2) = std::sin( thetaRotation );
738 changeOfVariable(1,0) = 0.0; changeOfVariable(1,1) = 1.0; changeOfVariable(1,2) = 0.0;
739 changeOfVariable(2,0) = -std::sin( thetaRotation ); changeOfVariable(2,1) = 0.0; changeOfVariable(2,2) = std::cos( thetaRotation );
742 localPosition = changeOfVariable * ( position - positionCenter );
744 Real thetaPositionOnSection(0);
745 thetaPositionOnSection = std::atan( localPosition
[2
] / localPosition
[1
] );
747 if ( localPosition
[1
] < 0 )
748 thetaPositionOnSection +=
PI;
751 localFibers
[0
] = std::sin( thetaFiber );
752 localFibers
[1
] = std::cos( thetaFiber ) * std::sin( thetaPositionOnSection );
753 localFibers
[2
] = - std::cos( thetaFiber ) * std::cos( thetaPositionOnSection );
756 originFibers = changeOfVariable.transpose() * localFibers + positionCenter;
767 return originFibers
[0
];
777 return originFibers
[1
];
787 return originFibers
[2
];
793 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
802 Real theta = - 0.8426;
803 Real thetaChangeOfVariable = std::atan( y / x );
808 thetaChangeOfVariable +=
PI;
815 return - std::sin( thetaChangeOfVariable ) * std::cos( theta );
821 return std::cos( thetaChangeOfVariable ) * std::cos( theta );
827 return std::sin( theta );
832 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
854 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
876 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
897 ERROR_MSG (
"This entrie is not allowed: ud_functions.hpp");
904 fibersDirectionList::fibersDirectionList() :
905 M_mapNameDefinition( )
908 fibersDirectionList::~fibersDirectionList()
911 void fibersDirectionList::setupFiberDefinitions(
const UInt nbFamilies )
917 ASSERT( nbFamilies < 6,
"At the moment, a maximum number = 6 of families can be used! If you want more \n modifiy the file ud_functions.hpp in the application folder." );
920 fiberFunctionPtr_Type pointerToFunction(
new fiberFunction_Type( Family1Spherical ) );
921 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
922 (
"Family1", pointerToFunction ) );
924 pointerToFunction.reset(
new fiberFunction_Type( Family2 ) );
925 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
926 (
"Family2", pointerToFunction ) );
928 pointerToFunction.reset(
new fiberFunction_Type( Family3 ) );
929 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
930 (
"Family3", pointerToFunction ) );
932 pointerToFunction.reset(
new fiberFunction_Type( Family4 ) );
933 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
934 (
"Family4", pointerToFunction ) );
936 pointerToFunction.reset(
new fiberFunction_Type( Family5 ) );
937 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
938 (
"Family5", pointerToFunction ) );
940 pointerToFunction.reset(
new fiberFunction_Type( Family6 ) );
941 M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
942 (
"Family6", pointerToFunction ) );
947 fibersDirectionList::fiberFunctionPtr_Type fibersDirectionList::fiberDefinition(
const std::string nameFamily )
950 mapNameDefinitionFiberFunction_Type::const_iterator IT;
952 IT = M_mapNameDefinition.find ( nameFamily );
954 if ( IT != M_mapNameDefinition.end() )
960 std::cout <<
" Wrong identification of the fiber function! " << std::endl;
961 fiberFunctionPtr_Type pointerToFunction(
new fiberFunction_Type() );
963 return pointerToFunction;
VectorSmall< 3 > operator-(VectorSmall< 3 > const &vector) const
Operator -.
Real dot(VectorSmall< 3 > const &vector) const
Scalar product.
VectorSmall< 3 > & operator=(VectorSmall< 3 > const &vector)
Assignment operator.
void updateInverseJacobian(const UInt &iQuadPt)
void normalize()
Normalize vector.
Real & operator[](UInt const &i)
Operator [].
double Real
Generic real data.
VectorSmall< 3 > operator*(Real const &factor, VectorSmall< 3 > const &vector)
Operator * (multiplication by scalar on the left)
uint32_type UInt
generic unsigned integer (used mainly for addressing)