Skip to content

Commit

Permalink
Merge pull request #1190 from LLNL/feature/kweiss/shaping-with-device…
Browse files Browse the repository at this point in the history
…-mfem

quest's SamplingShaper can now be used when mfem is configured for devices
  • Loading branch information
kennyweiss committed Sep 20, 2023
2 parents 9a25422 + 235a35b commit 9ea7c93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/

### Fixed
- quest's `SamplingShaper` now properly handles material names containing underscores
- quest's `SamplingShaper` can now be used with an mfem that is configured for (GPU) devices

## [Version 0.8.1] - Release date 2023-08-16

Expand Down
12 changes: 8 additions & 4 deletions src/axom/quest/detail/shaping/shaping_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void replaceMaterial(mfem::QuadratureFunction* shapeQFunc,
SLIC_ASSERT(materialQFunc->Size() == shapeQFunc->Size());

const int SZ = materialQFunc->Size();
double* mData = materialQFunc->GetData();
double* sData = shapeQFunc->GetData();
double* mData = materialQFunc->HostReadWrite();
double* sData = shapeQFunc->HostReadWrite();

if(shapeReplacesMaterial)
{
Expand Down Expand Up @@ -61,8 +61,8 @@ void copyShapeIntoMaterial(const mfem::QuadratureFunction* shapeQFunc,
SLIC_ASSERT(materialQFunc->Size() == shapeQFunc->Size());

const int SZ = materialQFunc->Size();
double* mData = materialQFunc->GetData();
const double* sData = shapeQFunc->GetData();
double* mData = materialQFunc->HostReadWrite();
const double* sData = shapeQFunc->HostRead();

// When reuseExisting, don't reset material values; otherwise, just copy values over
if(reuseExisting)
Expand Down Expand Up @@ -114,9 +114,11 @@ void generatePositionsQFunction(mfem::Mesh* mesh,
const int nq = ir.GetNPoints();
const auto* geomFactors =
mesh->GetGeometricFactors(ir, mfem::GeometricFactors::COORDINATES);
geomFactors->X.HostRead();

mfem::QuadratureFunction* pos_coef = new mfem::QuadratureFunction(sp, dim);
pos_coef->SetOwnsSpace(true);
pos_coef->HostReadWrite();

// Rearrange positions into quadrature function
{
Expand Down Expand Up @@ -186,6 +188,7 @@ void computeVolumeFractions(const std::string& matField,
fes = new mfem::FiniteElementSpace(mesh, fec);
volFrac = new mfem::GridFunction(fes);
volFrac->MakeOwner(fec);
volFrac->HostReadWrite();

dc->RegisterField(volFracName, volFrac);
}
Expand Down Expand Up @@ -400,6 +403,7 @@ void computeVolumeFractionsIdentity(mfem::DataCollection* dc,
mfem::FiniteElementSpace* fes = new mfem::FiniteElementSpace(mesh, fec);
mfem::GridFunction* volFrac = new mfem::GridFunction(fes);
volFrac->MakeOwner(fec);
volFrac->HostReadWrite();
dc->RegisterField(name, volFrac);

(*volFrac) = (*inout);
Expand Down

0 comments on commit 9ea7c93

Please sign in to comment.