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}
......
......@@ -5,8 +5,10 @@
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,41 +17,37 @@
#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;
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;
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);
xGrownHalfLine grown(xtensor::xPoint(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.));
// 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);
xEntityFilter filter = std::bind1st(std::mem_fun(&xcut::xPhysSurfByTagging::strictOut), &phys_surf);
xSubMesh domain("domain", mesh);
xSubMesh bnd("bnd", mesh);
xSubMesh interior("interior", mesh);
......@@ -57,24 +55,31 @@ int main(int argc, char* argv[]) {
xAcceptInSubMesh is_in_domain(domain);
xAcceptInSubMesh is_in_bnd(bnd);
for(xIter it=mesh.begin(2); it!=mesh.end(2); ++it) {
if(filter(*it)) {
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)) {
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)) {
for (xIter it = domain.begin(0); it != domain.end(0); ++it)
{
if (!is_in_bnd(*it))
{
interior.add(*it);
}
}
......@@ -82,9 +87,9 @@ int main(int argc, char* argv[]) {
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;
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);
......@@ -94,48 +99,57 @@ int main(int argc, char* argv[]) {
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) {
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));
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);
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::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);
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) {
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) {
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)) {
for (xIter it = domain.begin(0); it != domain.end(0); ++it)
{
if (!is_in_bnd_in(*it))
{
interior_in.add(*it);
}
}
......@@ -146,18 +160,22 @@ int main(int argc, char* argv[]) {
// 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);
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;
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) {
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;
......@@ -165,31 +183,34 @@ int main(int argc, char* argv[]) {
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) {
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));
vals[0]->setVal(coeffs(i, j));
}
std::ostringstream oss;
oss<<i;
Export(eval_field, pexport, "mode_"+oss.str(), integ_rule, all.begin(), all.end());
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) {
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);
double sum = 0.;
for (int i = 0; i < bnd_in.size(0); ++i)
{
sum += coeffs(i, j);
}
vals[0]->setVal(sum);
}
......
This diff is collapsed.
......@@ -15,8 +15,8 @@ class TLSSolver;
#include "xLevelSet.h"
#include "xMesh.h"
using xfem::xMesh;
using AOMD::mEntity;
using xfem::xMesh;
class QSFormulRemeshAniso : public QSFormulation
{
......@@ -25,8 +25,8 @@ class QSFormulRemeshAniso : public QSFormulation
std::function<void(xMesh &)>);
virtual ~QSFormulRemeshAniso();
// void setBCDefinition(std::vector<std::tuple<std::function<bool (const Trellis_Util::mPoint&) >, int, int> >& BCDEF);
// 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 xtensor::xPoint&) >, int, int> > BCDEF;
xfem::xLevelSet lsetAdapt;
std::function<void(xMesh &)> tagger;
......@@ -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
{
// 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 =============
std::set<AOMD::mEntity *> elts; // On cree un "set" d'elements
meshInit.locateElement(xyz, elts); // On cherche tous les elements qui contiennent xyz et on les met dans le set
std::vector<std::pair<const AOMD::mEntity *, const xtensor::xPoint>> elts =
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
// maillage\nContenu du-dit maillage :\n";meshInit.printAll();throw;}
......@@ -75,7 +75,7 @@ class xEvalOnOtherMesh : public xfem::xEval<T>
// on extrait l'element parmis tous les elements
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
// donc pas la peine de chercher la partition (qui n'existe pas, vue la maniere dont fonctionne le code ici)
......
......@@ -6,59 +6,66 @@
*/
#include "FormulationQSSuperimposed.h"
#include "TLSGeom.h"
#include "LinearSystem.h"
#include "xAlgorithm.h"
#include "xAssembler.h"
#include "LinearSystem.h"
#include "MaterialCommand.h"
#include "NonUniformMaterialSensitivity.h"
#include "TLSGeom.h"
#include "xAlgorithm.h"
#include "xAssembler.h"
using namespace xfem;
QSFormulationSuperimposed::QSFormulationSuperimposed(TLSGeom& geom, TLSSolver& tls_solver,
const xData& data, const xParseData& parse_data,
PreProcessing& pre_pro, PostProcessing& post_pro,
QSFormulationSuperimposed::QSFormulationSuperimposed(TLSGeom& geom, TLSSolver& tls_solver, const xData& data,
const xParseData& parse_data, PreProcessing& pre_pro,
PostProcessing& post_pro,
const xEval<xtensor::xTensor2<>>& eval_strain_superimposed,
const xEval<xtensor::xTensor2<>>& eval_stress_superimposed) :
QSFormulation(geom, tls_solver, data, parse_data, pre_pro, post_pro),
const xEval<xtensor::xTensor2<>>& eval_stress_superimposed)
: QSFormulation(geom, tls_solver, data, parse_data, pre_pro, post_pro),
eval_strain_superimposed(eval_strain_superimposed),
eval_stress_superimposed(eval_stress_superimposed)
{}
{
}
QSFormulationSuperimposed::~QSFormulationSuperimposed() {}
class MyNormal : public xEval<xtensor::xVector<>> {
public:
void operator()(const xfem::xGeomElem* appro, const xfem::xGeomElem* integ, xtensor::xVector<>& vec) const {
auto pt=integ->getXYZ();
double theta=atan2(pt(1), pt(0));
vec(0)=cos(theta);
vec(1)=sin(theta);
vec(2)=0.;
class MyNormal : public xEval<xtensor::xVector<>>
{
public:
void operator()(const xfem::xGeomElem* appro, const xfem::xGeomElem* integ, xtensor::xVector<>& vec) const
{
auto pt = integ->getXYZ();
double theta = atan2(pt(1), pt(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);
xEvalBinary<xtool::xMult<xtensor::xTensor4<>, xtensor::xTensor2<>, xtensor::xTensor2<>>> eval_stress(eval_stiffness, eval_strain_superimposed);
xFormLinearWithLoad<xGradOperator<xtensor::xSymmetrize<>>, xEval<xtensor::xTensor2<>> > form_linear(eval_stress);
xFilteredRegion<xIter, xEntityFilter> superimposed(geom.begin(), geom.end(), xAcceptOnZoneID(101));
xEvalBinary<xtool::xMult<xtensor::xTensor4<>, xtensor::xTensor2<>, xtensor::xTensor2<>>> eval_stress(eval_stiffness,
eval_strain_superimposed);
xFormLinearWithLoad<xGradOperator<xtensor::xSymmetrize<>>, xEval<xtensor::xTensor2<>>> form_linear(eval_stress);
xFilteredRegion<xIter, xEntityFilter> superimposed(geom.begin(), geom.end(), xAccept(101));
system.setAssemblerCoeff(-1.);
Assemble(form_linear, system.getAssembler(), geom.getIntegRuleSmart(), disp_field, superimposed.begin(), superimposed.end());
system.setAssemblerCoeff(1.);
MyNormal eval_normal;
xEvalBinary<xtool::xMult<xtensor::xTensor2<>, xtensor::xVector<>, xtensor::xVector<>> > eval_traction(eval_stress_superimposed, eval_normal);
xFormLinearWithLoad<xValOperator<xtool::xIdentity<xtensor::xVector<>> >, xEval<xtensor::xVector<>> > lin(eval_traction);
xEvalBinary<xtool::xMult<xtensor::xTensor2<>, xtensor::xVector<>, xtensor::xVector<>>> eval_traction(eval_stress_superimposed,
eval_normal);
xFormLinearWithLoad<xValOperator<xtool::xIdentity<xtensor::xVector<>>>, xEval<xtensor::xVector<>>> lin(eval_traction);
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();
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);
UpdateMaterialVariablesVisitor_c update_visitor(name);
xeCompositeMaterialVariablesVisitor_c composite_visitor(set_visitor, update_visitor);
......
......@@ -6,28 +6,26 @@
*/
#include "Import.h"
#include <fstream>
#include "Export.h"
#include "Formulation.h"
#include "Observer.h"
#include "TLSGeom.h"
#include "TLSSolver.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 "mEntity.h"
#include "mFace.h"
#include "mTet.h"
#include "mVertex.h"
#include <fstream>
#include "options.h"
#include "workInProgress.h"
#include "xAlgorithm.h"
#include "xData.h"
#include "xMesh.h"
#include "xParseData.h"
using namespace xfem;
......@@ -219,9 +217,20 @@ int PreProcessing::getStep() const { return restart_step; }
void PreProcessing::loadMesh(std::string mesh_name, xMesh& mesh)
{
std::string filename = getFilename(mesh_name);
AOMD::AOMD_Util::Instance()->import(filename.c_str(), &mesh);
mesh.modifyAllState();
mesh.bdryLinkSetup();
AOMD::AOMD_Util::Instance()->import(filename.c_str(), &(mesh.getMesh()));
mesh.getMesh().modifyState(3, 2, true);
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;
system(filename.c_str());
}
......@@ -245,18 +254,18 @@ void PreProcessing::loadField(std::string field_name, xMesh& mesh, xField<>& fie
double data[32];
iss.read((char*)data, info[0] * sizeof(double));
AOMD::mVertex* n1 = mesh.getVertex(info[1]);
AOMD::mVertex* n2 = mesh.getVertex(info[2]);
AOMD::mVertex* n3 = mesh.getVertex(info[3]);
AOMD::mVertex* n1 = mesh.getMesh().getVertex(info[1]);
AOMD::mVertex* n2 = mesh.getMesh().getVertex(info[2]);
AOMD::mVertex* n3 = mesh.getMesh().getVertex(info[3]);
AOMD::mEntity* e = nullptr;
if (dim == 2)
{
e = mesh.getTri(n1, n2, n3);
e = mesh.getMesh().getTri(n1, n2, n3);
}
else
{
AOMD::mVertex* n4 = mesh.getVertex(info[4]);
e = mesh.getTet(n1, n2, n3, n4);
AOMD::mVertex* n4 = mesh.getMesh().getVertex(info[4]);
e = mesh.getMesh().getTet(n1, n2, n3, n4);
}
xFiniteElement FEM;
FEM.setKeys(e, field.begin(), field.end());
......@@ -297,18 +306,18 @@ void PreProcessing::loadDomain(std::string domain_name, xMesh& mesh, std::list<A
int data[16];
iss.read((char*)data, size * sizeof(int));
AOMD::mVertex* n1 = mesh.getVertex(data[0]);
AOMD::mVertex* n2 = mesh.getVertex(data[1]);
AOMD::mVertex* n3 = mesh.getVertex(data[2]);
AOMD::mVertex* n1 = mesh.getMesh().getVertex(data[0]);
AOMD::mVertex* n2 = mesh.getMesh().getVertex(data[1]);
AOMD::mVertex* n3 = mesh.getMesh().getVertex(data[2]);
AOMD::mEntity* e = nullptr;
if (dim == 2)
{
e = mesh.getTri(n1, n2, n3);
e = mesh.getMesh().getTri(n1, n2, n3);
}
else
{
AOMD::mVertex* n4 = mesh.getVertex(data[3]);
e = mesh.getTet(n1, n2, n3, n4);
AOMD::mVertex* n4 = mesh.getMesh().getVertex(data[3]);
e = mesh.getMesh().getTet(n1, n2, n3, n4);
}
list.push_back(e);
......
......@@ -5,74 +5,77 @@
conditions.
*/
#include "MeshGeneration.h"
#include "Integration.h"
#include "MeshGeneration.h"
#include "mEntity.h"
#include "xAttachableGP.h"
#include "xIntegrationRuleStored.h"
#include "xCSRVector.h"
#include "xDenseMatrix.h"
#include "xIntegrationRuleStored.h"
#include "xLapackInterface.h"
#include "mEntity.h"
using namespace AOMD;
using namespace xfem;
IntegrationPointCreator::IntegrationPointCreator(mEntity* e_model,
int degree,
const unsigned int partition_tag,
const unsigned int gp_tag) :
degree(degree),
rhs_degree(degree),
gauss_degree(1),
partition_tag(partition_tag),
gp_tag(gp_tag) {
assert(degree<5);
IntegrationPointCreator::IntegrationPointCreator(mEntity* e_model, int degree, const unsigned int partition_tag,
const unsigned int gp_tag)
: degree(degree), rhs_degree(degree), gauss_degree(1), partition_tag(partition_tag), gp_tag(gp_tag)
{
assert(degree < 5);
const int nb_terms=(degree+1)*(degree+2)/2;
const int nb_terms = (degree + 1) * (degree + 2) / 2;
Trellis_Util::GaussIntegrator gauss_integrator(e_model);
int nb_gauss_points=gauss_integrator.nbIntegrationPoints(gauss_degree);
while(nb_gauss_points<nb_terms) {
xquadrature::xGaussIntegrator gauss_integrator(e_model);
int nb_gauss_points = gauss_integrator.nbIntegrationPoints(gauss_degree);
while (nb_gauss_points < nb_terms)
{
++gauss_degree;
nb_gauss_points=gauss_integrator.nbIntegrationPoints(gauss_degree);
nb_gauss_points = gauss_integrator.nbIntegrationPoints(gauss_degree);
}
if(nb_gauss_points>nb_terms) {
if (nb_gauss_points > nb_terms)
{
++rhs_degree;
}
}
void IntegrationPointCreator::operator()(mEntity* e_appro) const {
void IntegrationPointCreator::operator()(mEntity* e_appro) const
{
xfem::xGeomElem geo_appro(e_appro);
geo_appro.SetIntegrationPointNumberForDegree(gauss_degree);
int nb_gauss_points=geo_appro.GetNbIntegrationPoints();
int nb_gauss_points = geo_appro.GetNbIntegrationPoints();
std::vector<Trellis_Util::mPoint> points;
std::vector<xtensor::xPoint> points;
points.reserve(nb_gauss_points);
xlinalg::xDenseMatrix mat(nb_gauss_points, nb_gauss_points);
for(int k=0; k<nb_gauss_points; ++k) {
for (int k = 0; k < nb_gauss_points; ++k)
{
geo_appro.setUVW(k);
const Trellis_Util::mPoint& uvw=geo_appro.getUVW();
mat(0,k)=1.;
mat(1,k)=uvw(1);
mat(2,k)=uvw(0);
if(nb_gauss_points>3) {
mat(3,k)=uvw(1)*uvw(1);
mat(4,k)=uvw(0)*uvw(1);
mat(5,k)=uvw(0)*uvw(0);
const xtensor::xPoint& uvw = geo_appro.getUVW();
mat(0, k) = 1.;
mat(1, k) = uvw(1);
mat(2, k) = uvw(0);
if (nb_gauss_points > 3)
{
mat(3, k) = uvw(1) * uvw(1);
mat(4, k) = uvw(0) * uvw(1);
mat(5, k) = uvw(0) * uvw(0);
}
if(nb_gauss_points>6) {
mat(6,k)=uvw(1)*uvw(1)*uvw(1);
mat(7,k)=uvw(0)*uvw(1)*uvw(1);
mat(8,k)=uvw(0)*uvw(0)*uvw(1);
mat(9,k)=uvw(0)*uvw(0)*uvw(0);
mat(10,k)=uvw(1)*uvw(1)*uvw(1)*uvw(1);
mat(11,k)=uvw(0)*uvw(1)*uvw(1)*uvw(1);
if (nb_gauss_points > 6)
{
mat(6, k) = uvw(1) * uvw(1) * uvw(1);
mat(7, k) = uvw(0) * uvw(1) * uvw(1);
mat(8, k) = uvw(0) * uvw(0) * uvw(1);
mat(9, k) = uvw(0) * uvw(0) * uvw(0);
mat(10, k) = uvw(1) * uvw(1) * uvw(1) * uvw(1);
mat(11, k) = uvw(0) * uvw(1) * uvw(1) * uvw(1);
}
if(nb_gauss_points>12) {
mat(12,k)=uvw(0)*uvw(0)*uvw(1)*uvw(1);
mat(13,k)=uvw(0)*uvw(0)*uvw(0)*uvw(1);
mat(14,k)=uvw(0)*uvw(0)*uvw(0)*uvw(0);
mat(15,k)=uvw(1)*uvw(1)*uvw(1)*uvw(1)*uvw(1);
if (nb_gauss_points > 12)
{