aFemCode Classes

template<typename T>
class FemCase

FemCase is the base class for a run. It reads inputs, meshes, prepares the run, assembles matrices and performs the resolution.

A main.cpp can for instance look like:

FemCase<complex<double>> fc(setupFile.c_str());   
if (fc.isLoaded())    
{     
  fc.displayInfo();       
  fc.prepareComputation();        
  fc.buildKM();   
  fc.buildF();    
  fc.performResolution();     
}     

performResolution() solves \begin{equation} (\Delta+k^2)p=f \end{equation}

the template <T> allows to use double and complex<double> equally

Subclassed by AcousticFemCase< T >, AcousticRotatingFemCase< T >

Public Functions

FemCase()
FemCase(std::string setupFile)
~FemCase()
int addAtribute(int cursor, std::string entry, std::string value)
bool setInfo(std::string value)
std::string getInfo() const
bool writeInfo(std::string info) const
bool setError(std::string value)
std::string getError() const
bool writeError(std::string error) const
bool setMeshFile(std::string meshFile, int iCoupling)
std::string getMeshFile(int iCoupling)
bool displayInfo()
bool isLoaded() const

Returns truc if all usefull info are loaded correctly.

bool prepareComputation()

Prepares the computation this method loops over the couplings, creates the meshes, and computes basic stuff (volumes, jacobians, etc)

bool buildKM()

Assembles the mass and stiffness matrices for 1D 2D and 3D elements.

// au programme : loop over the couplings A CODER loop over the elements to know which matrices must be initialized (et quand on bossera en sparse, pour faire un assemblage fictif et determiner la taille des matrices) loop over the elements check element type compute elementary matrices K and M

assemble in main matrices check if everything is alright (volume compared to theory)

bool buildF()
bool performCoupling()
virtual bool performResolution()

Prepares the computation this method loops over the couplings, creates the meshes, and computes basic stuff (volumes, jacobians, etc)

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> *getGauss(int element, int order)

return gauss points and weights for a specified element type

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> *getN(int element, Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> gp)

returns the shape function matrices for a given element type

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> *getB(int element, Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> gp)

returns the gradient matrices for a given element type

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> computeFemB(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> Jac, Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> Bref) const

returns the shape function matrices for a specific element, given the jacobian matrix and the gradient matrix

bool exportResults()
bool writeMicValuesHeader()
bool writeMicValues(double f, vector<T> values)
bool writeMicFrequencies()
bool writeVtkMesh(string filename, Mesh *m) const
bool writeVtkData(string filename, string dataName, Eigen::SparseMatrix<T> data, bool firstTime, Mesh *m) const
bool addToVtkFile(ostream &out, Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic> const &mat) const
bool addToVtkFile(ostream &out, Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> const &mat) const
vector<int> swapLines(vector<int> v, vector<int> perm) const

swaps the lines of a vector reorganizes the lines of the vector according to perm.

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> swapLines(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> m, vector<int> perm) const
T computeFemDetJac(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> m) const
void removeDoublons(std::vector<size_t>)

Protected Attributes

bool m_loaded
std::string m_info
std::string m_error
size_t m_nCoupling
std::string m_mainSetup
std::vector<std::string> m_meshFile
std::vector<Mesh*> m_mesh
std::vector<std::string> m_setupFile
std::vector<Setup*> m_setup
std::vector<int> m_couplingType
std::string m_path
std::vector<Eigen::SparseMatrix<T>*> m_Kvol
std::vector<Eigen::SparseMatrix<T>*> m_Ksurf
std::vector<Eigen::SparseMatrix<T>*> m_Kseg
std::vector<Eigen::SparseMatrix<T>*> m_Mvol
std::vector<Eigen::SparseMatrix<T>*> m_Msurf
std::vector<Eigen::SparseMatrix<T>*> m_Mseg
std::vector<Eigen::SparseMatrix<T>*> m_Fvol
std::vector<Eigen::SparseMatrix<T>*> m_Fsurf
std::vector<Eigen::SparseMatrix<T>*> m_Fseg
std::vector<Eigen::SparseMatrix<T>*> currentSys
template<typename T>
class fLinSys

Public Functions

fLinSys()
fLinSys(int size, int nRhs)
fLinSys(Eigen::SparseMatrix<T> mat, Eigen::SparseMatrix<T> rhs)
~fLinSys()
bool fillMatrix()
bool printMatrix()
bool solve()
int getSize()
Eigen::SparseMatrix<T> getSolution()
bool isSymmetric()
bool getSymmetric()
bool isHermitian()
bool getHermitian()

Private Members

T const m_eps
int m_size
int m_nRhs
bool m_luDone
bool m_solved
int m_sym
int m_herm
Eigen::SparseMatrix<T> m_mat
Eigen::SparseMatrix<T> m_l
Eigen::SparseMatrix<T> m_u
Eigen::SparseMatrix<T> m_rhs
Eigen::SparseMatrix<T> m_solution
class Mesh

Public Functions

