Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
SimplexVolume.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_SimplexVolume_H_
9#define model_SimplexVolume_H_
10
11#include <SimplexTraits.h>
12#include <CTM.h>
13
14namespace model
15{
16
17
18 /**************************************************************************/
19 /**************************************************************************/
20 template<short int dim, short int order>
22 {
23
24 /**********************************************************************/
25 static Eigen::Matrix<double,dim,SimplexTraits<dim,order>::nVertices-1> edgeMatrix(const Eigen::Matrix<double,dim,SimplexTraits<dim,order>::nVertices>& posM)
26 {
27 Eigen::Matrix<double,dim,SimplexTraits<dim,order>::nVertices-1> temp=posM.template block<dim,SimplexTraits<dim,order>::nVertices-1>(0,1);
28 temp.colwise() -= posM.col(0);
29 return temp;
30 }
31
32 /**********************************************************************/
33 static double volume(const Eigen::Matrix<double,dim,SimplexTraits<dim,order>::nVertices>& posM)
34 {
35 const Eigen::Matrix<double,dim,SimplexTraits<dim,order>::nVertices-1> B=edgeMatrix(posM);
36 return sqrt((B.transpose()*B).determinant())/CTM::factorial(SimplexTraits<dim,order>::nVertices-1);
37 }
38
39 };
40
41 /**************************************************************************/
42 /**************************************************************************/
43 template<short int dim>
44 struct SimplexVolume<dim,0>
45 {
46 /**********************************************************************/
47 static double volume(const Eigen::Matrix<double,dim,SimplexTraits<dim,0>::nVertices>&)
48 {
49 return 0.0;
50 }
51
52 };
53
54} // close namespace
55#endif
initial point of the source segment B
static constexpr int factorial(int n)
Definition CTM.h:26
static constexpr int nVertices
static double volume(const Eigen::Matrix< double, dim, SimplexTraits< dim, 0 >::nVertices > &)
static Eigen::Matrix< double, dim, SimplexTraits< dim, order >::nVertices-1 > edgeMatrix(const Eigen::Matrix< double, dim, SimplexTraits< dim, order >::nVertices > &posM)
static double volume(const Eigen::Matrix< double, dim, SimplexTraits< dim, order >::nVertices > &posM)
vertex temp