Commit 8b4fa293 authored by Benoit LE's avatar Benoit LE

Modifications to take into account recent commits in Xfiles.

parent ecb45658
......@@ -123,6 +123,7 @@ list(APPEND EXTERNAL_LIBRARIES
${xTLS_LIBRARIES}
${xExport_LIBRARIES}
${Trellis_LIBRARIES}
${xInterfaceAOMDGeneral_LIBRARIES}
${xSolverBase_LIBRARIES}
${xInterfaceLapack_LIBRARIES}
${LAPACK_LIBRARIES}
......
......@@ -5,7 +5,7 @@
#include "xAlgorithm.h"
using namespace xfem;
using namespace xcut;
//using namespace xcut;
using namespace xlinalg;
#include <cstdlib>
......@@ -26,11 +26,11 @@ CZMCrack::CZMCrack(xPointToDouble& lsn, xPointToDouble& lst, xData &data, const
dim(data.mesh->dim()-1) {
crack.Param.tolfit=parse_data.getDouble("fit_to_vertex");
eval_normal = new xEvalGradLevelSet<xtensor::xNormalize>(*(crack.getFieldn()));
eval_normal = new xEvalGradLevelSet<xtensor::xNormalize<>>(*(crack.getFieldn()));
eval_tangent = new xEvalOrthogonalVector2D(*eval_normal);
eval_grad_normal = new xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2>>(*(crack.getFieldn()));
eval_grad_tangent = new xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2>>(*(crack.getFieldt()));
eval_grad_normal = new xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2<>>>(*(crack.getFieldn()));
eval_grad_tangent = new xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2<>>>(*(crack.getFieldt()));
createCrack();
createField();
......@@ -39,6 +39,8 @@ CZMCrack::CZMCrack(xPointToDouble& lsn, xPointToDouble& lst, xData &data, const
CZMCrack::~CZMCrack() {
if(eval_normal) delete eval_normal;
if(eval_tangent) delete eval_tangent;
if(eval_grad_normal) delete eval_grad_normal;
if(eval_grad_tangent) delete eval_grad_tangent;
}
const xcrack::lCrack * CZMCrack::getCrack() const {
......@@ -64,20 +66,20 @@ xIter CZMCrack::end(int what, std::string submesh_name) const {
return region_crack.end(what);
}
const xfem::xEval<xtensor::xVector> & CZMCrack::getEvalNormal() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrack::getEvalNormal() const {
return * eval_normal;
}
const xfem::xEval<xtensor::xVector> &CZMCrack::getEvalTangent() const {
const xfem::xEval<xtensor::xVector<>> &CZMCrack::getEvalTangent() const {
return * eval_tangent;
}
const xfem::xEval<xtensor::xTensor2> & CZMCrack::getEvalGradNormal() const {
const xfem::xEval<xtensor::xTensor2<>> & CZMCrack::getEvalGradNormal() const {
return * eval_grad_normal;
}
const xfem::xEval<xtensor::xTensor2> & CZMCrack::getEvalGradTangent() const {
return * eval_grad_normal;
const xfem::xEval<xtensor::xTensor2<>> & CZMCrack::getEvalGradTangent() const {
return * eval_grad_tangent;
}
void CZMCrack::createCrack() {
......
......@@ -27,11 +27,11 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const;
virtual xfem::xIter end(int, std::string="crack") const;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradNormal() const;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradTangent() const;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradNormal() const;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradTangent() const;
const xcrack::lCrack * getCrack() const;
xfem::xMesh * getMesh_bnd();
......@@ -44,11 +44,11 @@ protected:
xfem::xSubMesh region_crack;
const int dim;
xEvalGradLevelSet<xtensor::xNormalize> * eval_normal;
xEvalGradLevelSet<xtensor::xNormalize<>> * eval_normal;
xEvalOrthogonalVector2D * eval_tangent;
xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2>> * eval_grad_normal;
xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2>> * eval_grad_tangent;
xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2<>>> * eval_grad_normal;
xEvalHessianLevelSet< xtool::xIdentity<xtensor::xTensor2<>>> * eval_grad_tangent;
};
#endif
......@@ -3,6 +3,8 @@
#include "Export.h"
#include "Util.h"
#include "xValueCreators.h"
#include "xAssembler.h"
#include "xData.h"
......@@ -57,10 +59,10 @@ CZMCrackBase::~CZMCrackBase() {
}
void CZMCrackBase::createField() {
DeclareInterpolation(field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState(field, xStateDofCreator<>(double_manager, dofs), begin(0),end(0));
DeclareInterpolation(delta_field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState(delta_field, xStateDofCreator<>(delta_double_manager, dofs), begin(0),end(0));
DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState<xField<>>(field, xStateDofCreator<>(double_manager, dofs), begin(0),end(0));
DeclareInterpolation<xField<>>(delta_field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState<xField<>>(delta_field, xStateDofCreator<>(delta_double_manager, dofs), begin(0),end(0));
const int nb_dofs=double_manager.size(dofs);
buf_vec.resize(nb_dofs);
}
......@@ -72,7 +74,7 @@ void CZMCrackBase::computeField(std::string name, const xfem::xEval<double>& eva
xCSRVector tmp(buf_vec.size());
Visit(xReadVectorVisitor<>(tmp.begin()), double_manager.begin(dofs), double_manager.end(dofs));
for(xDoubleManager::map_const_iterator it=double_manager.begin(); it!=double_manager.end(); ++it){
for(xValueManagerDist<double>::map_const_iterator it=double_manager.begin(); it!=double_manager.end(); ++it){
xValKey val = it->first;
AOMD::mEntity* e_integ = val.getEnti();
AOMD::mEntity* e_appro = integ2appro(e_integ);
......@@ -144,9 +146,9 @@ double CZMCrackBase::computeEnergyReleaseRate(const xfem::xEval<double>& eval_yc
ApplyCommandOnIntegrationRule(integ_command_delta_d, integrule, begin(), end());
// Compute grad_mean
xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector> > eval_grad_phi(field);
xEvalBinary<xtool::xMult<xtensor::xVector,double,xtensor::xVector> > eval_grad_d(eval_grad_phi,eval_dd);
xfem::xEvalUnary<xtensor::xNorm> eval_grad_d_t(eval_grad_d);
xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector<>> > eval_grad_phi(field);
xEvalBinary<xtool::xMult<xtensor::xVector<>,double,xtensor::xVector<>> > eval_grad_d(eval_grad_phi,eval_dd);
xfem::xEvalUnary<xtensor::xNorm<>> eval_grad_d_t(eval_grad_d);
xIntegrateEvalCommand<xEval<double> > integ_command_grad_d(eval_grad_d_t, grad_d_mean);
ApplyCommandOnIntegrationRule(integ_command_grad_d, integrule, begin(), end());
......@@ -179,9 +181,9 @@ double CZMCrackBase::computeEnergyReleaseRate(const xfem::xEval<double>& eval_yc
// ApplyCommandOnIntegrationRule(integ_command_minus_opening, integrule, begin(), end());
// // Compute grad_w_mean
// xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector> > eval_grad_phi(field);
// xEvalBinary<xtool::xMult<xtensor::xVector,double,xtensor::xVector> > eval_grad_opening_t(eval_grad_phi,eval_grad_opening);
// xfem::xEvalUnary<xtensor::xNorm> eval_grad_opening_t_norm(eval_grad_opening_t);
// xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector<>> > eval_grad_phi(field);
// xEvalBinary<xtool::xMult<xtensor::xVector<>,double,xtensor::xVector<>> > eval_grad_opening_t(eval_grad_phi,eval_grad_opening);
// xfem::xEvalUnary<xtensor::xNorm<>> eval_grad_opening_t_norm(eval_grad_opening_t);
// xIntegrateEvalCommand<xEval<double> > integ_command_grad_w(eval_grad_opening_t_norm, grad_w_mean);
// ApplyCommandOnIntegrationRule(integ_command_grad_w, integrule, begin(), end());
......@@ -216,9 +218,9 @@ std::vector<double> CZMCrackBase::computeEnergyReleaseRate2(const xfem::xEval<do
ApplyCommandOnIntegrationRule(integ_command_opening, integrule, begin(), end(),integ2appro);
// Compute grad_w_mean
// xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector> > eval_grad_phi(field);
// xEvalBinary<xtool::xMult<xtensor::xVector,double,xtensor::xVector> > eval_grad_opening_t(eval_grad_phi,eval_grad_opening);
// xfem::xEvalUnary<xtensor::xNorm> eval_grad_opening_t_norm(eval_grad_opening_t);
// xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector<>> > eval_grad_phi(field);
// xEvalBinary<xtool::xMult<xtensor::xVector<>,double,xtensor::xVector<>> > eval_grad_opening_t(eval_grad_phi,eval_grad_opening);
// xfem::xEvalUnary<xtensor::xNorm<>> eval_grad_opening_t_norm(eval_grad_opening_t);
xIntegrateEvalCommand<xEval<double> > integ_command_grad_w(eval_grad_opening, grad_w_mean);
ApplyCommandOnIntegrationRule(integ_command_grad_w, integrule, begin(), end(),integ2appro);
......
......@@ -32,17 +32,17 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const = 0;
virtual xfem::xIter end(int, std::string="crack") const = 0;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const = 0;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const = 0;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const = 0;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalTangent() const = 0;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradNormal() const = 0;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradTangent() const = 0;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradNormal() const = 0;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradTangent() const = 0;
void registerVector(std::string);
xlinalg::xCSRVector& getVector(std::string);
const xlinalg::xCSRVector& getVector(std::string) const;
xfem::xField& getField() { return field; }
xfem::xField<>& getField() { return field; }
const xfem::xEval<double>& getPhiEval() const;
double getElementSize() const;
......@@ -70,8 +70,8 @@ protected:
PostProcessing& post_pro;
xfem::xSpaceFactoryBase* space_factory;
xfem::xDoubleManager double_manager,delta_double_manager;
xfem::xField field, delta_field;
xfem::xValueManagerDist<double> double_manager,delta_double_manager;
xfem::xField<> field, delta_field;
std::string dofs;
xfem::xEvalField<xtool::xIdentity<double> > eval_phi,eval_delta_phi;
......
......@@ -21,8 +21,8 @@ CZMCrackSym::CZMCrackSym(xData &data, const xParseData& parse_data, PostProcessi
eval_normal(nullptr),eval_tangent(nullptr),
eval_grad_normal(nullptr),eval_grad_tangent(nullptr)
{
eval_normal = new xEvalConstant<xtensor::xVector>(xtensor::xVector(1.0,0.0,0.));
eval_tangent = new xEvalConstant<xtensor::xVector>(xtensor::xVector(0.0,1.0,0.));
eval_normal = new xEvalConstant<xtensor::xVector<>>(xtensor::xVector<>(1.0,0.0,0.));
eval_tangent = new xEvalConstant<xtensor::xVector<>>(xtensor::xVector<>(0.0,1.0,0.));
/// TODO : initiate eval_grad_normal and eval_grad_tangent !!!
......@@ -51,19 +51,19 @@ xIter CZMCrackSym::end(int what, std::string submesh_name) const {
return getRegion(submesh_name).end(what);
}
const xfem::xEval<xtensor::xVector> & CZMCrackSym::getEvalNormal() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrackSym::getEvalNormal() const {
return * eval_normal;
}
const xfem::xEval<xtensor::xVector> & CZMCrackSym::getEvalTangent() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrackSym::getEvalTangent() const {
return * eval_tangent;
}
const xfem::xEval<xtensor::xTensor2> & CZMCrackSym::getEvalGradNormal() const {
const xfem::xEval<xtensor::xTensor2<>> & CZMCrackSym::getEvalGradNormal() const {
return * eval_grad_normal;
}
const xfem::xEval<xtensor::xTensor2> & CZMCrackSym::getEvalGradTangent() const {
const xfem::xEval<xtensor::xTensor2<>> & CZMCrackSym::getEvalGradTangent() const {
return * eval_grad_normal;
}
......
......@@ -22,20 +22,20 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const;
virtual xfem::xIter end(int, std::string="crack") const;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradNormal() const;
virtual const xfem::xEval<xtensor::xTensor2> & getEvalGradTangent() const;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradNormal() const;
virtual const xfem::xEval<xtensor::xTensor2<>> & getEvalGradTangent() const;
protected:
virtual void createCrack();
xfem::xEvalConstant<xtensor::xVector> * eval_normal;
xfem::xEvalConstant<xtensor::xVector> * eval_tangent;
xfem::xEvalConstant<xtensor::xVector<>> * eval_normal;
xfem::xEvalConstant<xtensor::xVector<>> * eval_tangent;
xfem::xEvalConstant< xtensor::xTensor2> * eval_grad_normal;
xfem::xEvalConstant< xtensor::xTensor2> * eval_grad_tangent;
xfem::xEvalConstant< xtensor::xTensor2<>> * eval_grad_normal;
xfem::xEvalConstant< xtensor::xTensor2<>> * eval_grad_tangent;
};
#endif
......@@ -77,7 +77,7 @@ void xEvalCZMStiffness::operator()(const xGeomElem* geo_appro, const xGeomElem*
}
// ----------------------------------------------------------------------------
xEvalCZMY::xEvalCZMY(double & k_coh_, const xField & lambda_field_):
xEvalCZMY::xEvalCZMY(double & k_coh_, const xField<> & lambda_field_):
k_coh(k_coh_),eval_lambda(lambda_field_){}
void xEvalCZMY::operator()(const xGeomElem* geo_appro, const xGeomElem* geo_integ, double& res) const {
......@@ -410,11 +410,11 @@ void xEvalNonNullFunction::operator()(const xGeomElem* geo_appro, const xGeomEl
}
// ----------------------------------------------------------------------------
xEvalOrthogonalVector2D::xEvalOrthogonalVector2D(const xEval<xVector> & eval_):
xEvalOrthogonalVector2D::xEvalOrthogonalVector2D(const xEval<xVector<>> & eval_):
eval(eval_){}
void xEvalOrthogonalVector2D::operator()(const xGeomElem* geo_appro, const xGeomElem* geo_integ, xVector& res) const {
xVector vec;
void xEvalOrthogonalVector2D::operator()(const xGeomElem* geo_appro, const xGeomElem* geo_integ, xVector<>& res) const {
xVector<> vec;
eval(geo_appro,geo_integ,vec);
res(0) = -vec(1);
res(1) = vec(0);
......
......@@ -76,7 +76,7 @@ private:
class xEvalCZMY : public xfem::xEval<double>
{
public:
xEvalCZMY(double &, const xfem::xField &);
xEvalCZMY(double &, const xfem::xField<> &);
void operator()(const xfem::xGeomElem*, const xfem::xGeomElem*, double&) const;
private:
......@@ -266,14 +266,14 @@ private:
};
// ----------------------------------------------------------------------------
class xEvalOrthogonalVector2D : public xfem::xEval<xtensor::xVector>
class xEvalOrthogonalVector2D : public xfem::xEval<xtensor::xVector<>>
{
public:
xEvalOrthogonalVector2D(const xfem::xEval<xtensor::xVector> &);
void operator()(const xfem::xGeomElem*, const xfem::xGeomElem*, xtensor::xVector&) const;
xEvalOrthogonalVector2D(const xfem::xEval<xtensor::xVector<>> &);
void operator()(const xfem::xGeomElem*, const xfem::xGeomElem*, xtensor::xVector<>&) const;
private:
const xfem::xEval<xtensor::xVector> & eval;
const xfem::xEval<xtensor::xVector<>> & eval;
};
......
This diff is collapsed.
......@@ -17,6 +17,7 @@ public:
~FormulationCZM();
virtual void computeEnergyReleaseRate2();
virtual void computeSurfaceStrainEnergy();
void exportStep();
......@@ -34,7 +35,7 @@ protected:
xfem::xUpperCreator * upper_creator;
xfem::xField lambda_field_t;
xfem::xField<> lambda_field_t;
};
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ public:
FormulationCZMBase(CZMCrackBase&, const xfem::xData&, const xParseData&, PostProcessing&);
~FormulationCZMBase();
const xfem::xField& getDispField() const;
const xfem::xField<>& getDispField() const;
void addMeasureFunction(std::function<void (int)>);
// Overwrite default evaluators for E and mu
......@@ -69,12 +69,16 @@ protected:
virtual void computeFieldBeta() = 0;
// Export function
xtensor::xVector computeResForce();
xtensor::xVector computeResDisp();
xtensor::xVector<> computeResForce();
xtensor::xVector<> computeResDisp();
void computeCrackLength(); // gives crack length (2D) or are (3D). Should be put in CZMCrack ?
void computeDissipatedEnergy();
void computeEnergyReleaseRate();
void computeStrainEnergy();
virtual void computeEnergyReleaseRate2() = 0;
virtual void computeSurfaceStrainEnergy() = 0;
virtual void exportStep();
......@@ -92,10 +96,10 @@ protected:
xfem::xSpaceFactoryBase* space_factory;
std::string plane_condition;
xfem::xDoubleManager double_manager;
xfem::xField disp_field;
xfem::xField lambda_field;
xfem::xField opening_field;
xfem::xValueManagerDist<double> double_manager;
xfem::xField<> disp_field;
xfem::xField<> lambda_field;
xfem::xField<> opening_field;
std::function<xfem::xValue<double>* (const xfem::xValKey&)> value_creator;
std::string dofs;
......@@ -106,10 +110,11 @@ protected:
double load_factor, load_factor_variation, delta_load_factor;
double load_factor_1;
int I_load_factor, I_load_factor_variation;
xtensor::xVector ref_force, ref_disp;
xtensor::xVector<> ref_force, ref_disp;
double physical_crack_length, numerical_crack_length, delta_physical_crack_length, delta_numerical_crack_length;
double delta_dissipated_energy, dissipated_energy, energy_release_rate;
double strain_energy, bulk_strain_energy, surface_strain_energy, external_forces_energy, potential_energy;
std::vector<double> debug_values;
......@@ -134,8 +139,8 @@ protected:
int step;
// ---------- Post treatement--------------
std::vector<std::function<void (int)> > measure_fcts;
xfem::xDoubleManager double_manager_meas;
xfem::xField disp_field_meas;
xfem::xValueManagerDist<double> double_manager_meas;
xfem::xField<> disp_field_meas;
xfem::xSubMesh bnd_meas;
xfem::xSubMesh bnd_meas_support;
......
......@@ -4,6 +4,8 @@
*/
#include "FormulationCZMSym.h"
#include "xValueCreators.h"
#include "Export.h"
#include "LinearSystem.h"
#include "Util.h"
......@@ -32,7 +34,7 @@ void FormulationCZMSym::createMechanicalProblem() {
space_factory->setSpaceProductOrder(parse_data.getInt("disp_space_order"));
disp_field.insert(space_factory->getSpace());
disp_field.ResetStoragePolicy<xfem::xFieldStorageFull>();
disp_field.ResetStoragePolicy<xfem::xFieldStorageFull<double>>();
lambda_field.insert(xSpacePolynomialLagrange("lambda", xSpace::SCALAR,parse_data.getInt("disp_space_order")));
opening_field.insert(xSpacePolynomialLagrange("DISPLACEMENT_X", xSpace::SCALAR, parse_data.getInt("disp_space_order")));
disp_field_meas.insert(space_factory->getSpace());
......@@ -40,15 +42,15 @@ void FormulationCZMSym::createMechanicalProblem() {
xValueCreator<CustomValueDoubleOldAndCurrent> value_creator;
xStateDofCreator<> dofs_creator(double_manager, dofs);
DeclareInterpolation(disp_field, value_creator, all.begin(), all.end());
DeclareInterpolation(lambda_field, value_creator,crack.begin(), crack.end());
DeclareInterpolation(disp_field_meas, value_creator, bnd_meas_support.begin(), bnd_meas_support.end());
DeclareInterpolation<xField<>>(disp_field, value_creator, all.begin(), all.end());
DeclareInterpolation<xField<>>(lambda_field, value_creator,crack.begin(), crack.end());
DeclareInterpolation<xField<>>(disp_field_meas, value_creator, bnd_meas_support.begin(), bnd_meas_support.end());
applyEssentialEnv(1.0);
DeclareState(disp_field, dofs_creator, all.begin(), all.end());
DeclareState(lambda_field, dofs_creator, crack.begin(), crack.end());
DeclareState(disp_field_meas, xStateDofCreator<>(double_manager_meas, dofs), bnd_meas_support.begin(), bnd_meas_support.end());
DeclareState<xField<>>(disp_field, dofs_creator, all.begin(), all.end());
DeclareState<xField<>>(lambda_field, dofs_creator, crack.begin(), crack.end());
DeclareState<xField<>>(disp_field_meas, xStateDofCreator<>(double_manager_meas, dofs), bnd_meas_support.begin(), bnd_meas_support.end());
std::cout<<"Nb dofs : "<<double_manager.size(dofs)<<std::endl;
}
......@@ -100,10 +102,10 @@ void FormulationCZMSym::computeEnergyReleaseRate2() {
xEvalBinary<xMult<double,double,double>> eval_opening_n(eval_load_factor,eval_opening_ref_n);
xEvalGradField < xtool::xIdentity<xtensor::xVector> > eval_half_grad_opening_ref(opening_field);
xEvalBinary<xMult<xtensor::xVector,double,xtensor::xVector>> eval_grad_opening_ref(eval_half_grad_opening_ref,eval_two);
xEvalGradField < xtool::xIdentity<xtensor::xVector<>> > eval_half_grad_opening_ref(opening_field);
xEvalBinary<xMult<xtensor::xVector<>,double,xtensor::xVector<>>> eval_grad_opening_ref(eval_half_grad_opening_ref,eval_two);
xEvalBinary<xMult<xtensor::xVector,xtensor::xVector,double>> eval_grad_opening_ref_n_t(eval_grad_opening_ref,crack.getEvalTangent());
xEvalBinary<xMult<xtensor::xVector<>,xtensor::xVector<>,double>> eval_grad_opening_ref_n_t(eval_grad_opening_ref,crack.getEvalTangent());
xEvalBinary<xMult<double,double,double>> eval_grad_opening_n_t(eval_grad_opening_ref_n_t,eval_load_factor);
......@@ -116,6 +118,28 @@ void FormulationCZMSym::computeEnergyReleaseRate2() {
}
}
void FormulationCZMSym::computeSurfaceStrainEnergy()
{
surface_strain_energy = 0.;
xEvalConstant<double> eval_load_factor(load_factor);
xEvalConstant<double> eval_two_load_factor(2.0*load_factor);
xEvalField<xIdentity<double> > eval_half_opening_ref(opening_field);
xEvalBinary<xMult<double,double,double>> eval_opening(eval_two_load_factor,eval_half_opening_ref);
xEvalField<xIdentity<double> > eval_lambda_ref(lambda_field);
xEvalBinary<xMult<double,double,double>> eval_lambda(eval_load_factor,eval_lambda_ref);
xEvalCZMTraction eval_traction(k_coh,eval_opening,eval_lambda);
xEvalBinary<xMult<double,double,double>> eval_energy(eval_opening,eval_traction);
xIntegrateEvalCommand<xEval<double> > integ_command_energy(eval_energy, surface_strain_energy);
ApplyCommandOnIntegrationRule(integ_command_energy, *integ_rule, crack.begin(), crack.end());
surface_strain_energy*=0.5;
}
void FormulationCZMSym::exportStep() {
FormulationCZMBase::exportStep();
xEvalConstant<double> eval_load_factor(load_factor);
......
......@@ -13,6 +13,7 @@ public:
~FormulationCZMSym();
virtual void computeEnergyReleaseRate2();
virtual void computeSurfaceStrainEnergy();
void exportStep();
......
......@@ -31,7 +31,7 @@ void ParseCZM(std::string main_file_name, xData& data, xParseData& parse_data) {
parse_data.registerListString("export_manager", default_export_list);
default_export_list.clear();
parse_data.registerListString("export_sensors_label", default_export_list);
std::list<xtensor::xVector> default_export_point;
std::list<xtensor::xVector<>> default_export_point;
parse_data.registerListVector("export_sensors_point", default_export_point);
// czm related
......
......@@ -8,7 +8,6 @@
namespace xfem {
class xData;
class xField;
class xMesh;
}
class xParseData;
......
......@@ -26,7 +26,7 @@ CZMCrack::CZMCrack(xPointToDouble& lsn, xPointToDouble& lst, xData &data, const
dim(data.mesh->dim()-1) {
crack.Param.tolfit=parse_data.getDouble("fit_to_vertex");
eval_normal = new xEvalGradLevelSet<xtensor::xNormalize>(*(crack.getFieldn()));
eval_normal = new xEvalGradLevelSet<xtensor::xNormalize<>>(*(crack.getFieldn()));
eval_tangent = new xEvalOrthogonalVector2D(*eval_normal);
createCrack();
......@@ -61,11 +61,11 @@ xIter CZMCrack::end(int what, std::string submesh_name) const {
return region_crack.end(what);
}
const xfem::xEval<xtensor::xVector> & CZMCrack::getEvalNormal() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrack::getEvalNormal() const {
return * eval_normal;
}
const xfem::xEval<xtensor::xVector> & CZMCrack::getEvalTangent() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrack::getEvalTangent() const {
return * eval_tangent;
}
......
......@@ -27,8 +27,8 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const;
virtual xfem::xIter end(int, std::string="crack") const;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalTangent() const;
const xcrack::lCrack * getCrack() const;
xfem::xMesh * getMesh_bnd();
......@@ -42,7 +42,7 @@ protected:
xfem::xSubMesh region_crack;
const int dim;
xEvalGradLevelSet<xtensor::xNormalize> * eval_normal;
xEvalGradLevelSet<xtensor::xNormalize<>> * eval_normal;
xEvalOrthogonalVector2D * eval_tangent;
};
......
......@@ -57,10 +57,10 @@ CZMCrackBase::~CZMCrackBase() {
}
void CZMCrackBase::createField() {
DeclareInterpolation(field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState(field, xStateDofCreator<>(double_manager, dofs), begin(0),end(0));
DeclareInterpolation(delta_field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState(delta_field, xStateDofCreator<>(delta_double_manager, dofs), begin(0),end(0));
DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState<xField<>>(field, xStateDofCreator<>(double_manager, dofs), begin(0),end(0));
DeclareInterpolation<xField<>>(delta_field, xValueCreator<xValueDouble>(), begin(0),end(0));
DeclareState<xField<>>(delta_field, xStateDofCreator<>(delta_double_manager, dofs), begin(0),end(0));
const int nb_dofs=double_manager.size(dofs);
buf_vec.resize(nb_dofs);
}
......@@ -72,7 +72,7 @@ void CZMCrackBase::computeField(std::string name, const xfem::xEval<double>& eva
xCSRVector tmp(buf_vec.size());
Visit(xReadVectorVisitor<>(tmp.begin()), double_manager.begin(dofs), double_manager.end(dofs));
for(xDoubleManager::map_const_iterator it=double_manager.begin(); it!=double_manager.end(); ++it){
for(xValueManagerDist<double>::map_const_iterator it=double_manager.begin(); it!=double_manager.end(); ++it){
xValKey val = it->first;
AOMD::mEntity* e = val.getEnti();
xGeomElem e_geom(e);
......@@ -319,9 +319,9 @@ double CZMCrackBase::computeEnergyReleaseRate(const xfem::xEval<double>& eval_yc
ApplyCommandOnIntegrationRule(integ_command_delta_d, integrule, begin(), end());
// Compute grad_mean
xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector> > eval_grad_phi(field);
xEvalBinary<xtool::xMult<xtensor::xVector,double,xtensor::xVector> > eval_grad_d(eval_grad_phi,eval_dd);
xfem::xEvalUnary<xtensor::xNorm> eval_grad_d_t(eval_grad_d);
xfem::xEvalGradField<xtool::xIdentity<xtensor::xVector<>> > eval_grad_phi(field);
xEvalBinary<xtool::xMult<xtensor::xVector<>,double,xtensor::xVector<>> > eval_grad_d(eval_grad_phi,eval_dd);
xfem::xEvalUnary<xtensor::xNorm<>> eval_grad_d_t(eval_grad_d);
xIntegrateEvalCommand<xEval<double> > integ_command_grad_d(eval_grad_d_t, grad_d_mean);
ApplyCommandOnIntegrationRule(integ_command_grad_d, integrule, begin(), end());
......
......@@ -3,7 +3,7 @@
#include "xRegion.h"
#include "xSubMesh.h"
#include "xField.h"
#include "xField<>.h"
#include "xCSRVector.h"
#include "mpi.h"
......@@ -31,14 +31,14 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const = 0;
virtual xfem::xIter end(int, std::string="crack") const = 0;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const = 0;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const = 0;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const = 0;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalTangent() const = 0;
void registerVector(std::string);
xlinalg::xCSRVector& getVector(std::string);
const xlinalg::xCSRVector& getVector(std::string) const;
xfem::xField& getField() { return field; }
xfem::xField<>& getField() { return field; }
const xfem::xEval<double>& getPhiEval() const;
double getElementSize() const;
......@@ -60,8 +60,8 @@ protected:
PostProcessing& post_pro;
xfem::xSpaceFactoryBase* space_factory;
xfem::xDoubleManager double_manager,delta_double_manager;
xfem::xField field, delta_field;
xfem::xValueManagerDist<double>::map_const_iterator double_manager,delta_double_manager;
xfem::xField<> field, delta_field;
std::string dofs;
xfem::xEvalField<xtool::xIdentity<double> > eval_phi,eval_delta_phi;
......
......@@ -20,8 +20,8 @@ CZMCrackSym::CZMCrackSym(xData &data, const xParseData& parse_data, PostProcessi
CZMCrackBase(data,parse_data,post_pro,world_),
eval_normal(nullptr),
eval_tangent(nullptr){
eval_normal = new xEvalConstant<xtensor::xVector>(xtensor::xVector(1.0,0.0,0.));
eval_normal = new xEvalConstant<xtensor::xVector>(xtensor::xVector(0.0,1.0,0.));
eval_normal = new xEvalConstant<xtensor::xVector<>>(xtensor::xVector<>(1.0,0.0,0.));
eval_normal = new xEvalConstant<xtensor::xVector<>>(xtensor::xVector<>(0.0,1.0,0.));
createCrack();
createField();
......@@ -48,11 +48,11 @@ xIter CZMCrackSym::end(int what, std::string submesh_name) const {
return getRegion(submesh_name).end(what);
}
const xfem::xEval<xtensor::xVector> & CZMCrackSym::getEvalNormal() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrackSym::getEvalNormal() const {
return * eval_normal;
}
const xfem::xEval<xtensor::xVector> & CZMCrackSym::getEvalTangent() const {
const xfem::xEval<xtensor::xVector<>> & CZMCrackSym::getEvalTangent() const {
return * eval_tangent;
}
......
......@@ -22,14 +22,14 @@ public:
virtual xfem::xIter begin(int, std::string="crack") const;
virtual xfem::xIter end(int, std::string="crack") const;
virtual const xfem::xEval<xtensor::xVector> & getEvalNormal() const;
virtual const xfem::xEval<xtensor::xVector> & getEvalTangent() const;
virtual const xfem::xEval<xtensor::xVector<>> & getEvalNormal() const;