preCICE v3.2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Meshes.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Eigen/Core"
4#include "Testing.hpp"
5#include "mesh/Mesh.hpp"
7
8namespace precice::testing {
9
10inline void addDummyVertices(size_t nVertices, mesh::Mesh &mesh)
11{
12 for (size_t i = 0; i < nVertices; ++i) {
13 if (mesh.getDimensions() == 2) {
14 mesh.createVertex(Eigen::Vector2d(i, 0.0));
15 } else {
16 mesh.createVertex(Eigen::Vector3d(i, 0.0, 0.0));
17 }
18 }
19}
20
21inline auto makeDummy2DMesh(size_t nVertices)
22{
23 auto mesh = std::make_shared<mesh::Mesh>("DummyMesh2D", 2, testing::nextMeshID());
24 addDummyVertices(nVertices, *mesh);
25 return mesh;
26}
27
28inline auto makeDummy3DMesh(size_t nVertices)
29{
30 auto mesh = std::make_shared<mesh::Mesh>("DummyMesh3D", 3, testing::nextMeshID());
31 addDummyVertices(nVertices, *mesh);
32 return mesh;
33}
34
35} // namespace precice::testing
Container and creator for meshes.
Definition Mesh.hpp:38
int getDimensions() const
Definition Mesh.cpp:100
Vertex & createVertex(const Eigen::Ref< const Eigen::VectorXd > &coords)
Creates and initializes a Vertex object.
Definition Mesh.cpp:105
T make_unique(T... args)
contains the testing framework.
Definition helper.hpp:9
void addDummyVertices(size_t nVertices, mesh::Mesh &mesh)
Definition Meshes.hpp:10
auto makeDummy3DMesh(size_t nVertices)
Definition Meshes.hpp:28
auto makeDummy2DMesh(size_t nVertices)
Definition Meshes.hpp:21