58 class LagrangeElement :
private std::vector<LagrangeNode<LagrangeElement<_dim,degree,MappingType>>*>
65 constexpr static int dim=_dim;
66 constexpr static int order=degree;
71 typedef Eigen::Matrix<double,1,dim+1>
BaryType;
76 static Eigen::Matrix<double,1,Eigen::Dynamic> shapeFunctionCoeff(
const int&
N)
82 Eigen::Matrix<int,1,Eigen::Dynamic> prod(1,1);
88 Eigen::Matrix<int,1,2> temp2(-n,degree);
89 Eigen::Matrix<int,1,Eigen::Dynamic> temp1(1,prod.cols()+1);
91 for (
int i = 0;
i < prod.cols();++
i)
93 for (
int j = 0;
j < temp2.cols();++
j)
95 temp1(
i +
j) += prod(
i) * temp2(
j);
108 return prod.cast<
double>()/
f;
112 static Eigen::Matrix<double,dim+1,degree+1> getSFcoeffs(
const Eigen::Matrix<int,1,dim+1>& bary)
117 Eigen::Matrix<double,dim+1,degree+1>
temp(Eigen::Matrix<double,dim+1,degree+1>::Zero());
120 temp.row(
k).segment(0,bary(
k)+1)=shapeFunctionCoeff(bary(
k));
126 static std::vector<Eigen::Matrix<double,dim+1,degree+1>> get_sfCoeffsVector()
130 std::vector<Eigen::Matrix<double,dim+1,degree+1>>
temp;
139 static Eigen::Matrix<double,1,dim+1> sfcTimesBary(
const int& n,
const BaryType& bary)
141 Eigen::Matrix<double,1,dim+1>
temp(Eigen::Matrix<double,1,dim+1>::Zero());
142 for(
int d=0;d<
dim+1;++d)
144 Eigen::Matrix<double,degree+1,1> bPow(Eigen::Matrix<double,degree+1,1>::Ones());
145 for (
int p=1;
p<degree+1;++
p)
148 bPow(
p)=bPow(
p-1)*bary(d);
156 static Eigen::Matrix<double,1,dim+1> sfcTimesBaryDiff(
const int& n,
const BaryType& bary)
158 Eigen::Matrix<double,1,dim+1>
temp(Eigen::Matrix<double,1,dim+1>::Zero());
159 for(
int d=0;d<
dim+1;++d)
162 Eigen::Matrix<double,degree+1,1> bPow(Eigen::Matrix<double,degree+1,1>::Ones());
163 for (
int p=2;
p<degree+1;++
p)
165 bPow(
p)=
p*std::pow(bary(d),
p-1);
168 temp(d)=
sfCoeffsVector[
n].template block<1,degree>(d,1).dot(bPow.template segment<degree>(1));
174 static Eigen::Matrix<double,dim,dim> get_FL(
const Simplex<dim,dim>& s)
176 Eigen::Matrix<double,dim,dim>
temp;
188 temp.col(
k) <<
s.mesh->template simplexFactory<0>().getRef(
current).P0 -
s.mesh->template simplexFactory<0>().getRef(last).P0;
197 static const Eigen::Matrix<int ,CombinationWithRepetition<_dim+1,degree>::value,_dim+1>
baryStarsAndBars;
198 static const Eigen::Matrix<double,CombinationWithRepetition<_dim+1,degree>::value,_dim+1>
baryNodalCoordinates;
205 Eigen::Matrix<double,_dim,nodesPerElement>
Xe;
210 std::deque<NodeType>& nodeContainer,
211 std::map<Eigen::Matrix<double,dim,1>,
NodeType*
const,
213 std::map<size_t,const NodeType* const>& mesh2femIDmap) :
222 const Eigen::Matrix<double,dim,dim> FL(get_FL(
simplex));
234 if (nIter!=nodeFinder.end())
240 nodeContainer.emplace_back(P,nodeContainer.size());
241 pN=&*nodeContainer.rbegin();
243 const bool success(nodeFinder.insert(std::make_pair(P,pN)).second);
246 throw std::runtime_error(
"NODE NOT INSERTED in nodeFinder");
253 mesh2femIDmap.emplace(
simplex.vertices()[maxID]->xID(0),pN);
262 this->emplace_back(pN);
285 static Eigen::Matrix<double,1,nodesPerElement>
sf(
const BaryType& bary)
293 Eigen::Matrix<double,1,nodesPerElement>
temp;
296 temp(n)=sfcTimesBary(n,bary).prod();
302 template<
typename TrialFunctionType>
315 static Eigen::Matrix<double,dim+1,nodesPerElement>
diff(
const BaryType& bary)
323 Eigen::Matrix<double,dim+1,nodesPerElement>
temp(Eigen::Matrix<double,dim+1,nodesPerElement>::Zero());
326 const Eigen::Matrix<double,1,dim+1> temp1(sfcTimesBary(n,bary));
327 const Eigen::Matrix<double,1,dim+1> temp2(sfcTimesBaryDiff(n,bary));
329 for(
int d=0;d<
dim+1;++d)
331 Eigen::Matrix<double,1,dim+1> temp3(temp1);
333 temp(d,n)=temp3.prod();
340 static Eigen::Matrix<double,dim,nodesPerElement>
gradS(
const BaryType& bary)
352 template<
typename TrialFunctionType>
361 Eigen::Matrix<double,dim,nodesPerElement>
temp(
Gs(bary).transpose()*
gradS(bary));
367 template<
typename TrialFunctionType>
374 Eigen::Matrix<double,dim,nodesPerElement>
temp(
Gs(bary).transpose()*
gradS(bary));
384 return *this->operator[](n);
393 return *this->operator[](n);
401 return MappingType<ElementType>(*this).position(bary);
405 Eigen::Matrix<double,_dim,_dim>
Fs(
const BaryType& bary)
const
409 return MappingType<ElementType>(*this).Fs(bary);
418 return MappingType<ElementType>(*this).absJ(bary);
422 Eigen::Matrix<double,_dim,_dim>
Gs(
const BaryType& bary)
const
426 return MappingType<ElementType>(*this).Gs(bary);
430 Eigen::Matrix<double,dim,1>
jGN(
const BaryType& bary,
const int& n)
const
432 return MappingType<ElementType>(*this).jGN(bary,n);
439 return simplex.isBoundarySimplex();
446 return simplex.boundaryFaces();
LagrangeElement(const Simplex< dim, dim > &s, std::deque< NodeType > &nodeContainer, std::map< Eigen::Matrix< double, dim, 1 >, NodeType *const, CompareVectorsByComponent< double, dim, float > > &nodeFinder, std::map< size_t, const NodeType *const > &mesh2femIDmap)