Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq g++ openmpi-bin openmpi-common libopenmpi-dev hdf5-tools libhdf5-openmpi-103 libhdf5-openmpi-dev libnetcdf-dev
sudo apt-get install -qq g++ openmpi-bin openmpi-common libopenmpi-dev hdf5-tools libhdf5-openmpi-dev libnetcdf-dev

- name: Configure PUMGen
working-directory: ${{ github.workspace }}
Expand Down
10 changes: 6 additions & 4 deletions src/input/EasiMeshSize.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "EasiMeshSize.h"
#include <unordered_map>
#include <utils/logger.h>

#include <tuple>
#include <utility>

EasiMeshSize::EasiMeshSize() : parser(nullptr), model(nullptr), query(easi::Query(1, 3)) {}
EasiMeshSize::EasiMeshSize() : parser(nullptr), model(nullptr) {}

EasiMeshSize::EasiMeshSize(VelocityAwareRefinementSettings refinementSettings, pGModel simModel,
std::unordered_map<pGRegion, int> groupMap)
: refinementSettings(refinementSettings), simModel(simModel), parser(new easi::YAMLParser(3)),
groupMap(std::move(groupMap)), query(easi::Query(1, 3)) {
groupMap(std::move(groupMap)) {
model = parser->parse(refinementSettings.getEasiFileName());
}

Expand All @@ -31,7 +32,7 @@ int EasiMeshSize::findGroup(std::array<double, 3> point) {
}

std::tuple<const double, const int>
EasiMeshSize::getTargetedFrequencyAndRegion(std::array<double, 3> point) {
EasiMeshSize::getTargetedFrequencyAndRegion(const std::array<double, 3>& point) {
const auto& refinementRegions = refinementSettings.getRefinementRegions();
double targetedFrequency = 0.0;
int bypassFindRegionAndUseGroup = 0;
Expand All @@ -58,7 +59,7 @@ EasiMeshSize::getTargetedFrequencyAndRegion(std::array<double, 3> point) {
return std::make_tuple(targetedFrequency, bypassFindRegionAndUseGroup);
}

double EasiMeshSize::getMeshSize(std::array<double, 3> point) {
double EasiMeshSize::getMeshSize(const std::array<double, 3>& point) {
if (!model) {
logError() << "Model was not parsed correctly";
}
Expand All @@ -71,6 +72,7 @@ double EasiMeshSize::getMeshSize(std::array<double, 3> point) {
return defaultMeshSize;
}

easi::Query query(1, 3);
query.x(0, 0) = point[0];
query.x(0, 1) = point[1];
query.x(0, 2) = point[2];
Expand Down
6 changes: 3 additions & 3 deletions src/input/EasiMeshSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ class EasiMeshSize {

easi::YAMLParser* parser;
easi::Component* model; // Unique ptr to model leads to segfault
easi::Query query;
pGModel simModel;
std::unordered_map<pGRegion, int> groupMap;

int findGroup(std::array<double, 3> point);

std::tuple<const double, const int> getTargetedFrequencyAndRegion(std::array<double, 3> point);
std::tuple<const double, const int>
getTargetedFrequencyAndRegion(const std::array<double, 3>& point);

public:
EasiMeshSize();
;
EasiMeshSize(VelocityAwareRefinementSettings refinementSettings, pGModel simModel,
std::unordered_map<pGRegion, int> groupMap);

double getMeshSize(std::array<double, 3> point);
double getMeshSize(const std::array<double, 3>& point);
};

#endif // PUMGEN_EASIMESHSIZE_H
7 changes: 4 additions & 3 deletions src/input/SimModSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
*/
class SimModSuite : public FullStorageMeshData {
private:
EasiMeshSize easiMeshSize;
std::shared_ptr<EasiMeshSize> easiMeshSize;
pGModel m_model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me if we want to also adapt all the naming conventions here for these repositories too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you mean?

If it's about applying clang-tidy to absolutely everything: in principle, yes—absolutely.

(and yes, it's still missing for PUMgen so far)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you mean?

If it's about applying clang-tidy to absolutely everything: in principle, yes—absolutely.

This, exactly. the variable name m_model just brought the question up in my head.

(and yes, it's still missing for PUMgen so far)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. Also, PUMgen should be really easy to adjust.


pParMesh m_simMesh;
Expand Down Expand Up @@ -587,7 +587,8 @@ class SimModSuite : public FullStorageMeshData {

if (MeshAtt.velocityAwareRefinementSettings.isVelocityAwareRefinementOn()) {
logInfo(PMU_rank()) << "Enabling velocity aware meshing";
easiMeshSize = EasiMeshSize(MeshAtt.velocityAwareRefinementSettings, model, groupMap);
easiMeshSize =
std::make_shared<EasiMeshSize>(MeshAtt.velocityAwareRefinementSettings, model, groupMap);
auto easiMeshSizeFunc = [](pSizeAttData sadata, void* userdata) {
auto* easiMeshSize = static_cast<EasiMeshSize*>(userdata);
std::array<double, 3> pt{};
Expand All @@ -598,7 +599,7 @@ class SimModSuite : public FullStorageMeshData {
return easiMeshSize->getMeshSize(pt);
};
// set the user-defined function for isotropic size
MS_setSizeAttFunc(meshCase, "setCustomMeshSize", easiMeshSizeFunc, &easiMeshSize);
MS_setSizeAttFunc(meshCase, "setCustomMeshSize", easiMeshSizeFunc, easiMeshSize.get());
// Relative anisotropic size is set for the entire model through the
// function anisoSize
MS_setMeshSize(meshCase, GM_domain(model), MS_userDefinedType | 1, 0, "setCustomMeshSize");
Expand Down
Loading