Input#

Overview#

The Polyhedral Gravity Model comes with multiple ways of processing input. In general, there are the two abstract interfaces ConfigSource and DataSource and their respective implementations YAMLConfigReader and TetgenAdapter. The first duet is used for getting the information what execrably to calculate, whereas the second duet is used for processing the polyhedral source.

Abstract Interfaces#

class ConfigSource#

Interface defining methods giving the calculation some input. This includes the points of interest as well as the source of the data.

Subclassed by polyhedralGravity::YAMLConfigReader

Public Functions

virtual ~ConfigSource() = default#
virtual std::string getOutputFileName() = 0#

Returns the specified output file name.

Returns:

a std::string with the filename

virtual double getDensity() = 0#

Returns the constant density rho of the given polyhedron. The unit must match to the mesh, e.g., mesh in \([m]\) requires density in \([kg/m^3]\). The density is required for the calculation.

Returns:

density as double

virtual std::vector<std::array<double, 3>> getPointsOfInterest() = 0#

The vector contains the points for which the polyhedral gravity model should be evaluated.

Returns:

vector of points

virtual bool getMeshInputCheckStatus() = 0#

Returns the activation status of the input polyhedron mesh sanity check.

Returns:

true if enabled

virtual std::shared_ptr<DataSource> getDataSource() = 0#

The DataSource of the given Polyhedron.

Returns:

data source (e. g. a file reader)

class DataSource#

Interface consisting of a method which returns a polyhedron.

Subclassed by polyhedralGravity::TetgenAdapter

Public Functions

virtual ~DataSource() = default#

Default destructor of DataSource

virtual std::tuple<std::vector<Array3>, std::vector<IndexArray3>> getPolyhedralSource() = 0#

Returns a Polyhedron from the underlying source.

Returns:

a polyhedron

Implementations#

class YAMLConfigReader : public polyhedralGravity::ConfigSource#

The YAMLConfigReader serves as Interface between yaml-cpp and the Polyhedral Gravity Model and reads in the input from an yaml configuration file.

Public Functions

inline explicit YAMLConfigReader(const std::string &filename)#

Creates a new YAML Config Reader.

Parameters:

filename – a reference to a string

Throws:

an – exception if the file is malformed or cannot be loaded or if the ROOT node is not found

inline explicit YAMLConfigReader(std::string &&filename)#

Creates a new YAML Config Reader.

Parameters:

filename – a movable string

Throws:

an – exception if the file is malformed or cannot be loaded or if the ROOT node is not found

virtual std::string getOutputFileName() override#

Returns the specified output filename. If none is specified an empty string will be returned.

Returns:

a filename a std::string or an empty string if none is specified

virtual double getDensity() override#

Reads the density from the yaml configuration file.

Returns:

density as double

virtual std::vector<std::array<double, 3>> getPointsOfInterest() override#

Reads the computation points from the yaml configuration file.

Returns:

vector of computation points

virtual bool getMeshInputCheckStatus() override#

Reads the enablement of the input sanity check from the yaml file.

Returns:

true or false if explicitly enabled, otherwise per-default true

virtual std::shared_ptr<DataSource> getDataSource() override#

Reads the DataSource from the yaml configuration file.

Returns:

shared_ptr to the DataSource Object created

class TetgenAdapter : public polyhedralGravity::DataSource#

An adapter to the Tetgen Library. This is the interface between tetgen’s data structures and I/O capabilities and the here implemented polyhedral gravity model. The adapter always converts tetgen’s datastructure into the structure utilized by the Polyhedral Gravity Model.

The Adapter further keeps en eye on the already read in files in order to give feedback if data is in conflict.

Public Functions

inline explicit TetgenAdapter(std::vector<std::string> fileNames)#

Constructs a new TetgenAdapter from a vector of filenames. These filenames should end on the supported suffixes

Parameters:

fileNames – vector of filenames

virtual std::tuple<std::vector<Array3>, std::vector<IndexArray3>> getPolyhedralSource() override#

Use this function to get a Polyhedron. This functions consists of two steps. First, the Adapter will delegate I/O to the tetgen library and read in the Polyhedron data in the library’s datastructure. Second, tetgen’s datastructure is then converted to a Polyhedron.

Returns:

a Polyhedron

void readNode(const std::string &filename)#

Reads nodes from a .node file

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the nodes already have been defined

void readFace(const std::string &filename)#

Reads faces from a .face file

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the faces already have been defined

void readOff(const std::string &filename)#

Reads elements from a .off file (Geomview’s polyhedral file format)

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the elements already have been defined

void readPly(const std::string &filename)#

Reads elements from a .ply file (Polyhedral file format)

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the elements already have been defined

void readStl(const std::string &filename)#

Reads elements from a .stl file (Stereolithography format)

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the elements already have been defined

void readMesh(const std::string &filename)#

Reads elements from a .mesh file (Medit’s mesh file format)

Parameters:

filename – of the input source without suffix

Throws:

an – exception if the elements already have been defined