MDAL
Public Member Functions | List of all members
MDAL::Driver2dm Class Reference

2DM format specification used in TUFLOW, HYDRO_AS-2D and BASEMENET solvers Text file format representing mesh vertices (ND) and faces (E**) ND id x y z The format supports lines, triangles and quads, where the elememts could be stored with some intermediate points (e.g. More...

#include <mdal_2dm.hpp>

Inheritance diagram for MDAL::Driver2dm:
MDAL::Driver

Public Member Functions

Driver2dmcreate () override
 
int faceVerticesMaximumCount () const override
 returns the maximum vertices per face
 
bool canReadMesh (const std::string &uri) override
 
std::unique_ptr< Meshload (const std::string &meshFile, const std::string &meshName="") override
 
void save (const std::string &fileName, const std::string &, Mesh *mesh) override
 
std::string saveMeshOnFileSuffix () const override
 
- Public Member Functions inherited from MDAL::Driver
 Driver (const std::string &name, const std::string &longName, const std::string &filters, int capabilityFlags)
 
std::string name () const
 
std::string longName () const
 
std::string filters () const
 
bool hasCapability (Capability capability) const
 
bool hasWriteDatasetCapability (MDAL_DataLocation location) const
 
virtual std::string writeDatasetOnFileSuffix () const
 
virtual bool canReadDatasets (const std::string &uri)
 
virtual std::string buildUri (const std::string &meshFile)
 
virtual void load (const std::string &uri, Mesh *mesh)
 
virtual void createDatasetGroup (Mesh *mesh, const std::string &groupName, MDAL_DataLocation dataLocation, bool hasScalarData, const std::string &datasetGroupFile)
 
virtual void createDataset (DatasetGroup *group, RelativeTimestamp time, const double *values, const int *active)
 
virtual void createDataset (DatasetGroup *group, RelativeTimestamp time, const double *values, const int *verticalLevelCount, const double *verticalExtrusion)
 
virtual bool persist (DatasetGroup *group)
 

Detailed Description

2DM format specification used in TUFLOW, HYDRO_AS-2D and BASEMENET solvers Text file format representing mesh vertices (ND) and faces (E**) ND id x y z The format supports lines, triangles and quads, where the elememts could be stored with some intermediate points (e.g.

triangle defined by 6 vertices, vertices and the middle of the edges) We do support only simple definition, so E6T, E8Q and E9Q are not supported. E3T id 1 2 3 mat_id -> face type, id, vertex indices ..., material index

full specification here: https://www.xmswiki.com/wiki/SMS:2D_Mesh_Files_*.2dm

This will process as many material IDs as promised by the NUM_MATERIALS_PER_ELEM tag and add them as face dataset groups. The naming for these groups is "Material ID" for the first, "Bed Elevation (Face)" for the second, and finally "Auxiliary Material ID <X>" for any subsequent materials, X being a counter to ensure unique group names: E** id 1 2 3 [Material ID] [Bed Elevation (Face)] [Auxiliary Material ID 1] [Auxiliary Material ID 2] ... If the NUM_MATERIALS_PER_ELEM tag is not provided, a fallback mode is used that will only check for the second MATID column and add it under the name "Bed Elevation (Face)" if found. Noe that this is purely a compatibility mode for BASEMENT 3.x releases; NUM_MATERIALS_... is a required tag according to the 2DM specification.

Note that some 2dm formats do have some extra columns after mat_id column with data with unknown origin/name (e.g. tests/data/2dm/regular_grid.2dm)

HYDRO_AS-2D also allows gaps in vertex indexing. In this case we support only files where the vertices are sorted by ID in the source file (limitation of the implementation)

Vertex/Face IDs should be indexed from 1. We support indexing from 0 for datasets in xmdf format, but not for ascii dat format (since the loop is from 0 to maximumVertexId() which is in this case numberical_limits<size_t>::max(); (limitation of the implementation)


The documentation for this class was generated from the following files: