preCICE
v3.2.0
Loading...
Searching...
No Matches
src
testing
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
"
6
#include "
mesh/SharedPointer.hpp
"
7
8
namespace
precice::testing
{
9
10
inline
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
21
inline
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
28
inline
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
Mesh.hpp
Testing.hpp
precice::mesh::Mesh
Container and creator for meshes.
Definition
Mesh.hpp:38
std::make_shared
T make_shared(T... args)
SharedPointer.hpp
precice::mesh
provides Mesh, Data and primitives.
Definition
ScaleActionTest.cpp:20
precice::testing
contains the testing framework.
Definition
helper.hpp:9
precice::testing::nextMeshID
int nextMeshID()
Definition
Testing.cpp:86
precice::testing::addDummyVertices
void addDummyVertices(size_t nVertices, mesh::Mesh &mesh)
Definition
Meshes.hpp:10
precice::testing::makeDummy3DMesh
auto makeDummy3DMesh(size_t nVertices)
Definition
Meshes.hpp:28
precice::testing::makeDummy2DMesh
auto makeDummy2DMesh(size_t nVertices)
Definition
Meshes.hpp:21