2.3.7. swMesh

Defined in swCore/swCore.h

class swMesh : public QObject

Public Types

using ComponentCoordsView = xt::xview<xt::xarray<double>&, xt::xall<std::size_t>, std::size_t>
using CellZbCoordsView = ComponentCoordsView
using CellAreasView = ComponentCoordsView
using NodeXCoordsView = ComponentCoordsView
using NodeYCoordsView = ComponentCoordsView
using NodeZCoordsView = ComponentCoordsView

Public Functions

swMesh(void)

Construct an empty mesh.

swMesh(swParam *param, swData *data)

Construct an empty mesh with param.

~swMesh(void)

Destroys the mesh and its content.

bool build(void)

swCell *cellIdFromCoordinates(double x, double y)

Returns the id of the cell containing the point with coordinates (x, y)

bool read(void)

Read mesh from file Possible formats: .geo, .swm.

Return

boolean indicating successful read or not

Parameters
  • filename: name of the geometry or mesh file

bool readGeo(const QString &filename)

Read a .geo file and construct all mesh data from it.

Parameters
  • filename: name of the .geo file

void setCoordsNode(const std::vector<double> &x_node, const std::vector<double> &y_node, const std::vector<double> &z_node)
void setCellToNodes(const std::vector<std::vector<int>> &cell_to_nodes)
size_t getNbBC(void) const
size_t getNbCells(void) const
size_t getNbEdges(void) const
size_t getNbEdgesBoundary(void) const

size_t getNbEdgesIntern(void) const

size_t getNbLayers(void) const
std::size_t getNbNodes(void) const

Returns the total number of nodes.

Check if x and y vectors have the same size

size_t getNbNodestring(void) const
auto getCellAreaArray(void) const

Returns the area vector of all cells.

auto getCellZbArray(void) const

Get values of a cell field name for all cells.

Get list of cells fields names

Return

xarray containing field’s value for all cells;

Parameters
  • name: field’s name

  • layer: layer’s index

Returns vector of all cell bottom elevation

const std::vector<swEdge *> getBoundaryArray(size_t ns)

Returns area of cell cell_id.

Returns number of neighbouring cells of the cell

cell_id. Same result as swMesh::getNbIntCell() for cells inside the domain.
Parameters
  • cell_id: index of the cell

param cell_id index of the cell

Returns x-coordinate of the center of gravity of cell cell_id

Returns y-coordinate of the center of gravity of cell

cell_id
Parameters
  • cell_id: index of the cell

Get values of a node field

name for all nodes
Parameters
  • cell_id: index of the cell

Set field values

field for all cells
Return

xarray containing field’s value for all nodes

Parameters
  • name: field’s name

  • layer: layer’s index

Get values of a interface field

name for all interfaces
Parameters
  • field: field’s values;

  • name: field’s name;

  • layer: layer’s index

Get list of interfaces fields names

Return

xarray containing field’s value for all interfaces

Parameters
  • name: field’s name

  • layer: layer’s index

const xt::xarray<double> &getNodeCoordsArray(void) const

Returns array of all nodes’s coordinates.

auto getNodeXArray(void) const

Get list of nodes fields names.

Returns vector of all x-coordinates of nodes

auto getNodeYArray(void) const

Returns vector of all y-coordinates of nodes.

auto getNodeZArray(void) const

Returns vector of all z-coordinates of nodes.

std::vector<swCell *> getCells()
std::vector<swNode *> getNodes()
std::vector<swEdge *> getEdges()
std::vector<swEdgeBoundary *> getEdgesBoundary()
std::vector<swEdgeIntern *> getEdgesIntern()
bool writeLog(void)
bool writeLogCell(void)
bool writeLogInterf(void)
bool writeLogNode(void)

Signals

void fieldAdded(const QString &field, int layer)

Private Functions

void buildCell(std::vector<size_t> cell_sms_id, std::vector<std::vector<size_t>> cell_nodes)

void buildEdge()

void computeGravityArea()
void setEdgeBoundary(std::vector<std::vector<size_t>> ns, std::vector<int> ns_name)
void setCellProperties()
void setEdgeProperties()
void setNodeProperties()

Set field values field for all interfaces.

Parameters
  • field: field’s values;

  • name: field’s name;

  • layer: layer’s index

Private Members

class swMeshPrivate *d
swData *m_data
swParam *m_param