Mesh()
Mesh(std::string info, std::string error)
Mesh(Mesh m1, Mesh m2)
~Mesh()
bool unvImport(std::string unvFileToRead)
int import2411(std::string unvFileToRead, int position)
int import2412(std::string unvFileToRead, int position)
int import2467(std::string unvFileToRead, int position)
bool addNode(int index, float x, float y, float z)
bool addElement(int index, std::vector<Node*> nodes, int feDescriptor, int physicalProperty, int materialProperty, int color, int numberOfNodes)
Element getElement(size_t index) const
std::vector<Element> getElements() const
bool printConnectivities() const
bool printCoordinates() const
Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic> getConnectivities() const
Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic> getConecAndNN() const
Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> getCoordinates() const
Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic> getElemTypesVtk() const
int typeAssign(int nbOfNodes)
bool isBeginEnd(std::string line)
bool calculateVolume()
int getElementNumber() const
size_t getNodesNumber() const
std::vector<Node> getNodes() const
Node getNode(size_t iNode) const
bool setInfo(std::string value)
std::string getInfo() const
bool writeInfo(std::string info) const
bool setError(std::string value)
std::string getError() const
bool writeError(std::string error) const
bool computeAspectRatio()
bool computeJacobians()
bool contains1D() const
bool contains2D() const
bool contains3D() const
bool displayInfo() const
std::vector<std::string> getGroupNames()
std::vector<std::vector<size_t>> getGroups()
std::vector<size_t> getGroup(size_t iG)
bool renumberMesh(std::vector<size_t>)

Private Members

std::vector<Node> m_nodes
std::vector<Element> m_elements
std::string m_info
std::string m_error
size_t m_nN
size_t m_nE
float m_dist
float m_surf
float m_vol
bool m_1D
bool m_2D
bool m_3D
std::vector<std::string> m_groupNames
std::vector<std::vector<size_t>> m_groups
size_t m_nGroups
class Element

Public Functions

Element()
Element(int index, std::vector<Node*> nodes, int feDescriptor, int physicalProperty, int materialProperty, int color, int numberOfNodes)
~Element()
bool is1D() const
bool is2D() const
bool is3D() const
bool calculateVolume()
bool checkElem() const
bool getDisplay() const
int getIndex() const
bool setIndex(int newIndex)
int getFeDescriptor() const
int getPhysicalProperty() const
int getMaterialProperty() const
int getColor() const
bool computeAspectRatio()
int getAspectRatio() const
float getVolume() const
int getnN() const
std::vector<int> getNodesIds() const
bool setNodes(std::vector<Node*> newNodes)
Eigen::Matrix<float, Eigen::Dynamic, 3> getCoordinates() const

Private Members

int m_index
std::vector<Node*> m_nodes
int m_feDescriptor
int m_physicalProperty
int m_materialProperty
int m_color
int m_numberOfNodes
int m_aspectRatio
float m_vol
bool m_1D
bool m_2D
bool m_3D
class Node

Public Functions

Node()
Node(int index, float x, float y, float z)
Node(int index, float x, float y, float z, int groupId)
~Node()
int getIndex()
bool setIndex(int newId)
bool getDisplay() const
float getX() const
float getY() const
float getZ() const

Private Members

int m_id
int m_groupId
float m_coordinates[3]
class Setup

Subclassed by AcousticRotatingSetup, AcousticSetup

Public Functions

Setup()
virtual ~Setup()
bool set3D(bool dim)
bool setInfo(std::string value)
std::string getInfo() const
bool writeInfo(std::string info) const
bool setError(std::string value)
std::string getError() const
bool writeError(std::string error) const
bool readFrequencies(std::string fileToRead, int end)
bool readMicros(std::string fileToRead, int end)
bool readLoads(std::string fileToRead)
bool readRotatingParams(std::string fileToRead)
virtual int addAtribute(int cursor, std::string entry, std::string value) = 0
bool displayFrequencies()
std::vector<double> getFrequencies()
std::vector<int> getMics()
double getC()
virtual bool displayInfo() = 0
bool isLoaded()
size_t getAxis()
size_t getEta()
size_t getFsbcC()
size_t getN()
size_t getL()
float getRadius()
float getOmega()
bool getRotating()
std::string getInterfaceName()
size_t getInterfaceGroup()
bool setInterfaceGroup(size_t iG)

Protected Attributes

std::string m_setupFile
std::string m_path
bool m_loaded
std::string m_info
std::string m_error
std::vector<double> m_frequencies
std::vector<Node> m_micros
std::vector<int> m_microsIndex
std::vector<PointLoad> m_loads
std::vector<int> m_loadsListTemp
bool m_3D
bool m_nodal
bool timeOverMemory
double m_rho
double m_c
size_t m_couplingType
size_t m_axis
size_t m_eta
size_t m_C
size_t m_N
size_t m_L
float m_radius
float m_Omega
bool m_rotating
std::string m_interfaceName
size_t m_interfaceGroup
class PointLoad

Public Functions

PointLoad()
PointLoad(int index, std::vector<double> frequencies, std::vector<std::complex<double>> spectrum, std::vector<int> nodesTemp)
~PointLoad()
bool setNodes()
bool printLoad()

Private Members

int m_index
std::vector<double> m_frequencies
std::vector<std::complex<double>> m_spectrum
std::vector<int> m_nodesTemp
std::vector<Node*> m_nodes

notes

Rien pour l’instant