Skip to content
Snippets Groups Projects
Commit 61dcb7f0 authored by Karsten Rink's avatar Karsten Rink
Browse files

Added basic documentation

parent 67f3dea4
No related branches found
No related tags found
No related merge requests found
......@@ -18,16 +18,23 @@ namespace MeshLib {
class Cell : public Element
{
public:
/// Get the volume of this 3d element.
virtual double getVolume() const { return _volume; };
/// Get dimension of the mesh element.
size_t getDimension() const { return 3; };
/// Destructor
virtual ~Cell();
protected:
/// Constructor for a generic mesh element containing an array of mesh nodes.
Cell(Node** nodes, MshElemType::type type, size_t value = 0);
/// Constructor for a generic mesh element without an array of mesh nodes.
Cell(MshElemType::type type, size_t value = 0);
/// Calculate the volume of this 3d element.
virtual double calcVolume() = 0;
double _volume;
......
......@@ -23,19 +23,30 @@ class Node;
class Edge : public Element
{
public:
/// Constructor with an array of mesh nodes.
Edge(Node* nodes[2], size_t value = 0);
/// Constructor using single nodes
Edge(Node* n1, Node* n2, size_t value = 0);
/// Copy constructor
Edge(const Edge &edge);
/// Destructor
virtual ~Edge();
/// Get the length of this 1d element.
double getLength() const { return _length; };
/// Get dimension of the mesh element.
size_t getDimension() const { return 1; };
/// Get the number of nodes for this element.
size_t getNNodes() const { return 2; };
protected:
/// Calculate the length of this 1d element.
double calcLength();
double _length;
......
......@@ -21,23 +21,35 @@ class Node;
class Element
{
public:
/// Get node with local index i.
const Node* getNode(size_t i) const;
/// Get array of element nodes.
Node* const* getNodes() const { return _nodes; };
/// Get dimension of the mesh element.
virtual size_t getDimension() const = 0;
/// Get the number of nodes for this element.
virtual size_t getNNodes() const = 0;
/// Get the global index for the node with local index i.
size_t getNodeIndex(size_t i) const;
/// Get the type of the mesh element (as a MshElemType-enum).
MshElemType::type getType() const { return _type; };
/// Get the value for this element.
size_t getValue() const { return _value; };
/// Destructor
virtual ~Element();
protected:
/// Constructor for a generic mesh element containing an array of mesh nodes.
Element(Node** nodes, MshElemType::type type, size_t value = 0);
/// Constructor for a generic mesh element without an array of mesh nodes.
Element(MshElemType::type type, size_t value = 0);
MshElemType::type _type;
......
......@@ -18,16 +18,23 @@ namespace MeshLib {
class Face : public Element
{
public:
/// Get the area of this 2d element.
virtual double getArea() const { return _area; };
/// Get dimension of the mesh element.
size_t getDimension() const { return 2; };
/// Destructor
virtual ~Face();
protected:
/// Constructor for a generic mesh element containing an array of mesh nodes.
Face(Node** nodes, MshElemType::type type, size_t value = 0);
/// Constructor for a generic mesh element without an array of mesh nodes.
Face(MshElemType::type type, size_t value = 0);
/// Calculate the area of this 2d element.
virtual double calcArea() = 0;
double _area;
......
......@@ -31,10 +31,16 @@ namespace MeshLib {
class Hex : public Cell
{
public:
/// Constructor with an array of mesh nodes.
Hex(Node* nodes[8], size_t value = 0);
/// Copy constructor
Hex(const Hex &hex);
/// Destructor
virtual ~Hex();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 8; };
protected:
......
......@@ -29,11 +29,19 @@ namespace MeshLib {
class Prism : public Cell
{
public:
/// Constructor with an array of mesh nodes.
Prism(Node* nodes[6], size_t value = 0);
/// Constructor using single mesh nodes.
Prism(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5, size_t value = 0);
/// Copy constructor
Prism(const Prism &prism);
/// Destructor
virtual ~Prism();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 6; };
protected:
......
......@@ -29,11 +29,19 @@ namespace MeshLib {
class Pyramid : public Cell
{
public:
/// Constructor with an array of mesh nodes.
Pyramid(Node* nodes[5], size_t value = 0);
/// Constructor using single mesh nodes.
Pyramid(Node* n0, Node* n1, Node* n2, Node* n3, Node* n4, size_t value = 0);
/// Copy constructor
Pyramid(const Pyramid &pyramid);
/// Destructor
virtual ~Pyramid();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 5; };
protected:
......
......@@ -28,11 +28,19 @@ namespace MeshLib {
class Quad : public Face
{
public:
/// Constructor with an array of mesh nodes.
Quad(Node* nodes[4], size_t value = 0);
/// Constructor using single mesh nodes.
Quad(Node* n0, Node* n1, Node* n2, Node* n3, size_t value = 0);
/// Copy constructor
Quad(const Quad &quad);
/// Destructor
virtual ~Quad();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 4; };
protected:
......
......@@ -30,11 +30,19 @@ namespace MeshLib {
class Tet : public Cell
{
public:
/// Constructor with an array of mesh nodes.
Tet(Node* nodes[4], size_t value = 0);
/// Constructor using single mesh nodes.
Tet(Node* n0, Node* n1, Node* n2, Node* n3, size_t value = 0);
/// Copy constructor
Tet(const Tet &tet);
/// Destructor
virtual ~Tet();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 4; };
protected:
......
......@@ -29,11 +29,19 @@ namespace MeshLib {
class Tri : public Face
{
public:
/// Constructor with an array of mesh nodes.
Tri(Node* nodes[3], size_t value = 0);
/// Constructor using single mesh nodes.
Tri(Node* n0, Node* n1, Node* n2, size_t value = 0);
/// Copy constructor
Tri(const Tri &tri);
/// Destructor
virtual ~Tri();
/// Get the number of nodes for this element.
size_t getNNodes() const { return 3; };
protected:
......
......@@ -12,13 +12,25 @@
namespace MeshLib {
/**
* A finite element mesh.
*/
class FemMesh : public Mesh
{
public:
/// Constructor using a mesh name and an array of nodes and elements
FemMesh(const std::string &name, const std::vector<Node*> &nodes, const std::vector<Element*> &elements);
/// Constructor using a basic mesh
FemMesh(const Mesh &mesh);
/// Copy constructor
FemMesh(const FemMesh &mesh);
/// Constructor for reading a mesh from a file
FemMesh(const std::string &file_name);
/// Destructor
~FemMesh();
......
......@@ -12,13 +12,25 @@
namespace MeshLib {
/**
* A mesh node for finite element meshes.
*/
class FemNode : public Node
{
public:
/// Constructor using a coordinate array
FemNode(double const*const coords, size_t id = std::numeric_limits<size_t>::max());
/// Constructor using single coordinates
FemNode(double x, double y, double z, size_t id = std::numeric_limits<size_t>::max());
/// Constructor using a mesh node
FemNode(const Node &node);
/// Copy constructor
FemNode(const FemNode &node);
/// Destructor
~FemNode();
}; /* class */
......
......@@ -16,19 +16,35 @@ namespace MeshLib {
class Node;
class Element;
/**
* A basic mesh.
*/
class Mesh
{
public:
/// Constructor using a mesh name and an array of nodes and elements
Mesh(const std::string &name, const std::vector<Node*> &nodes, const std::vector<Element*> &elements);
/// Copy constructor
Mesh(const Mesh &mesh);
/// Constructor for reading a mesh from a file
Mesh(const std::string &file_name);
/// Destructor
virtual ~Mesh();
/// Get name of the mesh.
const std::string getName() const { return _name; };
/// Get the nodes-vector for the mesh.
const std::vector<Node*> getNodes() const { return _nodes; };
/// Get the element-vector for the mesh.
const std::vector<Element*> getElements() const { return _elements; };
protected:
/// Checks the coordinates of all mesh nodes and removes identical nodes. Elements are adapted accordingly.
void removeIdenticalNodes();
std::string _name;
......
......@@ -9,7 +9,7 @@
namespace MeshLib {
Node::Node(double const*const coords, size_t id)
Node::Node(const double coords[3], size_t id)
: GEOLIB::PointWithID(coords, id)
{
}
......
......@@ -23,9 +23,16 @@ class Element;
class Node : public GEOLIB::PointWithID
{
public:
Node(double const*const coords, size_t id = std::numeric_limits<size_t>::max());
/// Constructor using a coordinate array
Node(const double coords[3], size_t id = std::numeric_limits<size_t>::max());
/// Constructor using single coordinates
Node(double x, double y, double z, size_t id = std::numeric_limits<size_t>::max());
/// Copy constructor
Node(const Node &node);
/// Destructor
~Node();
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment