Commit 9d5797a3 authored by Benoît LÉ's avatar Benoît LÉ

Update to take into account last commits in Xfiles

parent ef9a9eee
......@@ -34,13 +34,17 @@ find_package(xTool REQUIRED)
find_package(xInterfaceAOMDGeneral REQUIRED)
find_package(xDistMesh REQUIRED )
find_package(Trellis REQUIRED )
find_package(xMapping REQUIRED)
find_package(xQuadrature REQUIRED )
find_package(xSolverBase REQUIRED )
find_package(xInterfaceLapack REQUIRED )
find_package(xInterfaceSuperLu REQUIRED )
find_package(xInterfaceTaucs REQUIRED )
find_package(xInterfaceParMetis REQUIRED )
find_package(xFEM REQUIRED )
find_package(xExt REQUIRED )
find_package(xGeom REQUIRED )
find_package(xGeomTools REQUIRED)
find_package(xDistanceNearest REQUIRED)
find_package(xTLS REQUIRED )
find_package(xDoubleCut REQUIRED )
find_package(xLegacySimpleCut REQUIRED)
......@@ -58,13 +62,16 @@ list(APPEND EXTERNAL_INCLUDES
${xInterfaceAOMDGeneral_INCLUDE_DIR}
${xDistMesh_INCLUDE_DIR}
${Trellis_INCLUDE_DIR}
${xQuadrature_INCLUDE_DIR}
${xSolverBase_INCLUDE_DIR}
${xInterfaceSuperLu_INCLUDE_DIR}
${xInterfaceTaucs_INCLUDE_DIR}
${xInterfaceLapack_INCLUDE_DIR}
${xInterfaceParMetis_INCLUDE_DIR}
${xFEM_INCLUDE_DIR}
${xExt_INCLUDE_DIR}
${xGeom_INCLUDE_DIR}
${xGeomTools_INCLUDE_DIR}
${xDistanceNearest_INCLUDE_DIR}
${xTLS_INCLUDE_DIR}
${PARMETIS_INCLUDE_DIR}
src
......@@ -77,10 +84,13 @@ list(APPEND EXTERNAL_LIBRARIES
${xLegacySimpleCut_LIBRARIES}
${xDoubleCut_LIBRARIES}
${xExt_LIBRARIES}
${xGeom_LIBRARIES}
${xGeomTools_LIBRARIES}
${xDistanceNearest_LIBRARIES}
${xFEM_LIBRARIES}
${xExport_LIBRARIES}
${Trellis_LIBRARIES}
${xMapping_LIBRARIES}
${xQuadrature_LIBRARIES}
${xInterfaceAOMDGeneral_LIBRARIES}
${xSolverBase_LIBRARIES}
${xInterfaceLapack_LIBRARIES}
......
/*
/*
This file is a part of eXlibris C++ Library
under the GNU General Public License:
See the LICENSE.md files for terms and
See the LICENSE.md files for terms and
conditions.
*/
#include "FastMarchingInterface.h"
#include "xAlgorithm.h"
#include "xDenseMatrix.h"
#include "xGenericSparseMatrix.h"
#include "xGenericSparseMatrixTraitPolicy.h"
#include "xLevelSet.h"
#include "xMesh.h"
#include "xPhysSurfByTagging.h"
......@@ -15,185 +17,204 @@
#include "xSpacePolynomial.h"
#include "xSubMesh.h"
#include "xDenseMatrix.h"
#include "xGenericSparseMatrix.h"
#include "xGenericSparseMatrixTraitPolicy.h"
namespace xlinalg {
typedef xlinalg::xGenericSparseMatrix<double,
xTraitMatrixNonSingular,
xTraitMatrixUnSym,
xTraitMatrixSparceCSC,
xTraitMatrixCindex> Matrix;
namespace xlinalg
{
typedef xlinalg::xGenericSparseMatrix<double, xTraitMatrixNonSingular, xTraitMatrixUnSym, xTraitMatrixSparceCSC,
xTraitMatrixCindex>
Matrix;
}
using namespace xfem;
// using namespace xlinalg;
using Trellis_Util::mPoint;
using AOMD::mEntity;
using AOMD::mVertex;
int main(int argc, char* argv[]) {
if(argc!=3) {
std::cout<<"First argument: .msh file; Second argument: a boolean to say if bnd_in is to do."<<std::endl;
std::abort();
}
xMesh mesh(argv[1]);
// domain creation
xGrownHalfLine grown(Trellis_Util::mPoint(0.5, 0.5, 0.), xtensor::xVector(1.,0.,0.), 0.26);
xLevelSet level_set(&mesh, xCompl(grown));
// xPlane p1(Trellis_Util::mPoint(0.1,0.1,0.), xtensor::xVector(1.,0.,0.));
// xPlane p2(Trellis_Util::mPoint(0.205,0.205,0.), xtensor::xVector(-1.,0.,0.));
// xLevelSet level_set(&mesh, xUnion(p1, p2));
xcut::xPhysSurfByTagging phys_surf(level_set);
xEntityFilter filter=std::bind1st(std::mem_fun(&xcut::xPhysSurfByTagging::strictOut), &phys_surf);
xSubMesh domain("domain", mesh);
xSubMesh bnd("bnd", mesh);
xSubMesh interior("interior", mesh);
xAcceptInSubMesh is_in_domain(domain);
xAcceptInSubMesh is_in_bnd(bnd);
for(xIter it=mesh.begin(2); it!=mesh.end(2); ++it) {
if(filter(*it)) {
domain.add(*it);
}
}
domain.modifyAllState();
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) {
mEntity* n=*it;
for(int i=0; i<n->size(2); ++i) {
mEntity* e=n->get(2,i);
if(!is_in_domain(e)) {
bnd.add(n);
break;
using xtensor::xPoint;
int main(int argc, char* argv[])
{
if (argc != 3)
{
std::cout << "First argument: .msh file; Second argument: a boolean to say if bnd_in is to do." << std::endl;
std::abort();
}
xMesh mesh(argv[1]);
// domain creation
xGrownHalfLine grown(xtensor::xPoint(0.5, 0.5, 0.), xtensor::xVector(1., 0., 0.), 0.26);
xLevelSet level_set(&mesh, xCompl(grown));
// xPlane p1(xtensor::xPoint(0.1,0.1,0.), xtensor::xVector(1.,0.,0.));
// xPlane p2(xtensor::xPoint(0.205,0.205,0.), xtensor::xVector(-1.,0.,0.));
// xLevelSet level_set(&mesh, xUnion(p1, p2));
xcut::xPhysSurfByTagging phys_surf(level_set);
xEntityFilter filter = std::bind1st(std::mem_fun(&xcut::xPhysSurfByTagging::strictOut), &phys_surf);
xSubMesh domain("domain", mesh);
xSubMesh bnd("bnd", mesh);
xSubMesh interior("interior", mesh);
xAcceptInSubMesh is_in_domain(domain);
xAcceptInSubMesh is_in_bnd(bnd);
for (xIter it = mesh.begin(2); it != mesh.end(2); ++it)
{
if (filter(*it))
{
domain.add(*it);
}
}
}
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) {
if(!is_in_bnd(*it)) {
interior.add(*it);
}
}
xRegion all(&mesh);
xRegion region(&domain);
std::cout<<"region "<<region.size(2)<<std::endl;
std::cout<<"bnd "<<bnd.size(0)<<std::endl;
std::cout<<"interior "<<interior.size(0)<<std::endl;
// level_set.load(p1);
// phi field
xValueManagerDist<double>::map_const_iterator double_manager;
xSpacePolynomialLagrange space("space", xSpace::SCALAR, 1);
xField<> field(&double_manager, space);
DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), all.begin(), all.end());
DeclareState<xField<>>(field, xStateDofCreator<>(double_manager, "dofs"), all.begin(), all.end());
for(xIter it=all.begin(0); it!=all.end(0); ++it) {
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(1.*level_set(*it));
}
xEvalField<xtool::xIdentity<double> > eval_field(field);
xIntegrationRuleBasic integ_rule(1);
xexport::xExportGmshAscii pexport;
Export(eval_field, pexport, "phi_given", integ_rule, all.begin(), all.end());
std::function<double (const AOMD::mVertex&)> f_func=[](const AOMD::mVertex&){ return 1.; };
std::vector<const AOMD::mEntity*> bnd_in_vec;
bnd_in_vec.reserve(bnd.size(0));
FastMarchingReinit([&field](mVertex* v){ std::vector<double> vals; field.getVals(v, vals); return vals[0]; },
[&field](mVertex* v, double val){ field.setVal(v, val); },
region,
bnd.begin(0), bnd.end(0),
interior.begin(0), interior.end(0),
std::back_inserter(bnd_in_vec), 1.e-6);
Export(eval_field, pexport, "phi", integ_rule, all.begin(), all.end());
xSubMesh bnd_in("bnd_in", mesh);
if(atoi(argv[2])>0) {
for(auto v: bnd_in_vec) {
bnd_in.add(const_cast<AOMD::mEntity*>(v));
}
}
else {
for(auto it=bnd.begin(0); it!=bnd.end(0); ++it) {
bnd_in.add(*it);
}
}
xSubMesh interior_in("interior_in", mesh);
xAcceptInSubMesh is_in_bnd_in(bnd_in);
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) {
if(!is_in_bnd_in(*it)) {
interior_in.add(*it);
}
}
xEvalConstant<double> eval_one(1.);
Export(eval_one, pexport, "bnd_in", integ_rule, bnd_in.begin(), bnd_in.end());
Export(eval_one, pexport, "interior_in", integ_rule, interior_in.begin(), interior_in.end());
// modes creation
xlinalg::xDenseMatrix coeffs(bnd_in.size(0), region.size(0));
FastMarchingModeExtension([&field](mVertex* v){ std::vector<double> vals; field.getVals(v, vals); return vals[0]; },
[&field](mVertex* v, double val){ field.setVal(v, val); },
region,
bnd_in.begin(0), bnd_in.end(0),
interior_in.begin(0), interior_in.end(0),
coeffs, 1.e-6);
std::cout<<"nb modes "<<bnd_in.size(0)<<std::endl;
// modes export
for(int i=0; i<bnd_in.size(0); ++i) {
for(xIter it=all.begin(0); it!=all.end(0); ++it) {
}
domain.modifyAllState();
for (xIter it = domain.begin(0); it != domain.end(0); ++it)
{
mEntity* n = *it;
for (int i = 0; i < n->size(2); ++i)
{
mEntity* e = n->get(2, i);
if (!is_in_domain(e))
{
bnd.add(n);
break;
}
}
}
for (xIter it = domain.begin(0); it != domain.end(0); ++it)
{
if (!is_in_bnd(*it))
{
interior.add(*it);
}
}
xRegion all(&mesh);
xRegion region(&domain);
std::cout << "region " << region.size(2) << std::endl;
std::cout << "bnd " << bnd.size(0) << std::endl;
std::cout << "interior " << interior.size(0) << std::endl;
// level_set.load(p1);
// phi field
xValueManagerDist<double>::map_const_iterator double_manager;
xSpacePolynomialLagrange space("space", xSpace::SCALAR, 1);
xField<> field(&double_manager, space);
DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), all.begin(), all.end());
DeclareState<xField<>>(field, xStateDofCreator<>(double_manager, "dofs"), all.begin(), all.end());
for (xIter it = all.begin(0); it != all.end(0); ++it)
{
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(0.);
}
int j=0;
for(xIter it=region.begin(0); it!=region.end(0); ++it, ++j) {
vals[0]->setVal(1. * level_set(*it));
}
xEvalField<xtool::xIdentity<double>> eval_field(field);
xIntegrationRuleBasic integ_rule(1);
xexport::xExportGmshAscii pexport;
Export(eval_field, pexport, "phi_given", integ_rule, all.begin(), all.end());
std::function<double(const AOMD::mVertex&)> f_func = [](const AOMD::mVertex&) { return 1.; };
std::vector<const AOMD::mEntity*> bnd_in_vec;
bnd_in_vec.reserve(bnd.size(0));
FastMarchingReinit(
[&field](mVertex* v) {
std::vector<double> vals;
field.getVals(v, vals);
return vals[0];
},
[&field](mVertex* v, double val) { field.setVal(v, val); }, region, bnd.begin(0), bnd.end(0), interior.begin(0),
interior.end(0), std::back_inserter(bnd_in_vec), 1.e-6);
Export(eval_field, pexport, "phi", integ_rule, all.begin(), all.end());
xSubMesh bnd_in("bnd_in", mesh);
if (atoi(argv[2]) > 0)
{
for (auto v : bnd_in_vec)
{
bnd_in.add(const_cast<AOMD::mEntity*>(v));
}
}
else
{
for (auto it = bnd.begin(0); it != bnd.end(0); ++it)
{
bnd_in.add(*it);
}
}
xSubMesh interior_in("interior_in", mesh);
xAcceptInSubMesh is_in_bnd_in(bnd_in);
for (xIter it = domain.begin(0); it != domain.end(0); ++it)
{
if (!is_in_bnd_in(*it))
{
interior_in.add(*it);
}
}
xEvalConstant<double> eval_one(1.);
Export(eval_one, pexport, "bnd_in", integ_rule, bnd_in.begin(), bnd_in.end());
Export(eval_one, pexport, "interior_in", integ_rule, interior_in.begin(), interior_in.end());
// modes creation
xlinalg::xDenseMatrix coeffs(bnd_in.size(0), region.size(0));
FastMarchingModeExtension(
[&field](mVertex* v) {
std::vector<double> vals;
field.getVals(v, vals);
return vals[0];
},
[&field](mVertex* v, double val) { field.setVal(v, val); }, region, bnd_in.begin(0), bnd_in.end(0), interior_in.begin(0),
interior_in.end(0), coeffs, 1.e-6);
std::cout << "nb modes " << bnd_in.size(0) << std::endl;
// modes export
for (int i = 0; i < bnd_in.size(0); ++i)
{
for (xIter it = all.begin(0); it != all.end(0); ++it)
{
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(0.);
}
int j = 0;
for (xIter it = region.begin(0); it != region.end(0); ++it, ++j)
{
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(coeffs(i, j));
}
std::ostringstream oss;
oss << i;
Export(eval_field, pexport, "mode_" + oss.str(), integ_rule, all.begin(), all.end());
}
int j = 0;
for (xIter it = region.begin(0); it != region.end(0); ++it, ++j)
{
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(coeffs(i,j));
}
std::ostringstream oss;
oss<<i;
Export(eval_field, pexport, "mode_"+oss.str(), integ_rule, all.begin(), all.end());
}
int j=0;
for(xIter it=region.begin(0); it!=region.end(0); ++it, ++j) {
xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
double sum=0.;
for(int i=0; i<bnd_in.size(0); ++i) {
sum+=coeffs(i,j);
}
vals[0]->setVal(sum);
}
Export(eval_field, pexport, "sum", integ_rule, all.begin(), all.end());
return 0;
double sum = 0.;
for (int i = 0; i < bnd_in.size(0); ++i)
{
sum += coeffs(i, j);
}
vals[0]->setVal(sum);
}
Export(eval_field, pexport, "sum", integ_rule, all.begin(), all.end());
return 0;
}
......@@ -5,6 +5,7 @@
conditions.
*/
#include "FormulationQSRemeshAniso.h"
#include "Export.h"
#include "Import.h"
#include "LinearSystem.h"
......@@ -13,9 +14,10 @@
#include "TLSSolver.h"
#include "Util.h"
#include "options.h"
#include "xAlgorithm.h"
#include "xAssembler.h"
#include "xCSRMatrix.h"
#include "xCSRVector.h"
#include "xData.h"
#include "xFieldStorage.h"
#include "xLevelSetOperators.h"
......@@ -24,9 +26,6 @@
#include "xSpace.h"
#include "xSpaceFactory.h"
#include "xSubMesh.h"
#include "xCSRMatrix.h"
#include "xCSRVector.h"
// #include "xDenseMatrix.h"
#include "MaterialCommand.h"
......@@ -36,7 +35,6 @@
// xtls
#include "TLSEnrichment.h"
#include "TLSGeomInterface.h"
#include "mAOMD.h"
#include "mEntity.h"
#include "mFace.h"
......@@ -45,7 +43,9 @@
// For ICI...
#include <stdlib.h>
#include <boost/lexical_cast.hpp>
#include "xPostProVTU.h"
// For FastMarching
......@@ -69,62 +69,62 @@ QSFormulRemeshAniso::QSFormulRemeshAniso(TLSGeom &geom, TLSSolver &tls_solver, c
QSFormulRemeshAniso::~QSFormulRemeshAniso() {}
void QSFormulRemeshAniso::updateLevelSetField()
{
std::cout << "Coucou" << std::endl;
// std::cout << "Coucou" << std::endl;
if (Observer::tell<int>("step") == 150 || doRestart)
{
delete backupMesh;
backupMesh = new xMesh();
// if(!doRestart) xCopyMesh(&geom.getMesh(), backupMesh);
// else AOMD::AOMD_Util::Instance()->import("backupMesh_save.msh", backupMesh);
// if (Observer::tell<int>("step") == 150 || doRestart)
// {
// delete backupMesh;
// backupMesh = new xMesh();
// // if(!doRestart) xCopyMesh(&geom.getMesh(), backupMesh);
// // else AOMD::AOMD_Util::Instance()->import("backupMesh_save.msh", backupMesh);
xCopyMesh(geom.getMesh(), *backupMesh);
// xCopyMesh(geom.getMesh(), *backupMesh);
backupMesh->modifyAllState();
doRestart = false;
}
// backupMesh->modifyAllState();
// doRestart = false;
// }
tls_solver.updateLevelSetField();
tls_solver.exportMeanField("delta_phi", Observer::tell<int>("step"));
tls_solver.delocalizeLevelSetField();
if (tls_solver.isDelocalized())
{
tls_solver.reinitLevelSetField();
if (parse_data.getInt("remesh_aniso") == 1)
{
remesh();
tls_solver.reinitLevelSetField();
}
// tls_solver.updateLevelSetField();
// tls_solver.exportMeanField("delta_phi", Observer::tell<int>("step"));
// tls_solver.delocalizeLevelSetField();
// if (tls_solver.isDelocalized())
// {
// tls_solver.reinitLevelSetField();
// if (parse_data.getInt("remesh_aniso") == 1)
// {
// remesh();
// tls_solver.reinitLevelSetField();
// }
if (tls_solver.isCrackable())
{
clearDispMeasField();
geom.buildFullyDamagedSupport(tls_solver.getPhiMinusLcEval());
deleteMaterialVariables("fds");
tls_solver.cutCrack();
tls_solver.transferLevelSetField();
transferDispField();
transferMaterialVariables();
updateMaterialVariables(tls_solver.getDamageEval(), "duplicated");
declareDispMeasField();
}
tls_solver.delocalizeMeanField();
}
else
{
// std::cout<<"iscrack"<<geom.isCracked()<<endl;
// if(Observer::tell<int>("step") >= 15){
if (parse_data.getInt("remesh_aniso") == 1)
{
remesh();
}
// std::cout<<"iscrack"<<geom.isCracked()<<endl;
// }
}
if (is_nonlinear)
{
geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
}
// if (tls_solver.isCrackable())
// {
// clearDispMeasField();
// geom.buildFullyDamagedSupport(tls_solver.getPhiMinusLcEval());
// deleteMaterialVariables("fds");
// tls_solver.cutCrack();
// tls_solver.transferLevelSetField();
// transferDispField();
// transferMaterialVariables();
// updateMaterialVariables(tls_solver.getDamageEval(), "duplicated");
// declareDispMeasField();
// }
// tls_solver.delocalizeMeanField();
// }
// else
// {
// // std::cout<<"iscrack"<<geom.isCracked()<<endl;
// // if(Observer::tell<int>("step") >= 15){
// if (parse_data.getInt("remesh_aniso") == 1)
// {
// remesh();
// }
// // std::cout<<"iscrack"<<geom.isCracked()<<endl;
// // }
// }
// if (is_nonlinear)
// {
// geom.buildLinearAndNonLinear(tls_solver.getPhiEval());
// }
}
void QSFormulRemeshAniso::xReadFromParaview(string fName, string targetData, xField<> &field, xMesh &mesh)
......@@ -210,7 +210,7 @@ void QSFormulRemeshAniso::xReadFromParaview(string fName, string targetData, xFi
for (int j = 1; j < NbNodes + 1; ++j)
{
AOMD::mEntity *e = mesh.getVertex(j);
AOMD::mEntity *e = mesh.getMesh().getVertex(j);
xFiniteElement FEM;
FEM.setKeys(e, field.begin(), field.end());
vector<xValKey> *keys = FEM.getKeys();
......@@ -300,7 +300,7 @@ void QSFormulRemeshAniso::xReadFromParaviewxLevelSet(string fName, string target
f >> val;
// cout<<"val="<<val<<endl;
ls(m->getVertex(j)) = val;
ls(m->getMesh().getVertex(j)) = val;
}
f.close();
......@@ -384,7 +384,7 @@ void QSFormulRemeshAniso::projectPhiOnMesh(xMesh *mesh_new, std::map<mEntity *,
{
xMesh *mesh_old = &geom.getMesh("comp");
xField<> &phi_field = tls_solver.getField();
Trellis_Util::mPoint bbmin, bbmax;
xtensor::xPoint bbmin, bbmax;
mesh_old->compute_bounding_box(bbmin, bbmax);
// Works only in 2D for the moment
......@@ -394,11 +394,10 @@ void QSFormulRemeshAniso::projectPhiOnMesh(xMesh *mesh_new, std::map<mEntity *,
{
mEntity *e = *it;
mVertex *v = static_cast<mVertex *>(e);
Trellis_Util::mPoint p = v->point();
xtensor::xPoint p = v->point();
// Find in which element v is lying
std::set<mEntity *> elts_old;
mesh_old->locateElement(v->point(), elts_old);
std::vector<std::pair<const AOMD::mEntity *, const xtensor::xPoint>> elts_old = mesh_old->locateElement(v->point());
// mesh_old->locateElementOctree(v->point(),elts_old);
// Test "boundary cases"
......@@ -420,7 +419,7 @@ void QSFormulRemeshAniso::projectPhiOnMesh(xMesh *mesh_new, std::map<mEntity *,
{
mEntity *elt = e->get(2, 0);
xfem::xGeomElem geo(elt);
Trellis_Util::mPoint CGD = geo.getCDGxyz();
xtensor::xPoint CGD = geo.getCDGxyz();
xtensor::xVector<> toCDG(p, CGD);
// toCDG.norm();
......@@ -431,14 +430,14 @@ void QSFormulRemeshAniso::projectPhiOnMesh(xMesh *mesh_new, std::map<mEntity *,
cout << toCDG << endl;
}
mesh_old->locateElement(p, elts_old);
elts_old = mesh_old->locateElement(v->point());
assert(!elts_old.empty());
}
// Get the value of the field at this location
assert(!elts_old.empty());
xfem::xGeomElem geo_old(*(elts_old.begin()));
xfem::xGeomElem geo_old(const_cast<AOMD::mEntity *>(((elts_old.begin())->first)));
geo_old.setUVWForXYZ(p);
double old_value{0};
phi_field.getVal(&geo_old, &geo_old, old_value);
......@@ -479,287 +478,291 @@ void QSFormulRemeshAniso::xAssignPhiValues(xField<> &field, xMesh *mesh, std::ma
void QSFormulRemeshAniso::remesh()
{
xMesh *mesh = &geom.getMesh("comp");
// // begin export
string sfront_iter = boost::lexical_cast<string>(Observer::tell<int>("step") - 1);
// //cout<<"step is"<<front_iter<<endl;
// AOMD::AOMD_Util::Instance()->ex_port("test_mesh1.msh", mesh);
xEvalConstant<double> eval_one_before(1.);
post_pro.exportOnSpace("sm_local_before_build", Observer::tell<int>("step"), eval_one_before, geom.getIntegRuleBasic(0),
geom.begin("local"), geom.end("local"));
post_pro.exportOnSpace("sm_nonlocal_before_build", Observer::tell<int>("step"), eval_one_before, geom.getIntegRuleBasic(0),
geom.begin("nonlocal"), geom.end("nonlocal"));
if (tls_solver.isDelocalized())
{
buildLSAdaptationField();
}
else
{
lsetAdapt.setSupport(mesh, -10.0);
}
post_pro.exportOnSpace("lsAdapt_after", Observer::tell<int>("step"), lsetAdapt);
// Export vers ICItech
xMesh *meshForRemeshing = backupMesh;
// xMesh *meshForRemeshing = &geom.backupMesh;
// xMesh* meshForRemeshing=&geom.getMesh();
// Misc evaluators
xEvalField<xtool::xIdentity<xtensor::xVector<>>> eval_disp(disp_field);
xEvalGradField<xtensor::xSymmetrize<>> eval_strain(disp_field);
xEvalLevelSet<xtool::xIdentity<double>> eval_lsetAdapt(lsetAdapt);
// Adapters for the evaluators that are defined on geom.getMesh, but exported on meshForRemeshing (backupMesh)
xEvalOnOtherMesh<double> eval_phi_on_backupMesh(tls_solver.getPhiEval(), geom.getMesh());
xEvalOnOtherMesh<double> eval_damage_on_backupMesh(tls_solver.getDamageEval(), geom.getMesh());
xEvalOnOtherMesh<xtensor::xVector<>> eval_disp_on_backupMesh(eval_disp, geom.getMesh());
xEvalOnOtherMesh<xtensor::xTensor2<>> eval_strain_on_backupMesh(eval_strain, geom.getMesh());
xEvalOnOtherMesh<double> eval_lsadapt_on_backupMesh(eval_lsetAdapt, geom.getMesh());
xexport::xPostProVTU postProVTU(meshForRemeshing);
std::string str = "sortie_";
str += sfront_iter;
str += ".vtu";
const char *sortie = str.c_str();
postProVTU.openFile(sortie);
postProVTU.exportScalarAtNode(eval_phi_on_backupMesh, "level-set");
// postProVTU.exportLevelSet(eval_lsadapt_on_backupMesh,"lsadapt");