Defines an abstract cell of a mesh. More...
#include <MeshVizXLM/mesh/cell/MiCell.h>
Public Member Functions | |
virtual | ~MiCell () |
virtual size_t | getNumNodes () const =0 |
virtual size_t | getNodeIndex (size_t node) const =0 |
virtual double | getRelativeSize (const MiGeometryI *meshGeometry) const |
virtual void | getWeight (const MbVec3d &ipcoord, std::vector< double > &weight) const |
virtual MbVec3d | getIsoParametricCoord (size_t nodeIndex) const |
virtual MbVec3d | getCenter (const MiGeometryI &geometry) const |
virtual bool | isPointInsideCell (const MiGeometryI &meshGeometry, const MbVec3d &point, std::vector< double > &weights) const |
Protected Member Functions | |
virtual std::ostream & | toStream (std::ostream &s) const |
Friends | |
std::ostream & | operator<< (std::ostream &s, const MiCell &cell) |
A cell is a basic volume, surface or edge element that connects adjacent nodes of a mesh. The MiCell interface is necessary to define the topology of unstructured 1D, 2D or 3D meshes.
MiCell is the base class that defines topological characteristics of a cell (characteristics not depending on the cell dimension).
These methods must be overridden by the appplication as they are pure virtual. The characteristics that depend on the cell dimension are defined in the derived interfaces MiLineCell for 1D cells, MiSurfaceCell for 2D cells, and MiVolumeCell for 3D cells.
MiCell also defines additional methods with a default implementation. A default implementation is provided in 2 cases:
virtual MiCell::~MiCell | ( | ) | [inline, virtual] |
Virtual destructor.
MbVec3d MiCell::getCenter | ( | const MiGeometryI & | geometry | ) | const [inline, virtual] |
Gets the center of the cell.
This method is not pure virtual because it is not used by all extraction classes. The default implementation provided computes the average of the coordinates of each cell's node.
[in] | geometry | The geometry of the mesh. Used to retrieve the node coordinates of this cell. |
virtual MbVec3d MiCell::getIsoParametricCoord | ( | size_t | nodeIndex | ) | const [inline, virtual] |
Gets the iso parametric coordinates of a cell's node.
Only classes defining non linear cells must implement this method.
The interval value of parametric coordinates are usually [0,1] or [-1,+1]. If the application uses interval [0,1], the parametric coordinates returned by this method for linear cell must be either 0 or 1. For quadratic cell, the parametric coordinates must be either 0, 0.5 or 1. (0.5 for intermediate nodes).
See the following image as example of parametric coordinates values for linear and quadratic quadrangle.
parametric coordinates in [-1,+1]
parametric coordinates in [0,1]
This method is not pure virtual because it is not used by all extraction classes. However using an extraction class that uses this method will generate an exception. An application does not need to override this method if no such extraction class is used.
[in] | nodeIndex | The index of the node. |
virtual size_t MiCell::getNodeIndex | ( | size_t | node | ) | const [pure virtual] |
Gets the index (in the mesh) of a node.
[in] | node | Node number (where: 0 <= node < getNumNodes()). |
virtual size_t MiCell::getNumNodes | ( | ) | const [pure virtual] |
Gets the number of nodes.
This number must include the additional nodes of non linear cells. For instance getNumNodes() for a quadratic triangle cell should return 6.
virtual double MiCell::getRelativeSize | ( | const MiGeometryI * | meshGeometry | ) | const [inline, virtual] |
Gets the relative size of the cell.
This method is used only by the MoMeshCellShape to display node names if using the relative offset feature and the streamline extraction to adapt the step integration to the size of the cell. getRelativeSize() should return a value depending on the size of the cell even if the default implementation returns 1. For instance, getRelativeSize() can return the length of the longest edge of this cell, or the length of its diagonal.
If getRelativeSize() returns a constant value for any cell, the stream line extraction uses a constant number of step integration anywhere in the mesh. Returning a constant implies that all the cells are supposed to have the same size. getRelativeSize() must not return 0.
[in] | meshGeometry | the geometry of the mesh. Used to retrieve the node coordinates of this cell. |
virtual void MiCell::getWeight | ( | const MbVec3d & | ipcoord, | |
std::vector< double > & | weight | |||
) | const [inline, virtual] |
Gets the weights of a point defined by its iso parametric coordinates.
Only classes defining non linear cells must implement this method.
A weight value (aka shape function) must be given for each node of the cell. The weight must respect the following rules:
See chapter "Properties of shape functions" in the User's Guide for more details. This method is not pure virtual because it is not used by all extraction classes. However using an extraction class that uses this method will generate an exception. An application does not need to override this method if no such extraction class is used.
[in] | ipcoord | iso parametric coordinates of the points where the weights must be evaluated. |
[out] | weight | Must contain at least as many elements as the number of nodes in this cell. |
weight[i] = wi
virtual bool MiCell::isPointInsideCell | ( | const MiGeometryI & | meshGeometry, | |
const MbVec3d & | point, | |||
std::vector< double > & | weights | |||
) | const [inline, virtual] |
Checks if a point is inside or outside a cell.
This method is not pure virtual because it is not used by all extraction classes. However using an extraction class that uses this method (i.e. streamline) will generate an exception. An application does not need to override this method if no such extraction class is used.
[in] | meshGeometry | The geometry of the mesh. Used to retrieve the node coordinates of this cell. |
[in] | point | The point to be checked. |
[out] | weights | Must contain at least as many elements as the number of nodes in this cell (see getWeight()). |
weight[i] = wi
std::ostream & MiCell::toStream | ( | std::ostream & | s | ) | const [inline, protected, virtual] |
Performs an output operation on a stream which is returned afterward. This method is protected since only called by the output operator <<. This method is not pure virtual and output by default the geometry and topology of a mesh. Whenever a different output is needed, this method can be implemented in the subclass to get a different output format. No std::ostream& operator << needs to be defined in any subclass. This allows you to benefit from the virtual inheritance when using the output operator on an abstract class.
Reimplemented in MiVolumeCell.
std::ostream& operator<< | ( | std::ostream & | s, | |
const MiCell & | cell | |||
) | [friend] |
Outputs the mesh to a stream using the toStream protected method implemented in all derived classes.