Top level interfaces
-
class MarmotElement
- #include <MarmotElement.h>
Abstract base class for finite elements in the Marmot framework.
This class defines the generic interface for finite elements, including methods for state variable handling, geometry, degrees of freedom, initialization, loading, and numerical integration. Concrete element implementations must override the pure virtual functions.
Public Types
-
enum StateTypes
Types of element state variables used in initialization and output.
Values:
-
enumerator Sigma11
-
enumerator Sigma22
-
enumerator Sigma33
-
enumerator HydrostaticStress
-
enumerator GeostaticStress
-
enumerator MarmotMaterialStateVars
-
enumerator MarmotMaterialInitialization
-
enumerator HasEigenDeformation
-
enumerator Sigma11
Public Functions
-
virtual ~MarmotElement()
Virtual destructor for safe polymorphic cleanup.
-
virtual int getNumberOfRequiredStateVars() = 0
- Returns:
Number of state variables required by the element.
-
virtual std::vector<std::vector<std::string>> getNodeFields() = 0
Get the nodal field names (e.g. displacement, rotation).
- Returns:
A 2D vector of strings representing the fields per node.
-
virtual std::vector<int> getDofIndicesPermutationPattern() = 0
Get permutation pattern for degrees of freedom.
- Returns:
Vector of indices describing the permutation.
-
virtual int getNNodes() = 0
- Returns:
Number of nodes in the element.
-
virtual int getNSpatialDimensions() = 0
- Returns:
Number of spatial dimensions (2D/3D).
-
virtual int getNDofPerElement() = 0
- Returns:
Number of degrees of freedom per element.
-
virtual std::string getElementShape() = 0
- Returns:
String describing the element shape in Ensight Gold notation (e.g. “quad4”, “hexa8”).
-
virtual void assignStateVars(double *stateVars, int nStateVars) = 0
Assign state variable array to element.
- Parameters:
stateVars – [inout] Pointer to state variable array.
nStateVars – [in] Number of state variables.
-
virtual void assignProperty(const ElementProperties &property)
Assign element property set.
- Parameters:
property – [in] Element property object containing material, geometry, etc.
-
virtual void assignProperty(const MarmotMaterialSection &property)
Assign material section property.
- Parameters:
property – [in] Material section definition (e.g. cross-sectional data).
-
virtual void assignNodeCoordinates(const double *coordinates) = 0
Assign nodal coordinates to element.
- Parameters:
coordinates – [in] Pointer to array of nodal coordinates.
-
virtual void initializeYourself() = 0
Initialize element state and internal variables.
-
virtual void setInitialConditions(StateTypes state, const double *values) = 0
Apply initial conditions to the element.
- Parameters:
state – [in] State type to be set.
values – [in] Array of initial values.
-
virtual void computeYourself(const double *QTotal, const double *dQ, double *Pint, double *K, const double *time, double dT, double &pNewdT) = 0
Perform element computations (stiffness, residual, etc.).
- Parameters:
QTotal – [in] Total dof vector.
dQ – [in] Incremental dof vector.
Pint – [out] Internal force vector.
K – [out] Stiffness matrix.
time – [in] Current time.
dT – [in] Time step size.
pNewdT – [out] Suggested new time step size.
-
virtual void computeDistributedLoad(DistributedLoadTypes loadType, double *Pext, double *K, int elementFace, const double *load, const double *QTotal, const double *time, double dT) = 0
Compute contribution from distributed surface loads.
- Parameters:
loadType – [in] Type of load.
Pext – [out] External load vector.
K – [out] Stiffness matrix.
elementFace – [in] Index of element face.
load – [in] Applied load values.
QTotal – [in] Total dof vector.
time – [in] Current time.
dT – [in] Time step size.
-
virtual void computeBodyForce(double *Pext, double *K, const double *load, const double *QTotal, const double *time, double dT) = 0
Compute contribution from body forces.
- Parameters:
Pext – [out] External load vector.
K – [out] Stiffness matrix.
load – [in] Body force vector.
QTotal – [in] Total displacement vector.
time – [in] Current time.
dT – [in] Time step size.
-
inline virtual void computeLumpedInertia(double *I)
Compute lumped inertia matrix.
Note
Default implementation throws an exception.
- Parameters:
I – [out] Inertia matrix.
-
inline virtual void computeConsistentInertia(double *I)
Compute consistent inertia matrix.
Note
Default implementation throws an exception.
- Parameters:
I – [out] Inertia matrix.
-
virtual StateView getStateView(const std::string &stateName, int quadraturePoint) = 0
Access element state at a quadrature point.
- Parameters:
stateName – [in] Name of the state variable.
quadraturePoint – [in] Index of quadrature point.
- Returns:
View into state variable.
-
virtual std::vector<double> getCoordinatesAtCenter() = 0
Get coordinates of element center.
- Returns:
Vector of coordinates at element centroid.
-
virtual std::vector<std::vector<double>> getCoordinatesAtQuadraturePoints() = 0
Get coordinates of quadrature points.
- Returns:
2D vector of coordinates at quadrature points.
-
virtual int getNumberOfQuadraturePoints() = 0
- Returns:
Number of quadrature points used by the element.
-
enum StateTypes
-
class MarmotElementFactory
- #include <Marmot.h>
Factory class for creating element instances. This class provides a mechanism to register elements by their code and name, and to create element instances based on their properties.
Public Types
-
using elementFactoryFunction = MarmotElement *(*)(int elementNumber)
Public Functions
-
MarmotElementFactory() = delete
Public Static Functions
-
static int getElementCodeFromName(const std::string &elementName)
Get the unique element code from its name.
- Parameters:
elementName – [in] Name of the element.
- Returns:
Unique code associated with the element name, or throws an exception if not found.
-
static MarmotElement *createElement(int elementCode, int elementNumber)
Create an element instance based on its code and number.
- Parameters:
elementCode – [in] Unique code for the element.
elementNumber – [in] Unique identifier for the element instance.
- Returns:
Pointer to the created MarmotElement instance, or nullptr if creation failed.
-
static bool registerElement(const std::string &elementName, int elementCode, elementFactoryFunction factoryFunction)
Register an element with its code and factory function.
- Parameters:
elementName – [in] Name of the element.
elementCode – [in] Unique code for the element.
factoryFunction – [in] Function to create element instances.
- Returns:
True if registration was successful, false if the code already exists.
-
using elementFactoryFunction = MarmotElement *(*)(int elementNumber)
-
class MarmotMaterial
- #include <MarmotMaterial.h>
Abstract base class for material models in the Marmot framework.
Provides a common interface for material models, including access to material properties, state variables, initialization, and density. Concrete material implementations must override the pure virtual functions.
Public Functions
-
MarmotMaterial(const double *materialProperties, int nMaterialProperties, int materialNumber)
Construct a material object.
- Parameters:
materialProperties – [in] Pointer to array of material properties.
nMaterialProperties – [in] Number of material properties.
materialNumber – [in] Unique identifier for the material.
-
virtual ~MarmotMaterial()
Virtual destructor for safe polymorphic cleanup.
-
virtual int getNumberOfRequiredStateVars() = 0
- Returns:
Number of state variables required by the material.
-
virtual void assignStateVars(double *stateVars, int nStateVars)
Assign state variable array to material.
- Parameters:
stateVars – [inout] Pointer to state variable array.
nStateVars – [in] Number of state variables.
-
virtual StateView getStateView(const std::string &stateName) = 0
Access material state variables by name.
- Parameters:
stateName – [in] Name of the requested state variable.
- Returns:
A view into the state variable array.
-
double *getAssignedStateVars()
Get pointer to currently assigned state variables.
- Returns:
Pointer to state variable array.
-
int getNumberOfAssignedStateVars()
Get number of assigned state variables.
- Returns:
Number of assigned state variables.
-
virtual void initializeYourself()
Initialize material state (default: no action).
-
virtual double getDensity()
Get material density.
- Returns:
Density value (default: 0 if not overridden).
Public Members
-
const int materialNumber
Identifier for material type/implementation.
-
MarmotMaterial(const double *materialProperties, int nMaterialProperties, int materialNumber)
-
class MarmotMaterialFactory
- #include <Marmot.h>
Factory class for creating material instances.
This class provides a mechanism to register materials by their code and name, and to create material instances based on their properties. It allows for dynamic material creation without hardcoding specific material types.
Public Types
-
using materialFactoryFunction = MarmotMaterial *(*)(const double *materialProperties, int nMaterialProperties, int materialNumber)
Public Functions
-
MarmotMaterialFactory() = delete
Public Static Functions
-
static int getMaterialCodeFromName(const std::string &materialName)
Get the unique material code from its name.
- Parameters:
materialName – [in] Name of the material.
- Returns:
Unique code associated with the material name, or -1 if not found.
-
static MarmotMaterial *createMaterial(int materialCode, const double *materialProperties, int nMaterialProperties, int materialNumber)
Create a material instance based on its code and properties.
- Parameters:
materialCode – [in] Unique code for the material.
materialProperties – [in] Array of material properties.
nMaterialProperties – [in] Number of properties in the array.
materialNumber – [in] Unique identifier for the material instance.
- Returns:
Pointer to the created MarmotMaterial instance, or nullptr if creation failed.
-
static bool registerMaterial(int materialCode, const std::string &materialName, materialFactoryFunction factoryFunction)
Register a material with its code and factory function.
- Parameters:
materialCode – [in] Unique code for the material.
materialName – [in] Name of the material.
factoryFunction – [in] Function to create material instances.
- Returns:
True if registration was successful, false if the code already exists.
-
using materialFactoryFunction = MarmotMaterial *(*)(const double *materialProperties, int nMaterialProperties, int materialNumber)
-
namespace MarmotLibrary
- file Marmot.h
- #include “Marmot/MarmotElement.h”#include “Marmot/MarmotMaterial.h”#include <functional>#include <iostream>#include <string>#include <unordered_map>
Include dependency graph for Marmot.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h" fillcolor="#BFBFBF"]
"2" [label="Marmot/MarmotElement.h" tooltip="Marmot/MarmotElement.h"]
"9" [label="Marmot/MarmotMaterial.h" tooltip="Marmot/MarmotMaterial.h"]
"3" [label="Marmot/MarmotElementProperty.h" tooltip="Marmot/MarmotElementProperty.h"]
"4" [label="Marmot/MarmotJournal.h" tooltip="Marmot/MarmotJournal.h"]
"5" [label="Marmot/MarmotUtils.h" tooltip="Marmot/MarmotUtils.h"]
"10" [label="functional" tooltip="functional"]
"11" [label="iostream" tooltip="iostream"]
"6" [label="stdexcept" tooltip="stdexcept"]
"7" [label="string" tooltip="string"]
"12" [label="unordered_map" tooltip="unordered_map"]
"8" [label="vector" tooltip="vector"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "9" [dir=forward tooltip="include"]
"1" -> "10" [dir=forward tooltip="include"]
"1" -> "11" [dir=forward tooltip="include"]
"1" -> "7" [dir=forward tooltip="include"]
"1" -> "12" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "4" [dir=forward tooltip="include"]
"2" -> "5" [dir=forward tooltip="include"]
"2" -> "6" [dir=forward tooltip="include"]
"2" -> "7" [dir=forward tooltip="include"]
"2" -> "8" [dir=forward tooltip="include"]
"9" -> "5" [dir=forward tooltip="include"]
"9" -> "7" [dir=forward tooltip="include"]
}](../../_images/graphviz-cdc6eaa66fe6ffd422cf163aed0b1c3201ebdd48.png)
- file MarmotElement.h
- #include “Marmot/MarmotElementProperty.h”#include “Marmot/MarmotJournal.h”#include “Marmot/MarmotUtils.h”#include <stdexcept>#include <string>#include <vector>
Include dependency graph for MarmotElement.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotElement.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotElement.h" fillcolor="#BFBFBF"]
"2" [label="Marmot/MarmotElementProperty.h" tooltip="Marmot/MarmotElementProperty.h"]
"3" [label="Marmot/MarmotJournal.h" tooltip="Marmot/MarmotJournal.h"]
"4" [label="Marmot/MarmotUtils.h" tooltip="Marmot/MarmotUtils.h"]
"5" [label="stdexcept" tooltip="stdexcept"]
"6" [label="string" tooltip="string"]
"7" [label="vector" tooltip="vector"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
"1" -> "4" [dir=forward tooltip="include"]
"1" -> "5" [dir=forward tooltip="include"]
"1" -> "6" [dir=forward tooltip="include"]
"1" -> "7" [dir=forward tooltip="include"]
}](../../_images/graphviz-e37ba779e314ccd3b7ec781f9c148decdfa5f84c.png)
This graph shows which files directly or indirectly include MarmotElement.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h"]
"1" [label="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotElement.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotElement.h" fillcolor="#BFBFBF"]
"1" -> "2" [dir=back tooltip="include"]
}](../../_images/graphviz-2ee622d17fcf4a0ac54fe57fe1e0e5a3d715bce1.png)
- file MarmotMaterial.h
- #include “Marmot/MarmotUtils.h”#include <string>
Include dependency graph for MarmotMaterial.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotMaterial.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotMaterial.h" fillcolor="#BFBFBF"]
"2" [label="Marmot/MarmotUtils.h" tooltip="Marmot/MarmotUtils.h"]
"3" [label="string" tooltip="string"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
}](../../_images/graphviz-b2d103e0e206d491dfc68cc5b25fa377d99ff7f5.png)
This graph shows which files directly or indirectly include MarmotMaterial.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/Marmot.h"]
"1" [label="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotMaterial.h" tooltip="/home/runner/work/Marmot/Marmot/include/Marmot/MarmotMaterial.h" fillcolor="#BFBFBF"]
"1" -> "2" [dir=back tooltip="include"]
}](../../_images/graphviz-f9800e218476b7a48d4a1308c7fee516f822075f.png)
- dir /home/runner/work/Marmot/Marmot/include
- dir /home/runner/work/Marmot/Marmot/include/Marmot