Newer
Older
/**
* Mesh.h
*
* Date: 2012/05/02
* Author: KR
*/
#ifndef MESH_H_
#define MESH_H_
#include <cstdlib>
#include <vector>
Karsten Rink
committed
namespace MeshLib
{
class Node;
class Element;
class Mesh
{
Karsten Rink
committed
/// 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);
Mesh(const Mesh &mesh);
virtual ~Mesh();
/// Add a node to the mesh.
void addNode(Node* node);
/// Add an element to the mesh.
void addElement(Element* elem);
/// Get the node with the given index.
Karsten Rink
committed
const Node* getNode(unsigned idx) const { return _nodes[idx]; };
/// Get the element with the given index.
Karsten Rink
committed
const Element* getElement(unsigned idx) const { return _elements[idx]; };
/// Get the number of elements
size_t getNElements() const { return _elements.size(); };
/// Get the number of nodes
size_t getNNodes() const { return _nodes.size(); };
const std::string getName() const { return _name; };
const std::vector<Node*> getNodes() const { return _nodes; };
const std::vector<Element*> getElements() const { return _elements; };
Karsten Rink
committed
/// Checks the coordinates of all mesh nodes and removes identical nodes. Elements are adapted accordingly.
Karsten Rink
committed
void makeNodesUnique();
/// Fills in the neighbor-information for nodes (i.e. which element each node belongs to).
void setElementInformationForNodes();
/// Fills in the neighbor-information for elements.
void setNeighborInformationForElements();
std::string _name;
std::vector<Node*> _nodes;
std::vector<Element*> _elements;
}; /* class */
} /* namespace */
#endif /* MESH_H_ */