Skip to content

Commit

Permalink
Renames Driver to mesher
Browse files Browse the repository at this point in the history
  • Loading branch information
lmdiazangulo committed Jan 15, 2025
1 parent 5fa990e commit 8768c54
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 186 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ endif()

add_subdirectory(app)
add_subdirectory(core)
add_subdirectory(drivers)
add_subdirectory(meshers)
20 changes: 0 additions & 20 deletions src/drivers/CMakeLists.txt

This file was deleted.

20 changes: 20 additions & 0 deletions src/meshers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
message(STATUS "Creating build system for tessellator-meshers")

add_library(tessellator-meshers
"MesherBase.cpp"
"StructuredMesher.cpp"
)
target_link_libraries(tessellator-meshers tessellator-core tessellator-utils)

if (TESSELLATOR_ENABLE_CGAL)
target_sources(tessellator-meshers PRIVATE
"OffgridMesher.cpp"
)
target_link_libraries(tessellator-meshers tessellator-cgal)
endif()

if(TESSELLATOR_EXECUTION_POLICIES)
add_definitions(-DTESSELLATOR_EXECUTION_POLICIES)
find_package(TBB CONFIG REQUIRED)
target_link_libraries(tessellator-meshers TBB::tbb)
endif()
24 changes: 12 additions & 12 deletions src/drivers/DriverBase.cpp → src/meshers/MesherBase.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include "DriverBase.h"
#include "MesherBase.h"

#include <iostream>

#include "utils/MeshTools.h"
#include "utils/GridTools.h"

