diff --git a/PrimitivesGenerator.cc b/PrimitivesGenerator.cc index f0660d76a21703b6f98858db31c2d9c570f1722f..e3ce134cefba342519f957a9beb41bc14130e314 100644 --- a/PrimitivesGenerator.cc +++ b/PrimitivesGenerator.cc @@ -358,8 +358,7 @@ int PrimitivesGeneratorPlugin::addTetrahedralCuboid(const Vector& _position, object->setName("Cuboid " + QString::number(object_id)); - TetrahedralCuboidGenerator gen; - gen.generate(*(object->mesh()), _position, _length, n_x, n_y, n_z); + TetrahedralCuboidGenerator gen(*(object->mesh()), _position, _length, n_x, n_y, n_z); emit updatedObject(object_id, UPDATE_ALL); diff --git a/TetrahedralCuboidGenerator.cc b/TetrahedralCuboidGenerator.cc index 7991b79b12b5a7daef0a85a55f7e406370df1835..96cb1dd1df4b667c6fa06f8e52b533a0ae55cf7c 100644 --- a/TetrahedralCuboidGenerator.cc +++ b/TetrahedralCuboidGenerator.cc @@ -337,10 +337,14 @@ void TetrahedralCuboidGenerator::add_cube_type_2_cells(std::size_t i, std::size_ mesh_->add_cell(hf); } -void TetrahedralCuboidGenerator::generate(PolyhedralMesh& mesh, Vector const& position, - Vector const& length, unsigned const n_x, unsigned const n_y, unsigned const n_z) +TetrahedralCuboidGenerator::TetrahedralCuboidGenerator(PolyhedralMesh& mesh, + Vector const& position, + Vector const& length, + unsigned const n_x, + unsigned const n_y, + unsigned const n_z) : + mesh_(&mesh) { - mesh_ = &mesh; mesh_->clear(); size_[0] = n_x; diff --git a/TetrahedralCuboidGenerator.hh b/TetrahedralCuboidGenerator.hh index 938137786a710dca86fa46707314585a0b605e64..e5f0ba4e5e6ba6ea24ceb4e7f0aeae45e6f59a5f 100644 --- a/TetrahedralCuboidGenerator.hh +++ b/TetrahedralCuboidGenerator.hh @@ -75,8 +75,8 @@ inline bool operator<(SortedFace const& f1, SortedFace const& f2) class TetrahedralCuboidGenerator { public: - void generate(PolyhedralMesh& mesh, Vector const& position, Vector const& length, - unsigned const n_x, unsigned const n_y, unsigned const n_z); + TetrahedralCuboidGenerator(PolyhedralMesh& mesh, Vector const& position, Vector const& length, + unsigned const n_x, unsigned const n_y, unsigned const n_z); private: void add_vertices(Vector const& position, Vector const& length);