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) ...@@ -34,13 +34,17 @@ find_package(xTool REQUIRED)
find_package(xInterfaceAOMDGeneral REQUIRED) find_package(xInterfaceAOMDGeneral REQUIRED)
find_package(xDistMesh REQUIRED ) find_package(xDistMesh REQUIRED )
find_package(Trellis REQUIRED ) find_package(Trellis REQUIRED )
find_package(xMapping REQUIRED)
find_package(xQuadrature REQUIRED )
find_package(xSolverBase REQUIRED ) find_package(xSolverBase REQUIRED )
find_package(xInterfaceLapack REQUIRED ) find_package(xInterfaceLapack REQUIRED )
find_package(xInterfaceSuperLu REQUIRED ) find_package(xInterfaceSuperLu REQUIRED )
find_package(xInterfaceTaucs REQUIRED ) find_package(xInterfaceTaucs REQUIRED )
find_package(xInterfaceParMetis REQUIRED )
find_package(xFEM REQUIRED ) find_package(xFEM REQUIRED )
find_package(xExt REQUIRED ) find_package(xExt REQUIRED )
find_package(xGeom REQUIRED ) find_package(xGeomTools REQUIRED)
find_package(xDistanceNearest REQUIRED)
find_package(xTLS REQUIRED ) find_package(xTLS REQUIRED )
find_package(xDoubleCut REQUIRED ) find_package(xDoubleCut REQUIRED )
find_package(xLegacySimpleCut REQUIRED) find_package(xLegacySimpleCut REQUIRED)
...@@ -58,13 +62,16 @@ list(APPEND EXTERNAL_INCLUDES ...@@ -58,13 +62,16 @@ list(APPEND EXTERNAL_INCLUDES
${xInterfaceAOMDGeneral_INCLUDE_DIR} ${xInterfaceAOMDGeneral_INCLUDE_DIR}
${xDistMesh_INCLUDE_DIR} ${xDistMesh_INCLUDE_DIR}
${Trellis_INCLUDE_DIR} ${Trellis_INCLUDE_DIR}
${xQuadrature_INCLUDE_DIR}
${xSolverBase_INCLUDE_DIR} ${xSolverBase_INCLUDE_DIR}
${xInterfaceSuperLu_INCLUDE_DIR} ${xInterfaceSuperLu_INCLUDE_DIR}
${xInterfaceTaucs_INCLUDE_DIR} ${xInterfaceTaucs_INCLUDE_DIR}
${xInterfaceLapack_INCLUDE_DIR} ${xInterfaceLapack_INCLUDE_DIR}
${xInterfaceParMetis_INCLUDE_DIR}
${xFEM_INCLUDE_DIR} ${xFEM_INCLUDE_DIR}
${xExt_INCLUDE_DIR} ${xExt_INCLUDE_DIR}
${xGeom_INCLUDE_DIR} ${xGeomTools_INCLUDE_DIR}
${xDistanceNearest_INCLUDE_DIR}
${xTLS_INCLUDE_DIR} ${xTLS_INCLUDE_DIR}
${PARMETIS_INCLUDE_DIR} ${PARMETIS_INCLUDE_DIR}
src src
...@@ -77,10 +84,13 @@ list(APPEND EXTERNAL_LIBRARIES ...@@ -77,10 +84,13 @@ list(APPEND EXTERNAL_LIBRARIES
${xLegacySimpleCut_LIBRARIES} ${xLegacySimpleCut_LIBRARIES}
${xDoubleCut_LIBRARIES} ${xDoubleCut_LIBRARIES}
${xExt_LIBRARIES} ${xExt_LIBRARIES}
${xGeom_LIBRARIES} ${xGeomTools_LIBRARIES}
${xDistanceNearest_LIBRARIES}
${xFEM_LIBRARIES} ${xFEM_LIBRARIES}
${xExport_LIBRARIES} ${xExport_LIBRARIES}
${Trellis_LIBRARIES} ${Trellis_LIBRARIES}
${xMapping_LIBRARIES}
${xQuadrature_LIBRARIES}
${xInterfaceAOMDGeneral_LIBRARIES} ${xInterfaceAOMDGeneral_LIBRARIES}
${xSolverBase_LIBRARIES} ${xSolverBase_LIBRARIES}
${xInterfaceLapack_LIBRARIES} ${xInterfaceLapack_LIBRARIES}
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
conditions. conditions.
*/ */
#include "FastMarchingInterface.h" #include "FastMarchingInterface.h"
#include "xAlgorithm.h" #include "xAlgorithm.h"
#include "xDenseMatrix.h"
#include "xGenericSparseMatrix.h"
#include "xGenericSparseMatrixTraitPolicy.h"
#include "xLevelSet.h" #include "xLevelSet.h"
#include "xMesh.h" #include "xMesh.h"
#include "xPhysSurfByTagging.h" #include "xPhysSurfByTagging.h"
...@@ -15,41 +17,37 @@ ...@@ -15,41 +17,37 @@
#include "xSpacePolynomial.h" #include "xSpacePolynomial.h"
#include "xSubMesh.h" #include "xSubMesh.h"
#include "xDenseMatrix.h" namespace xlinalg
#include "xGenericSparseMatrix.h" {
#include "xGenericSparseMatrixTraitPolicy.h" typedef xlinalg::xGenericSparseMatrix<double, xTraitMatrixNonSingular, xTraitMatrixUnSym, xTraitMatrixSparceCSC,
xTraitMatrixCindex>
namespace xlinalg { Matrix;
typedef xlinalg::xGenericSparseMatrix<double,
xTraitMatrixNonSingular,
xTraitMatrixUnSym,
xTraitMatrixSparceCSC,
xTraitMatrixCindex> Matrix;
} }
using namespace xfem; using namespace xfem;
// using namespace xlinalg; // using namespace xlinalg;
using Trellis_Util::mPoint;
using AOMD::mEntity; using AOMD::mEntity;
using AOMD::mVertex; using AOMD::mVertex;
using xtensor::xPoint;
int main(int argc, char* argv[]) { int main(int argc, char* argv[])
{
if(argc!=3) { if (argc != 3)
std::cout<<"First argument: .msh file; Second argument: a boolean to say if bnd_in is to do."<<std::endl; {
std::cout << "First argument: .msh file; Second argument: a boolean to say if bnd_in is to do." << std::endl;
std::abort(); std::abort();
} }
xMesh mesh(argv[1]); xMesh mesh(argv[1]);
// domain creation // domain creation
xGrownHalfLine grown(Trellis_Util::mPoint(0.5, 0.5, 0.), xtensor::xVector(1.,0.,0.), 0.26); xGrownHalfLine grown(xtensor::xPoint(0.5, 0.5, 0.), xtensor::xVector(1., 0., 0.), 0.26);
xLevelSet level_set(&mesh, xCompl(grown)); xLevelSet level_set(&mesh, xCompl(grown));
// xPlane p1(Trellis_Util::mPoint(0.1,0.1,0.), xtensor::xVector(1.,0.,0.)); // xPlane p1(xtensor::xPoint(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.)); // xPlane p2(xtensor::xPoint(0.205,0.205,0.), xtensor::xVector(-1.,0.,0.));
// xLevelSet level_set(&mesh, xUnion(p1, p2)); // xLevelSet level_set(&mesh, xUnion(p1, p2));
xcut::xPhysSurfByTagging phys_surf(level_set); xcut::xPhysSurfByTagging phys_surf(level_set);
xEntityFilter filter=std::bind1st(std::mem_fun(&xcut::xPhysSurfByTagging::strictOut), &phys_surf); xEntityFilter filter = std::bind1st(std::mem_fun(&xcut::xPhysSurfByTagging::strictOut), &phys_surf);
xSubMesh domain("domain", mesh); xSubMesh domain("domain", mesh);
xSubMesh bnd("bnd", mesh); xSubMesh bnd("bnd", mesh);
xSubMesh interior("interior", mesh); xSubMesh interior("interior", mesh);
...@@ -57,24 +55,31 @@ int main(int argc, char* argv[]) { ...@@ -57,24 +55,31 @@ int main(int argc, char* argv[]) {
xAcceptInSubMesh is_in_domain(domain); xAcceptInSubMesh is_in_domain(domain);
xAcceptInSubMesh is_in_bnd(bnd); xAcceptInSubMesh is_in_bnd(bnd);
for(xIter it=mesh.begin(2); it!=mesh.end(2); ++it) { for (xIter it = mesh.begin(2); it != mesh.end(2); ++it)
if(filter(*it)) { {
if (filter(*it))
{
domain.add(*it); domain.add(*it);
} }
} }
domain.modifyAllState(); domain.modifyAllState();
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) { for (xIter it = domain.begin(0); it != domain.end(0); ++it)
mEntity* n=*it; {
for(int i=0; i<n->size(2); ++i) { mEntity* n = *it;
mEntity* e=n->get(2,i); for (int i = 0; i < n->size(2); ++i)
if(!is_in_domain(e)) { {
mEntity* e = n->get(2, i);
if (!is_in_domain(e))
{
bnd.add(n); bnd.add(n);
break; break;
} }
} }
} }
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) { for (xIter it = domain.begin(0); it != domain.end(0); ++it)
if(!is_in_bnd(*it)) { {
if (!is_in_bnd(*it))
{
interior.add(*it); interior.add(*it);
} }
} }
...@@ -82,9 +87,9 @@ int main(int argc, char* argv[]) { ...@@ -82,9 +87,9 @@ int main(int argc, char* argv[]) {
xRegion all(&mesh); xRegion all(&mesh);
xRegion region(&domain); xRegion region(&domain);
std::cout<<"region "<<region.size(2)<<std::endl; std::cout << "region " << region.size(2) << std::endl;
std::cout<<"bnd "<<bnd.size(0)<<std::endl; std::cout << "bnd " << bnd.size(0) << std::endl;
std::cout<<"interior "<<interior.size(0)<<std::endl; std::cout << "interior " << interior.size(0) << std::endl;
// level_set.load(p1); // level_set.load(p1);
...@@ -94,48 +99,57 @@ int main(int argc, char* argv[]) { ...@@ -94,48 +99,57 @@ int main(int argc, char* argv[]) {
xField<> field(&double_manager, space); xField<> field(&double_manager, space);
DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), all.begin(), all.end()); DeclareInterpolation<xField<>>(field, xValueCreator<xValueDouble>(), all.begin(), all.end());
DeclareState<xField<>>(field, xStateDofCreator<>(double_manager, "dofs"), 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) { for (xIter it = all.begin(0); it != all.end(0); ++it)
{
xFiniteElementKeysOnly keys; xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end()); keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals; std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey()); vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals); double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(1.*level_set(*it)); vals[0]->setVal(1. * level_set(*it));
} }
xEvalField<xtool::xIdentity<double> > eval_field(field); xEvalField<xtool::xIdentity<double>> eval_field(field);
xIntegrationRuleBasic integ_rule(1); xIntegrationRuleBasic integ_rule(1);
xexport::xExportGmshAscii pexport; xexport::xExportGmshAscii pexport;
Export(eval_field, pexport, "phi_given", integ_rule, all.begin(), all.end()); 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::function<double(const AOMD::mVertex&)> f_func = [](const AOMD::mVertex&) { return 1.; };
std::vector<const AOMD::mEntity*> bnd_in_vec; std::vector<const AOMD::mEntity*> bnd_in_vec;
bnd_in_vec.reserve(bnd.size(0)); bnd_in_vec.reserve(bnd.size(0));
FastMarchingReinit([&field](mVertex* v){ std::vector<double> vals; field.getVals(v, vals); return vals[0]; }, FastMarchingReinit(
[&field](mVertex* v, double val){ field.setVal(v, val); }, [&field](mVertex* v) {
region, std::vector<double> vals;
bnd.begin(0), bnd.end(0), field.getVals(v, vals);
interior.begin(0), interior.end(0), return vals[0];
std::back_inserter(bnd_in_vec), 1.e-6); },
[&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()); Export(eval_field, pexport, "phi", integ_rule, all.begin(), all.end());
xSubMesh bnd_in("bnd_in", mesh); xSubMesh bnd_in("bnd_in", mesh);
if(atoi(argv[2])>0) { if (atoi(argv[2]) > 0)
for(auto v: bnd_in_vec) { {
for (auto v : bnd_in_vec)
{
bnd_in.add(const_cast<AOMD::mEntity*>(v)); bnd_in.add(const_cast<AOMD::mEntity*>(v));
} }
} }
else { else
for(auto it=bnd.begin(0); it!=bnd.end(0); ++it) { {
for (auto it = bnd.begin(0); it != bnd.end(0); ++it)
{
bnd_in.add(*it); bnd_in.add(*it);
} }
} }
xSubMesh interior_in("interior_in", mesh); xSubMesh interior_in("interior_in", mesh);
xAcceptInSubMesh is_in_bnd_in(bnd_in); xAcceptInSubMesh is_in_bnd_in(bnd_in);
for(xIter it=domain.begin(0); it!=domain.end(0); ++it) { for (xIter it = domain.begin(0); it != domain.end(0); ++it)
if(!is_in_bnd_in(*it)) { {
if (!is_in_bnd_in(*it))
{
interior_in.add(*it); interior_in.add(*it);
} }
} }
...@@ -146,18 +160,22 @@ int main(int argc, char* argv[]) { ...@@ -146,18 +160,22 @@ int main(int argc, char* argv[]) {
// modes creation // modes creation
xlinalg::xDenseMatrix coeffs(bnd_in.size(0), region.size(0)); 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]; }, FastMarchingModeExtension(
[&field](mVertex* v, double val){ field.setVal(v, val); }, [&field](mVertex* v) {
region, std::vector<double> vals;
bnd_in.begin(0), bnd_in.end(0), field.getVals(v, vals);
interior_in.begin(0), interior_in.end(0), return vals[0];
coeffs, 1.e-6); },
[&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; std::cout << "nb modes " << bnd_in.size(0) << std::endl;
// modes export // modes export
for(int i=0; i<bnd_in.size(0); ++i) { for (int i = 0; i < bnd_in.size(0); ++i)
for(xIter it=all.begin(0); it!=all.end(0); ++it) { {
for (xIter it = all.begin(0); it != all.end(0); ++it)
{
xFiniteElementKeysOnly keys; xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end()); keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals; std::vector<xValue<double>*> vals;
...@@ -165,31 +183,34 @@ int main(int argc, char* argv[]) { ...@@ -165,31 +183,34 @@ int main(int argc, char* argv[]) {
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals); double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(0.); vals[0]->setVal(0.);
} }
int j=0; int j = 0;
for(xIter it=region.begin(0); it!=region.end(0); ++it, ++j) { for (xIter it = region.begin(0); it != region.end(0); ++it, ++j)
{
xFiniteElementKeysOnly keys; xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end()); keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals; std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey()); vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals); double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
vals[0]->setVal(coeffs(i,j)); vals[0]->setVal(coeffs(i, j));
} }
std::ostringstream oss; std::ostringstream oss;
oss<<i; oss << i;
Export(eval_field, pexport, "mode_"+oss.str(), integ_rule, all.begin(), all.end()); Export(eval_field, pexport, "mode_" + oss.str(), integ_rule, all.begin(), all.end());
} }
int j=0; int j = 0;
for(xIter it=region.begin(0); it!=region.end(0); ++it, ++j) { for (xIter it = region.begin(0); it != region.end(0); ++it, ++j)
{
xFiniteElementKeysOnly keys; xFiniteElementKeysOnly keys;
keys.setKeys(*it, field.begin(), field.end()); keys.setKeys(*it, field.begin(), field.end());
std::vector<xValue<double>*> vals; std::vector<xValue<double>*> vals;
vals.reserve(keys.sizeKey()); vals.reserve(keys.sizeKey());
double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals); double_manager.getValPtr(keys.beginKey(), keys.endKey(), vals);
double sum=0.; double sum = 0.;
for(int i=0; i<bnd_in.size(0); ++i) { for (int i = 0; i < bnd_in.size(0); ++i)
sum+=coeffs(i,j); {
sum += coeffs(i, j);
} }
vals[0]->setVal(sum); vals[0]->setVal(sum);
} }
......
This diff is collapsed.
...@@ -15,8 +15,8 @@ class TLSSolver; ...@@ -15,8 +15,8 @@ class TLSSolver;
#include "xLevelSet.h" #include "xLevelSet.h"
#include "xMesh.h" #include "xMesh.h"
using xfem::xMesh;
using AOMD::mEntity; using AOMD::mEntity;
using xfem::xMesh;
class QSFormulRemeshAniso : public QSFormulation class QSFormulRemeshAniso : public QSFormulation
{ {
...@@ -25,8 +25,8 @@ class QSFormulRemeshAniso : public QSFormulation ...@@ -25,8 +25,8 @@ class QSFormulRemeshAniso : public QSFormulation
std::function<void(xMesh &)>); std::function<void(xMesh &)>);
virtual ~QSFormulRemeshAniso(); virtual ~QSFormulRemeshAniso();
// void setBCDefinition(std::vector<std::tuple<std::function<bool (const Trellis_Util::mPoint&) >, int, int> >& BCDEF); // void setBCDefinition(std::vector<std::tuple<std::function<bool (const xtensor::xPoint&) >, int, int> >& BCDEF);
// std::vector<std::tuple<std::function<bool (const Trellis_Util::mPoint&) >, int, int> > BCDEF; // std::vector<std::tuple<std::function<bool (const xtensor::xPoint&) >, int, int> > BCDEF;
xfem::xLevelSet lsetAdapt; xfem::xLevelSet lsetAdapt;
std::function<void(xMesh &)> tagger; std::function<void(xMesh &)> tagger;
...@@ -57,11 +57,11 @@ class xEvalOnOtherMesh : public xfem::xEval<T> ...@@ -57,11 +57,11 @@ class xEvalOnOtherMesh : public xfem::xEval<T>
void operator()(const xfem::xGeomElem *geo_appro, const xfem::xGeomElem *geo_integ, T &resu) const void operator()(const xfem::xGeomElem *geo_appro, const xfem::xGeomElem *geo_integ, T &resu) const
{ {
// On recupere les coordonnees globales // On recupere les coordonnees globales
Trellis_Util::mPoint xyz = geo_integ->getXYZ(); // On recupere les coordonnees du point considere xtensor::xPoint xyz = geo_integ->getXYZ(); // On recupere les coordonnees du point considere
// Recharge de l'element d'approx ============= // Recharge de l'element d'approx =============
std::set<AOMD::mEntity *> elts; // On cree un "set" d'elements std::vector<std::pair<const AOMD::mEntity *, const xtensor::xPoint>> elts =
meshInit.locateElement(xyz, elts); // On cherche tous les elements qui contiennent xyz et on les met dans le set meshInit.locateElement(xyz); // On cherche tous les elements qui contiennent xyz et on les met dans le set
// if(elts.begin()==elts.end()){std::cout<<"ERREUR dans le xEvalWiOnAll : Le noeud "<<xyz<<" n'est pas dans le // if(elts.begin()==elts.end()){std::cout<<"ERREUR dans le xEvalWiOnAll : Le noeud "<<xyz<<" n'est pas dans le
// maillage\nContenu du-dit maillage :\n";meshInit.printAll();throw;} // maillage\nContenu du-dit maillage :\n";meshInit.printAll();throw;}
...@@ -75,7 +75,7 @@ class xEvalOnOtherMesh : public xfem::xEval<T> ...@@ -75,7 +75,7 @@ class xEvalOnOtherMesh : public xfem::xEval<T>
// on extrait l'element parmis tous les elements // on extrait l'element parmis tous les elements
AOMD::mEntity *eltInit = 0; // On cree un element unique AOMD::mEntity *eltInit = 0; // On cree un element unique
eltInit = *(elts.begin()); //...et on dit que c'est le premier element du set eltInit = const_cast<AOMD::mEntity *>(((elts.begin())->first)); //...et on dit que c'est le premier element du set
// Plus simple ici : les noeuds sont dupliques : xyz doit forcement etre place sur un noeud de meshInit // Plus simple ici : les noeuds sont dupliques : xyz doit forcement etre place sur un noeud de meshInit
// donc pas la peine de chercher la partition (qui n'existe pas, vue la maniere dont fonctionne le code ici) // donc pas la peine de chercher la partition (qui n'existe pas, vue la maniere dont fonctionne le code ici)
......
...@@ -6,59 +6,66 @@ ...@@ -6,59 +6,66 @@
*/ */
#include "FormulationQSSuperimposed.h" #include "FormulationQSSuperimposed.h"
#include "TLSGeom.h"
#include "LinearSystem.h"
#include "xAlgorithm.h"
#include "xAssembler.h"
#include "LinearSystem.h"
#include "MaterialCommand.h" #include "MaterialCommand.h"
#include "NonUniformMaterialSensitivity.h" #include "NonUniformMaterialSensitivity.h"
#include "TLSGeom.h"
#include "xAlgorithm.h"
#include "xAssembler.h"
using namespace xfem; using namespace xfem;
QSFormulationSuperimposed::QSFormulationSuperimposed(TLSGeom& geom, TLSSolver& tls_solver, QSFormulationSuperimposed::QSFormulationSuperimposed(TLSGeom& geom, TLSSolver& tls_solver, const xData& data,
const xData& data, const xParseData& parse_data, const xParseData& parse_data, PreProcessing& pre_pro,
PreProcessing& pre_pro, PostProcessing& post_pro, PostProcessing& post_pro,
const xEval<xtensor::xTensor2<>>& eval_strain_superimposed, const xEval<xtensor::xTensor2<>>& eval_strain_superimposed,
const xEval<xtensor::xTensor2<>>& eval_stress_superimposed) : const xEval<xtensor::xTensor2<>>& eval_stress_superimposed)
QSFormulation(geom, tls_solver, data, parse_data, pre_pro, post_pro), : QSFormulation(geom, tls_solver, data, parse_data, pre_pro, post_pro),
eval_strain_superimposed(eval_strain_superimposed), eval_strain_superimposed(eval_strain_superimposed),
eval_stress_superimposed(eval_stress_superimposed) eval_stress_superimposed(eval_stress_superimposed)
{} {
}
QSFormulationSuperimposed::~QSFormulationSuperimposed() {} QSFormulationSuperimposed::~QSFormulationSuperimposed() {}
class MyNormal : public xEval<xtensor::xVector<>> { class MyNormal : public xEval<xtensor::xVector<>>
public: {
void operator()(const xfem::xGeomElem* appro, const xfem::xGeomElem* integ, xtensor::xVector<>& vec) const { public:
auto pt=integ->getXYZ(); void operator()(const xfem::xGeomElem* appro, const xfem::xGeomElem* integ, xtensor::xVector<>& vec) const
double theta=atan2(pt(1), pt(0)); {
vec(0)=cos(theta); auto pt = integ->getXYZ();
vec(1)=sin(theta); double theta = atan2(pt(1), pt(0));
vec(2)=0.; vec(0) = cos(theta);
vec(1) = sin(theta);
vec(2) = 0.;
} }
}; };
void QSFormulationSuperimposed::assembleNaturalEnv(LinearSystem& system) { void QSFormulationSuperimposed::assembleNaturalEnv(LinearSystem& system)
{
NonUniformMaterialSensitivity_c<xtensor::xTensor4<>> eval_stiffness("secant_matrix", variab_manager); NonUniformMaterialSensitivity_c<xtensor::xTensor4<>> eval_stiffness("secant_matrix", variab_manager);
xEvalBinary<xtool::xMult<xtensor::xTensor4<>, xtensor::xTensor2<>, xtensor::xTensor2<>>> eval_stress(eval_stiffness, eval_strain_superimposed); xEvalBinary<xtool::xMult<xtensor::xTensor4<>, xtensor::xTensor2<>, xtensor::xTensor2<>>> eval_stress(eval_stiffness,
xFormLinearWithLoad<xGradOperator<xtensor::xSymmetrize<>>, xEval<xtensor::xTensor2<>> > form_linear(eval_stress); eval_strain_superimposed);
xFilteredRegion<xIter, xEntityFilter> superimposed(geom.begin(), geom.end(), xAcceptOnZoneID(101)); xFormLinearWithLoad<xGradOperator<xtensor::xSymmetrize<>>, xEval<xtensor::xTensor2<>>> form_linear(eval_stress);
xFilteredRegion<xIter, xEntityFilter> superimposed(geom.begin(), geom.end(), xAccept(101));
system.setAssemblerCoeff(-1.); system.setAssemblerCoeff(-1.);
Assemble(form_linear, system.getAssembler(), geom.getIntegRuleSmart(), disp_field, superimposed.begin(), superimposed.end()); Assemble(form_linear, system.getAssembler(), geom.getIntegRuleSmart(), disp_field, superimposed.begin(), superimposed.end());
system.setAssemblerCoeff(1.); system.setAssemblerCoeff(1.);
MyNormal eval_normal; MyNormal eval_normal;
xEvalBinary<xtool::xMult<xtensor::xTensor2<>, xtensor::xVector<>, xtensor::xVector<>> > eval_traction(eval_stress_superimposed, eval_normal); xEvalBinary<xtool::xMult<xtensor::xTensor2<>, xtensor::xVector<>, xtensor::xVector<>>> eval_traction(eval_stress_superimposed,
xFormLinearWithLoad<xValOperator<xtool::xIdentity<xtensor::xVector<>> >, xEval<xtensor::xVector<>> > lin(eval_traction); eval_normal);
xFormLinearWithLoad<xValOperator<xtool::xIdentity<xtensor::xVector<>>>, xEval<xtensor::xVector<>>> lin(eval_traction);
xClassRegion bc(&geom.getMesh(), 12, 1); xClassRegion bc(&geom.getMesh(), 12, 1);
Assemble(lin, system.getAssembler(), geom.getIntegRuleBasic(bc_integ_order), disp_field, bc.begin(), bc.end(), xUpperAdjacency()); Assemble(lin, system.getAssembler(), geom.getIntegRuleBasic(bc_integ_order), disp_field, bc.begin(), bc.end(),
xUpperAdjacency());
} }
void QSFormulationSuperimposed::writeStrain(std::string name, std::string domain_name) { void QSFormulationSuperimposed::writeStrain(std::string name, std::string domain_name)
{
OldAndCurrent_c::current(); OldAndCurrent_c::current();
xEvalGradField<xtensor::xSymmetrize<>> eval_strain_tilde(disp_field); xEvalGradField<xtensor::xSymmetrize<>> eval_strain_tilde(disp_field);
xEvalBinary<std::plus<xtensor::xTensor2<>> > eval_strain(eval_strain_tilde, eval_strain_superimposed); xEvalBinary<std::plus<xtensor::xTensor2<>>> eval_strain(eval_strain_tilde, eval_strain_superimposed);
SetMaterialVariablesVisitor_c<xEvalBinary<std::plus<xtensor::xTensor2<>>>> set_visitor(name, eval_strain); SetMaterialVariablesVisitor_c<xEvalBinary<std::plus<xtensor::xTensor2<>>>> set_visitor(name, eval_strain);
UpdateMaterialVariablesVisitor_c update_visitor(name); UpdateMaterialVariablesVisitor_c update_visitor(name);
xeCompositeMaterialVariablesVisitor_c composite_visitor(set_visitor, update_visitor); xeCompositeMaterialVariablesVisitor_c composite_visitor(set_visitor, update_visitor);
......
...@@ -6,28 +6,26 @@ ...@@ -6,28 +6,26 @@
*/ */
#include "Import.h" #include "Import.h"
#include <fstream>
#include "Export.h" #include "Export.h"
#include "Formulation.h" #include "Formulation.h"
#include "Observer.h" #include "Observer.h"
#include "TLSGeom.h" #include "TLSGeom.h"
#include "TLSSolver.h" #include "TLSSolver.h"
#include "Util.h" #include "Util.h"
#include "options.h"
#include "xAlgorithm.h"
#include "xData.h"
#include "xMesh.h"
#include "xParseData.h"
#include "workInProgress.h"
#include "mAOMD.h" #include "mAOMD.h"
#include "mEntity.h" #include "mEntity.h"
#include "mFace.h" #include "mFace.h"
#include "mTet.h" #include "mTet.h"
#include "mVertex.h" #include "mVertex.h"
#include "options.h"
#include <fstream> #include "workInProgress.h"
#include "xAlgorithm.h"
#include "xData.h"
#include "xMesh.h"
#include "xParseData.h"
using namespace xfem; using namespace xfem;
...@@ -219,9 +217,20 @@ int PreProcessing::getStep() const { return restart_step; } ...@@ -219,9 +217,20 @@ int PreProcessing::getStep() const { return restart_step; }
void PreProcessing::loadMesh(std::string mesh_name, xMesh& mesh) void PreProcessing::loadMesh(std::string mesh_name, xMesh& mesh)
{ {
std::string filename = getFilename(mesh_name); std::string filename = getFilename(mesh_name);
AOMD::AOMD_Util::Instance()->import(filename.c_str(), &mesh); AOMD::AOMD_Util::Instance()->import(filename.c_str(), &(mesh.getMesh()));
mesh.modifyAllState(); mesh.getMesh().modifyState(3, 2, true);
mesh.bdryLinkSetup(); mesh.getMesh().modifyState(3, 1, true);
mesh.getMesh().modifyState(3, 0, true);
mesh.getMesh().modifyState(2, 1, true);
mesh.getMesh().modifyState(2, 0, true);
mesh.getMesh().modifyState(1, 0, true);
mesh.getMesh().modifyState(0, 1, true);
mesh.getMesh().modifyState(0, 2, true);
mesh.getMesh().modifyState(0, 3, true);
mesh.getMesh().modifyState(1, 2, true);
mesh.getMesh().modifyState(1, 3, true);
mesh.getMesh().modifyState(2, 3, true);
mesh.getMesh().bdryLinkSetup();
filename = "rm -f " + filename; filename = "rm -f " + filename;
system(filename.c_str()); system(filename.c_str());
} }
...@@ -245,18 +254,18 @@ void PreProcessing::loadField(std::string field_name, xMesh& mesh, xField<>& fie ...@@ -245,18 +254,18 @@ void PreProcessing::loadField(std::string field_name, xMesh& mesh, xField<>& fie
double data[32]; double data[32];
iss.read((char*)data, info[0] * sizeof(double)); iss.read((char*)data, info[0] * sizeof(double));
AOMD::mVertex* n1 = mesh.getVertex(info[1]); AOMD::mVertex* n1 = mesh.getMesh().getVertex(info[1]);
AOMD::mVertex* n2 = mesh.getVertex(info[2]); AOMD::mVertex* n2 = mesh.getMesh().getVertex(info[2]);
AOMD::mVertex* n3 = mesh.getVertex(info[3]); AOMD::mVertex* n3 = mesh.getMesh().getVertex(info[3]);
AOMD::mEntity* e = nullptr; AOMD::mEntity* e = nullptr;
if (dim == 2)