namespace meshlib {
namespace drivers {
namespace meshers {


using namespace utils;
using namespace meshTools;


void DriverBase::log(const std::string& msg, std::size_t level)
void MesherBase::log(const std::string& msg, std::size_t level)
{
std::cout << "[Tessellator] ";
for (std::size_t i = 0; i < level; i++) {
Expand All @@ -23,56 +23,56 @@ void DriverBase::log(const std::string& msg, std::size_t level)
std::cout << msg << std::endl;
}

void DriverBase::logNumberOfQuads(std::size_t nQuads)
void MesherBase::logNumberOfQuads(std::size_t nQuads)
{
std::stringstream msg;
msg << "Mesh contains " << nQuads << " quads.";
log(msg.str(), 2);
}

void DriverBase::logNumberOfTriangles(std::size_t nTris)
void MesherBase::logNumberOfTriangles(std::size_t nTris)
{
std::stringstream msg;
msg << "Mesh contains " << nTris << " triangles.";
log(msg.str(), 2);
}

void DriverBase::logNumberOfLines(std::size_t nLines)
void MesherBase::logNumberOfLines(std::size_t nLines)
{
std::stringstream msg;
msg << "Mesh contains " << nLines << " lines.";
log(msg.str(), 2);
}


void DriverBase::logNumberOfNodes(std::size_t nNodes)
void MesherBase::logNumberOfNodes(std::size_t nNodes)
{
std::stringstream msg;
msg << "Mesh contains " << nNodes << " nodes.";
log(msg.str(), 2);
}

void DriverBase::logGridSize(const Grid& g)
void MesherBase::logGridSize(const Grid& g)
{
std::stringstream msg;
msg << "Grid size is "
<< g[0].size() - 1 << "x" << g[1].size() - 1 << "x" << g[2].size() - 1;
log(msg.str(), 2);
}

DriverBase::DriverBase(const Mesh& inputMesh) : originalGrid_{inputMesh.grid}{
MesherBase::MesherBase(const Mesh& inputMesh) : originalGrid_{inputMesh.grid}{

logGridSize(inputMesh.grid);
logNumberOfTriangles(countMeshElementsIf(inputMesh, isTriangle));

enlargedGrid_ = getEnlargedGridIncludingAllElements(inputMesh);
}

Mesh DriverBase::buildSurfaceMesh(const Mesh& inputMesh) {
Mesh MesherBase::buildSurfaceMesh(const Mesh& inputMesh) {
return buildMeshFilteringElements(inputMesh, isNotTetrahedron);
}

Grid DriverBase::buildNonSlicingGrid(const Grid& primal, const Grid& enlarged)
Grid MesherBase::buildNonSlicingGrid(const Grid& primal, const Grid& enlarged)
{
assert(primal.size() >= 2);
assert(enlarged.size() >= 2);
Expand All @@ -92,7 +92,7 @@ Grid DriverBase::buildNonSlicingGrid(const Grid& primal, const Grid& enlarged)
return resultGrid;
}

Grid DriverBase::buildSlicingGrid(const Grid& primal, const Grid& enlarged)
Grid MesherBase::buildSlicingGrid(const Grid& primal, const Grid& enlarged)
{
const auto nonSlicing{ buildNonSlicingGrid(primal, enlarged) };
Grid r;
Expand Down
10 changes: 5 additions & 5 deletions src/drivers/DriverBase.h → src/meshers/MesherBase.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#pragma once

#include "types/Mesh.h"
#include "DriverInterface.h"
#include "MesherInterface.h"

namespace meshlib {
namespace drivers {
namespace meshers {

class DriverBase : public DriverInterface {
class MesherBase : public MesherInterface {
public:
DriverBase(const Mesh& in);
virtual ~DriverBase() = default;
MesherBase(const Mesh& in);
virtual ~MesherBase() = default;
virtual Mesh mesh() const = 0;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include "types/Mesh.h"

namespace meshlib::drivers {
namespace meshlib::meshers {

class DriverInterface {
class MesherInterface {
public:
virtual ~DriverInterface() = default;
virtual ~MesherInterface() = default;
virtual Mesh mesh() const = 0;

protected:
Expand Down
22 changes: 11 additions & 11 deletions src/drivers/OffgridDriver.cpp → src/meshers/OffgridMesher.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "OffgridDriver.h"
#include "OffgridMesher.h"

#include "DriverBase.h"
#include "MesherBase.h"
#include "core/Slicer.h"
#include "core/Collapser.h"
#include "core/Smoother.h"
Expand All @@ -13,7 +13,7 @@
#include "utils/Cleaner.h"
#include "utils/MeshTools.h"

namespace meshlib::drivers {
namespace meshlib::meshers {

using namespace utils;
using namespace meshTools;
Expand All @@ -40,8 +40,8 @@ Mesh buildVolumeMesh(const Mesh& inputMesh, const std::set<GroupId>& volumeGroup
return resultMesh;
}

OffgridDriver::OffgridDriver(const Mesh& in, const OffgridDriverOptions& opts) :
DriverBase::DriverBase(in),
OffgridMesher::OffgridMesher(const Mesh& in, const OffgridMesherOptions& opts) :
MesherBase::MesherBase(in),
opts_{ opts }
{
log("Preparing volumes.");
Expand All @@ -59,16 +59,16 @@ OffgridDriver::OffgridDriver(const Mesh& in, const OffgridDriverOptions& opts) :
log("Initial hull mesh built succesfully.");
}

Mesh OffgridDriver::buildSurfaceMesh(const Mesh& inputMesh, const std::set<GroupId>& volumeGroups)
Mesh OffgridMesher::buildSurfaceMesh(const Mesh& inputMesh, const std::set<GroupId>& volumeGroups)
{
auto resultMesh = DriverBase::buildSurfaceMesh(inputMesh);
auto resultMesh = MesherBase::buildSurfaceMesh(inputMesh);
for (const auto& gId : volumeGroups) {
resultMesh.groups[gId].elements.clear();
}
return resultMesh;
}

void OffgridDriver::process(Mesh& mesh) const
void OffgridMesher::process(Mesh& mesh) const
{
const auto slicingGrid{ buildSlicingGrid(originalGrid_, enlargedGrid_) };

Expand Down Expand Up @@ -113,7 +113,7 @@ void OffgridDriver::process(Mesh& mesh) const
}
}

Mesh OffgridDriver::mesh() const
Mesh OffgridMesher::mesh() const
{
log("Building primal mesh.");
Mesh res{ volumeMesh_ };
Expand All @@ -127,7 +127,7 @@ Mesh OffgridDriver::mesh() const
return res;
}

Filler OffgridDriver::fill(const std::vector<Priority>& groupPriorities) const
Filler OffgridMesher::fill(const std::vector<Priority>& groupPriorities) const
{
log("Building primal filler.", 1);

Expand All @@ -138,7 +138,7 @@ Filler OffgridDriver::fill(const std::vector<Priority>& groupPriorities) const
};
}

Filler OffgridDriver::dualFill(const std::vector<Priority>& groupPriorities) const
Filler OffgridMesher::dualFill(const std::vector<Priority>& groupPriorities) const
{
log("Building dual filler.", 1);
const auto dGrid{ GridTools{ originalGrid_ }.getExtendedDualGrid() };
Expand Down
14 changes: 7 additions & 7 deletions src/drivers/OffgridDriver.h → src/meshers/OffgridMesher.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

#include "cgal/filler/Filler.h"
#include "types/Mesh.h"
#include "DriverBase.h"
#include "OffgridDriverOptions.h"
#include "MesherBase.h"
#include "OffgridMesherOptions.h"

namespace meshlib {
namespace drivers {
namespace meshers {

using namespace cgal;

class OffgridDriver : public DriverBase {
class OffgridMesher : public MesherBase {
public:
OffgridDriver(const Mesh& in, const OffgridDriverOptions& opts = OffgridDriverOptions());
virtual ~OffgridDriver() = default;
OffgridMesher(const Mesh& in, const OffgridMesherOptions& opts = OffgridMesherOptions());
virtual ~OffgridMesher() = default;
Mesh mesh() const;

filler::Filler fill(
Expand All @@ -22,7 +22,7 @@ class OffgridDriver : public DriverBase {
const std::vector<Priority>& groupPriorities = std::vector<Priority>()) const;

private:
OffgridDriverOptions opts_;
OffgridMesherOptions opts_;

Mesh volumeMesh_;
Mesh surfaceMesh_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "core/SnapperOptions.h"

namespace meshlib::drivers {
namespace meshlib::meshers {

class OffgridDriverOptions {
class OffgridMesherOptions {
public:

bool forceSlicing = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "StructuredDriver.h"
#include "StructuredMesher.h"

#include <iostream>

Expand All @@ -11,22 +11,22 @@
#include "utils/MeshTools.h"
#include "utils/GridTools.h"

namespace meshlib::drivers {
namespace meshlib::meshers {

using namespace utils;
using namespace core;
using namespace meshTools;


Mesh StructuredDriver::buildSurfaceMesh(const Mesh& inputMesh, const Mesh & volumeSurface)
Mesh StructuredMesher::buildSurfaceMesh(const Mesh& inputMesh, const Mesh & volumeSurface)
{
auto resultMesh = DriverBase::buildSurfaceMesh(inputMesh);
auto resultMesh = MesherBase::buildSurfaceMesh(inputMesh);
mergeMesh(resultMesh, volumeSurface);
return resultMesh;
}

StructuredDriver::StructuredDriver(const Mesh& inputMesh, int decimalPlacesInCollapser) :
DriverBase(inputMesh),
StructuredMesher::StructuredMesher(const Mesh& inputMesh, int decimalPlacesInCollapser) :
MesherBase(inputMesh),
decimalPlacesInCollapser_(decimalPlacesInCollapser)
{
log("Preparing surfaces.");
Expand All @@ -38,7 +38,7 @@ StructuredDriver::StructuredDriver(const Mesh& inputMesh, int decimalPlacesInCol
log("Initial hull mesh built succesfully.");
}

void StructuredDriver::process(Mesh& mesh) const
void StructuredMesher::process(Mesh& mesh) const
{

const auto slicingGrid{ buildSlicingGrid(originalGrid_, enlargedGrid_) };
Expand Down Expand Up @@ -73,7 +73,7 @@ void StructuredDriver::process(Mesh& mesh) const
}


Mesh StructuredDriver::mesh() const
Mesh StructuredMesher::mesh() const
{
log("Building primal mesh.");
Mesh resultMesh{ surfaceMesh_ };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include "types/Mesh.h"
#include "DriverBase.h"
#include "MesherBase.h"

namespace meshlib::drivers {
namespace meshlib::meshers {

class StructuredDriver : public DriverBase {
class StructuredMesher : public MesherBase {
public:
StructuredDriver(const Mesh& in, int decimalPlacesInCollapser = 4);
virtual ~StructuredDriver() = default;
StructuredMesher(const Mesh& in, int decimalPlacesInCollapser = 4);
virtual ~StructuredMesher() = default;
Mesh mesh() const;

private:
Expand Down
Loading

0 comments on commit 8768c54

Please sign in to comment.