Commit 96390621 authored by Benoit Le's avatar Benoit Le

Update to take into account last commits in Xfiles + clang format

parent d42a09fa
This diff is collapsed.
This diff is collapsed.
/*
/*
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.
*/
#ifndef _TLSDuctile_Formulation_h_
#define _TLSDuctile_Formulation_h_
#include "xField.h"
#include <vector>
#include "xField.h"
class LinearSystem;
class PostProcessing;
class TLSGeom;
namespace xfem {
namespace xfem
{
class xData;
class xSpaceFactoryBase;
}
namespace xtls {
namespace xtls
{
class xEvalTLSDamageFunction;
}
class xParseData;
namespace xlinalg {
struct xParseData;
namespace xlinalg
{
class xCSRVector;
}
......@@ -30,117 +33,117 @@ class xCSRVector;
// cornerstone class. It is then derived to implement specificities of quasi
// static or dynamic or any specificity of some algorithm that needs to use
// values (double manager) or material variables (variab manager).
class Formulation {
public:
Formulation(TLSGeom&,
const xfem::xData&, const xParseData&,
PostProcessing&);
virtual ~Formulation();
class Formulation
{
public:
Formulation(TLSGeom&, const xfem::xData&, const xParseData&, PostProcessing&);
virtual ~Formulation();
// Simple accessors
int getNbDofs() const;
std::string getMaterialClass() const;
const xfem::xField<>& getDispField() const;
// Simple accessors
int getNbDofs() const;
std::string getMaterialClass() const;
const xfem::xField<>& getDispField() const;
// Helper to add additional and specific outputs to a test case.
void addMeasureFunction(std::function<void(int)>);
// Helper to add additional and specific outputs to a test case.
void addMeasureFunction(std::function<void (int)>);
// Declares values. Eventually links together several values on the boundary
// to simulate rigid motion. In this case, it declares a few DOFs as well.
void declareDispField(std::string = "all");
// Declares values. Eventually links together several values on the boundary
// to simulate rigid motion. In this case, it declares a few DOFs as well.
void declareDispField(std::string="all");
// Declares DOFs.
void declareDofs();
// Declares DOFs.
void declareDofs();
// Deletes material variables on integration points.
void deleteMaterialVariables(std::string = "all");
// Deletes material variables on integration points.
void deleteMaterialVariables(std::string="all");
// Declares material variables on integration points.
void declareMaterialVariables(std::string = "all");
// Declares material variables on integration points.
void declareMaterialVariables(std::string="all");
// Writes (restores) material variables values from phi.
// Writes first damage, then eventually others material variables by
// calling the special updateCurrentState("all") method of material.
void updateMaterialVariables(const xtls::xEvalTLSDamageFunction&, std::string = "all");
// Writes (restores) material variables values from phi.
// Writes first damage, then eventually others material variables by
// calling the special updateCurrentState("all") method of material.
void updateMaterialVariables(const xtls::xEvalTLSDamageFunction&, std::string="all");
// Writes current material variables to old ones.
void writeCurrentToOldMaterialVariables();
// Writes current material variables to old ones.
void writeCurrentToOldMaterialVariables();
// Writes strain given by std::string using disp field symmetric gradient.
virtual void writeStrain(std::string, std::string = "all");
// Writes strain given by std::string using disp field symmetric gradient.
virtual void writeStrain(std::string, std::string="all");
virtual void assembleGraphMatrix(LinearSystem&);
virtual void assembleGraphMatrix(LinearSystem&);
// Assembles stiffness matrix using 4nd order tensor sensitivity given by
// std::string.
virtual void assembleStiffnessMatrix(LinearSystem&, std::string, std::string = "all");
// Assembles stiffness matrix using 4nd order tensor sensitivity given by
// std::string.
virtual void assembleStiffnessMatrix(LinearSystem&, std::string, std::string="all");
// Assembles mass matrix using scalar sensitivity "density".
void assembleMassMatrix(LinearSystem&);
// Assembles mass matrix using scalar sensitivity "density".
void assembleMassMatrix(LinearSystem&);
// Assembles internal force vector using 2nd order tensor sensitivity given
// by std::string
virtual void assembleInternalForce(LinearSystem&, std::string, std::string = "all");
// Assembles internal force vector using 2nd order tensor sensitivity given
// by std::string
virtual void assembleInternalForce(LinearSystem&, std::string, std::string="all");
// Assembles external force vector by reading main.dat file
virtual void assembleNaturalEnv(LinearSystem&);
// Assembles external force vector by reading main.dat file
virtual void assembleNaturalEnv(LinearSystem&);
// Constrains value by declaring it fixed (value state),
// gives the prescribed value from main.dat.
virtual void applyEssentialEnv(double);
// Constrains value by declaring it fixed (value state),
// gives the prescribed value from main.dat.
virtual void applyEssentialEnv(double);
// Reads from disp field dof values to xlinalg::xCSRVector.
void readDisp(xlinalg::xCSRVector&);
// Reads from disp field dof values to xlinalg::xCSRVector.
void readDisp(xlinalg::xCSRVector&);
// Writes to disp field dof values from xlinalg::xCSRVector.
void writeDisp(const xlinalg::xCSRVector&);
// Writes to disp field dof values from xlinalg::xCSRVector.
void writeDisp(const xlinalg::xCSRVector&);
// Appends to disp field dof values from xlinalg::xCSRVector.
void addDisp(const xlinalg::xCSRVector&);
// Appends to disp field dof values from xlinalg::xCSRVector.
void addDisp(const xlinalg::xCSRVector&);
// Export function
void exportStep(int);
// Export function
void exportStep(int);
protected:
// After a new mesh has been built, transfers values contained in
// double_manager (defined on old mesh) to new values (defined on new mesh)
void transferDispField(double=1.);
protected:
// After a new mesh has been built, transfers values contained in
// double_manager (defined on old mesh) to new values (defined on new mesh)
void transferDispField(double = 1.);
// After a new mesh has been built, transfers values contained in
// variab_manager (defined on old mesh) to new values (defined on new mesh)
void transferMaterialVariables();
// After a new mesh has been built, transfers values contained in
// variab_manager (defined on old mesh) to new values (defined on new mesh)
void transferMaterialVariables();
// Clears disp field (double manager and spaces).
void deleteDispField(std::string="all");
// Clears disp field (double manager and spaces).
void deleteDispField(std::string = "all");
// Clears state
void deleteState();
// Clears state
void deleteState();
private:
// Links values together and declares a dof so that this unique dof controls
// several values.
void treatmentOfRigidMotion();
private:
// Links values together and declares a dof so that this unique dof controls
// several values.
void treatmentOfRigidMotion();
// Clears material variables (variab manager).
// void clearMaterialVariables();
protected:
const int bc_integ_order;
// Clears material variables (variab manager).
// void clearMaterialVariables();
protected:
const int bc_integ_order;
xfem::xSpaceFactoryBase* space_factory;
xfem::xSpaceFactoryBase* space_factory;
TLSGeom& geom;
const xfem::xData& data;
const xParseData& parse_data;
PostProcessing& post_pro;
TLSGeom& geom;
const xfem::xData& data;
const xParseData& parse_data;
PostProcessing& post_pro;
xfem::xValueManagerDist<double> double_manager;
xfem::xVariabManager variab_manager;
xfem::xField<> disp_field;
std::string dofs;
xfem::xValueManagerDist<double> double_manager;
xfem::xVariabManager variab_manager;
xfem::xField<> disp_field;
std::string dofs;
std::function<xfem::xValue<double>* (const xfem::xValKey&)> value_creator;
int size_disp_value;
std::function<xfem::xValue<double>*(const xfem::xValKey&)> value_creator;
int size_disp_value;
std::vector<std::function<void (int)> > measure_fcts;
std::vector<std::function<void(int)>> measure_fcts;
};
#endif
This diff is collapsed.
This diff is collapsed.
/*
/*
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.
*/
......@@ -11,32 +11,35 @@
#include <xField.h>
namespace xfem {
namespace xfem
{
class xData;
class xMesh;
}
class xParseData;
struct xParseData;
void ReadData(std::string, xfem::xData&, xParseData&);
void ParseArgs(int, char**, std::string&, std::string&);
class PreProcessing {
public:
PreProcessing(std::string);
bool doRestart() const;
bool fileExists(std::string) const;
int getStep() const;
void loadMesh(std::string, xfem::xMesh&);
void loadField(std::string, xfem::xMesh&, xfem::xField<>&);
void loadDomain(std::string, xfem::xMesh&, std::list<AOMD::mEntity*>&);
private:
void registerFilename(std::string, std::string);
std::string getFilename(std::string) const;
bool do_restart;
int restart_step;
std::map<std::string, std::string> filenames;
class PreProcessing
{
public:
PreProcessing(std::string);
bool doRestart() const;
bool fileExists(std::string) const;
int getStep() const;
void loadMesh(std::string, xfem::xMesh&);
void loadField(std::string, xfem::xMesh&, xfem::xField<>&);
void loadDomain(std::string, xfem::xMesh&, std::list<AOMD::mEntity*>&);
private:
void registerFilename(std::string, std::string);
std::string getFilename(std::string) const;
bool do_restart;
int restart_step;
std::map<std::string, std::string> filenames;
};
#endif
This diff is collapsed.
/*
/*
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.
*/
#ifndef _TLSDuctile_MaterialFunction_h_
#define _TLSDuctile_MaterialFunction_h_
#include "xTensors.h"
#include <string>
#include "xTensors.h"
// Base class for material functions
// used for hardening functions (damage or plasticity) and coupling functions
// (linking dot p and dot d)
class MaterialFunction {
public:
MaterialFunction();
virtual double getVal(double) const = 0 ;
virtual double getGrad(double) const = 0 ;
virtual double getPrimitive(double) const = 0 ;
protected:
xfem::xTensors properties;
xfem::xTensorsSignature signature;
class MaterialFunction
{
public:
MaterialFunction();
virtual double getVal(double) const = 0;
virtual double getGrad(double) const = 0;
virtual double getPrimitive(double) const = 0;
protected:
xfem::xTensors properties;
xfem::xTensorsSignature signature;
};
class AffinePowerHardeningFunction : public MaterialFunction {
public:
AffinePowerHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double a, p;
class AffinePowerHardeningFunction : public MaterialFunction
{
public:
AffinePowerHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double a, p;
};
// Polynomial hardening function
......@@ -42,65 +46,77 @@ private:
// - a_deg is the coefficient of the highest order term
// - a_0 is p(0)
// - And so on
class PolynomialHardeningFunction : public MaterialFunction {
public:
PolynomialHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
xTable coeff;
int deg;
class PolynomialHardeningFunction : public MaterialFunction
{
public:
PolynomialHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
xTable coeff;
int deg;
};
class TabulatedHardeningFunction : public MaterialFunction {
public:
TabulatedHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
vector<tuple<double,double,double>> f ;
class TabulatedHardeningFunction : public MaterialFunction
{
public:
TabulatedHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
std::vector<std::tuple<double, double, double>> f;
};
class ExponentialHardeningFunction : public MaterialFunction {
public:
ExponentialHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c;
class ExponentialHardeningFunction : public MaterialFunction
{
public:
ExponentialHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c;
};
class RationalHardeningFunction : public MaterialFunction {
public:
RationalHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c, p;
class RationalHardeningFunction : public MaterialFunction
{
public:
RationalHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c, p;
};
class LogarithmHardeningFunction : public MaterialFunction {
public:
LogarithmHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c;
class LogarithmHardeningFunction : public MaterialFunction
{
public:
LogarithmHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double c;
};
class CustomHardeningFunction : public MaterialFunction {
public:
CustomHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double r, c, p;
class CustomHardeningFunction : public MaterialFunction
{
public:
CustomHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double r, c, p;
};
// Equivalence with CZM hardening
......@@ -110,46 +126,54 @@ private:
// - CohesiveLinearHardening implements the small h(d) from Parilla-Gomez paper.
// - LC has to be given in file *.mat
// - taken into account into h(d)
class CohesiveLinearHardeningFunction : public MaterialFunction {
public:
CohesiveLinearHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double lc, wf, sigmac;
double lda ;
class CohesiveLinearHardeningFunction : public MaterialFunction
{
public:
CohesiveLinearHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double lc, wf, sigmac;
double lda;
};
class CohesiveBilinearHardeningFunction : public MaterialFunction {
public:
CohesiveBilinearHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double lc, wf, w1, sigmak, sigmac;
double wk_dimless, w1_dimless, sigmak_dimless, lda, a, phik_dimless, dk ;
class CohesiveBilinearHardeningFunction : public MaterialFunction
{
public:
CohesiveBilinearHardeningFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double lc, wf, w1, sigmak, sigmac;
double wk_dimless, w1_dimless, sigmak_dimless, lda, a, phik_dimless, dk;
};
class LinearCouplingFunction : public MaterialFunction {
public:
LinearCouplingFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double p_c;
class LinearCouplingFunction : public MaterialFunction
{
public:
LinearCouplingFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double p_c;
};
class ExponentialCouplingFunction : public MaterialFunction {
public:
ExponentialCouplingFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double p_c;
class ExponentialCouplingFunction : public MaterialFunction
{
public:
ExponentialCouplingFunction(const std::string&);
virtual double getVal(double) const;
virtual double getGrad(double) const;
virtual double getPrimitive(double) const;
private:
double p_c;
};
#endif
This diff is collapsed.
/*
/*
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.
*/
#ifndef _TLSDuctile_TLSGeom_h_
#define _TLSDuctile_TLSGeom_h_
#include "mpi.h"
#include "xEntityFilter.h"
#include "xEval.h"
#include "xIntegrationRule.h"
#include "xRegion.h"
#include "mpi.h"
class PreProcessing;
class PostProcessing;
namespace xfem {
namespace xfem
{
class xCommandOnGeomElem;
class xData;
}
class IntegrationRuleSmart : public xfem::xIntegrationRule {
public:
IntegrationRuleSmart();
~IntegrationRuleSmart();
void accept(xfem::xCommandOnGeomElem&, AOMD::mEntity*) const;
// the first registered that returns true is used
template<typename IntegRule>
void registerIntegRule(xfem::xEntityFilter filter, const IntegRule& integ_rule) {
integ_rules.push_back(std::make_pair(filter, new IntegRule(integ_rule)));
}
void clearIntegRule() {
integ_rules.clear();
}
private:
std::vector<std::pair<xfem::xEntityFilter, xfem::xIntegrationRule*> > integ_rules;
struct xParseData;
class IntegrationRuleSmart : public xfem::xIntegrationRule
{
public:
IntegrationRuleSmart();
~IntegrationRuleSmart();
void accept(xfem::xCommandOnGeomElem&, AOMD::mEntity*) const;
// the first registered that returns true is used
template <typename IntegRule>
void registerIntegRule(xfem::xEntityFilter filter, const IntegRule& integ_rule)
{
integ_rules.push_back(std::make_pair(filter, new IntegRule(integ_rule)));
}
void clearIntegRule() { integ_rules.clear(); }
private:
std::vector<std::pair<xfem::xEntityFilter, xfem::xIntegrationRule*>> integ_rules;
};
class TLSGeom {
public:
TLSGeom(xfem::xData&,
const xParseData&,
PreProcessing&, PostProcessing&, MPI_Comm);
~TLSGeom();
xfem::xMesh& getMesh(std::string="comp");
const xfem::xMesh& getMesh(std::string="comp") const;
void setMesh(std::string, xfem::xMesh*);
xfem::xRegion getRegion(std::string="all") const;
xfem::xIter begin(std::string="all") const;
xfem::xIter end(std::string="all") const;
xfem::xIter begin(int, std::string="all") const;
xfem::xIter end(int, std::string="all") const;
xfem::xIntegrationRuleBasic getIntegRuleBasic() const;
xfem::xIntegrationRuleBasic getIntegRuleBasic(int order) const;
xfem::xIntegrationRulePartition getIntegRulePartition(int order) const;
const IntegrationRuleSmart& getIntegRuleSmart() const;
double getElementSize() const;
double getBodyCharacteristicLength() const;
void computeNonlocalBoundingBox() const;
void updateDomains(std::list<AOMD::mEntity*>&);
void transferDomains();
bool isDelocalized() const;
bool isCracked() const;
void cutCrack(const xfem::xEval<double>&);
void cleanCrack();
int getNbUnconnectedParts() const;
void saveStep(int);
// Helps building or deleting sub meshes.
void buildTLS();
void buildLocal();
void buildFullyDamagedSupport(const xfem::xEval<double>&);
void deleteFullyDamagedSupport();
void buildBndMeas();
void buildLinearAndNonLinear(const xfem::xEval<double>&);
void buildBndIntNonlocal();
void deleteBndIntNonlocal();
void buildBndIntInNonlocal(const std::vector<AOMD::mEntity*>&);
void deleteBndIntInNonlocal();
void buildNonlocal(const std::list<AOMD::mEntity*>&);
protected:
void buildBndNonlocal();
void buildIntNonlocal();
void deleteMesh(std::string);
void updateElementSize();
void registerMesh(std::string, xfem::xMesh*);
private:
// Helps managing the mesh
bool isRegisteredMesh(std::string) const;
std::function<void (AOMD::mEntity*, xfem::xPartition&, xfem::xEntityFilter)> getPartition() const;
// Helps updating, building (creating new), transfering or deleting sub meshes.
void updateNonlocal(const std::list<AOMD::mEntity*>&);
void updateLocal();// removes elements and vertices that are in nonlocal
void correctLocalNonlocal();// puts local isolated elements to nonlocal
void transferTLSNonlocal();
void transferBndIntInNonlocal();
void buildUnconnectedParts();
// Helps building meshes.
void buildIntegMesh(const xfem::xEval<double>&);
void cleanIntegMesh();
void buildCompMesh();
void cleanCompMesh();
void createIntegrationPoints();
void cleanIntegrationPoints();
xfem::xData& data;
PostProcessing& post_pro;
std::map<std::string, xfem::xMesh*> meshes;
const int integ_order;
int gauss_degree;