Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions examples/BoundaryOptimization/AcousticCloaking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ int main(int, char**)

Alert::Info() << "Computing conormal..." << Alert::Raise;
GridFunction conormal(drvfes);
conormal.projectOnCells(Grad(dist), { SoundSoft, SoundHard });
conormal.project(Region::Cells, Grad(dist), { SoundSoft, SoundHard });

conormal.getFiniteElementSpace().getMesh().save("Conormal.mesh");
conormal.save("Conormal.gf");
Expand Down Expand Up @@ -325,7 +325,7 @@ int main(int, char**)
Alert::Info() << "Meshing the support..." << Alert::Raise;
RealFES workaroundfes(mesh);
GridFunction workaround(workaroundfes);
workaround.projectOnBoundary(dist);
workaround.project(Region::Boundary, dist);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(SoundSoft, { SoundSoft, SoundHard })
.split(SoundHard, { SoundSoft, SoundHard })
Expand Down
4 changes: 2 additions & 2 deletions examples/BoundaryOptimization/ClampLocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ int main(int, char**)
try
{
GridFunction workaround(sfes);
workaround.projectOnBoundary(distLocator);
workaround.project(Region::Boundary, distLocator);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(Gamma, { Locator, Gamma })
.split(Locator, { Locator, Gamma })
Expand Down Expand Up @@ -395,7 +395,7 @@ int main(int, char**)
try
{
GridFunction workaround(sfes);
workaround.projectOnBoundary(distClamp);
workaround.project(Region::Boundary, distClamp);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(Gamma, { Clamp, Gamma })
.split(Clamp, { Clamp, Gamma })
Expand Down
4 changes: 2 additions & 2 deletions examples/BoundaryOptimization/EMM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ int main(int, char**)
try
{
GridFunction workaround(sfes);
workaround.projectOnBoundary(distAnode);
workaround.project(Region::Boundary, distAnode);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(Anode, { Anode, Gamma })
.split(Gamma, { Anode, Gamma })
Expand Down Expand Up @@ -346,7 +346,7 @@ int main(int, char**)
try
{
GridFunction workaround(sfes);
workaround.projectOnBoundary(distCathode);
workaround.project(Region::Boundary, distCathode);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(Cathode, { Cathode, Gamma })
.split(Gamma, { Cathode, Gamma })
Expand Down
2 changes: 1 addition & 1 deletion examples/BoundaryOptimization/SurfaceCooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ int main(int, char**)

Alert::Info() << "Meshing the domain..." << Alert::Raise;
GridFunction workaround(sfes);
workaround.projectOnBoundary(dist);
workaround.project(Region::Boundary, dist);
try
{
Omega = MMG::ImplicitDomainMesher().noSplit(GammaN)
Expand Down
2 changes: 1 addition & 1 deletion examples/BoundaryOptimization/WaterTank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ int main(int, char**)
try
{
GridFunction workaround(sfes);
workaround.projectOnBoundary(dist);
workaround.project(Region::Boundary, dist);
mesh = MMG::ImplicitDomainMesher().setAngleDetection(false)
.split(Support, { Support, Gamma })
.split(Gamma, { Support, Gamma })
Expand Down
2 changes: 1 addition & 1 deletion examples/PDEs/Poisson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char**)
TrialFunction u(vh);
TestFunction v(vh);

ScalarFunction f = 1;
RealFunction f = 1;

// Apply Dirichlet conditions on the entire boundary.
Problem poisson(u, v);
Expand Down
2 changes: 1 addition & 1 deletion examples/PETSc/MPI_Poisson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char** argv)
std::snprintf(filename, sizeof(filename), "mesh.%06d", world.rank());
mesh.save(filename);

ScalarFunction f = 1;
RealFunction f = 1;

P1 vh(mesh);

Expand Down
2 changes: 1 addition & 1 deletion examples/PETSc/Seq_Poisson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char** argv)
mesh = mesh.UniformGrid(Polytope::Type::Triangle, { 16, 16 });
mesh.getConnectivity().compute(1, 2);

ScalarFunction f = 1;
RealFunction f = 1;

P1 vh(mesh);

Expand Down
2 changes: 1 addition & 1 deletion examples/Variational/Normal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int, char**)

P1 fes(mesh, vdim);
GridFunction gf(fes);
gf.projectOnBoundary(BoundaryNormal(mesh));
gf.project(Region::Boundary, BoundaryNormal(mesh));

mesh.save("Normal.mesh");
gf.save("Normal.gf");
Expand Down
2 changes: 1 addition & 1 deletion examples/Variational/P1/P1GridFunctionGradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int, char**)
grad = Grad(gf);

GridFunction trace(vfes);
trace.projectOnFaces(Grad(gf).traceOf(1));
trace.project(Region::Faces, Grad(gf).traceOf(1));

mesh.save("Grid.mesh");
gf.save("Function.gf");
Expand Down
34 changes: 17 additions & 17 deletions src/Rodin/Assembly/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Rodin::Assembly
{
OpenMPIteration<Geometry::Mesh<Context::Local>>
::OpenMPIteration(const Geometry::Mesh<Context::Local>& mesh, Variational::Integrator::Region region)
::OpenMPIteration(const Geometry::Mesh<Context::Local>& mesh, const Geometry::Region& region)
: m_mesh(mesh), m_region(region)
{}

Expand All @@ -21,14 +21,14 @@ namespace Rodin::Assembly
Geometry::PolytopeIterator it;
switch (m_region)
{
case Variational::Integrator::Region::Cells:
case Geometry::Region::Cells:
{
it = m_mesh.get().getCell(i);
return it;
}
case Variational::Integrator::Region::Faces:
case Variational::Integrator::Region::Boundary:
case Variational::Integrator::Region::Interface:
case Geometry::Region::Faces:
case Geometry::Region::Boundary:
case Geometry::Region::Interface:
{
it = m_mesh.get().getFace(i);
return it;
Expand All @@ -42,13 +42,13 @@ namespace Rodin::Assembly
{
switch (m_region)
{
case Variational::Integrator::Region::Cells:
case Geometry::Region::Cells:
{
return m_mesh.get().getDimension();
}
case Variational::Integrator::Region::Faces:
case Variational::Integrator::Region::Boundary:
case Variational::Integrator::Region::Interface:
case Geometry::Region::Faces:
case Geometry::Region::Boundary:
case Geometry::Region::Interface:
{
return m_mesh.get().getDimension() - 1;
}
Expand All @@ -61,13 +61,13 @@ namespace Rodin::Assembly
{
switch (m_region)
{
case Variational::Integrator::Region::Cells:
case Geometry::Region::Cells:
{
return m_mesh.get().getCellCount();
}
case Variational::Integrator::Region::Faces:
case Variational::Integrator::Region::Boundary:
case Variational::Integrator::Region::Interface:
case Geometry::Region::Faces:
case Geometry::Region::Boundary:
case Geometry::Region::Interface:
{
return m_mesh.get().getFaceCount();
}
Expand All @@ -80,16 +80,16 @@ namespace Rodin::Assembly
{
switch (m_region)
{
case Variational::Integrator::Region::Faces:
case Variational::Integrator::Region::Cells:
case Geometry::Region::Faces:
case Geometry::Region::Cells:
{
return true;
}
case Variational::Integrator::Region::Boundary:
case Geometry::Region::Boundary:
{
return m_mesh.get().isBoundary(i);
}
case Variational::Integrator::Region::Interface:
case Geometry::Region::Interface:
{
return m_mesh.get().isInterface(i);
}
Expand Down
9 changes: 4 additions & 5 deletions src/Rodin/Assembly/OpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Rodin::Assembly
public:
using MeshType = Geometry::Mesh<Context::Local>;

OpenMPIteration(const MeshType& mesh, Variational::Integrator::Region);
OpenMPIteration(const MeshType& mesh, const Geometry::Region& region);

Geometry::PolytopeIterator getIterator(Index i) const;

Expand All @@ -46,11 +46,10 @@ namespace Rodin::Assembly

private:
std::reference_wrapper<const MeshType> m_mesh;
Variational::Integrator::Region m_region;
Geometry::Region m_region;
};

OpenMPIteration(
const Geometry::Mesh<Context::Local>& mesh, Variational::Integrator::Region)
OpenMPIteration(const Geometry::Mesh<Context::Local>& mesh, const Geometry::Region&)
-> OpenMPIteration<Geometry::Mesh<Context::Local>>;

template <class Solution, class TrialFES, class TestFES>
Expand Down Expand Up @@ -625,7 +624,7 @@ namespace Rodin::Assembly
{
const auto& fe = fes.getFiniteElement(faceDim, i);
const auto& mapping =
fes.getMapping({ faceDim, i }, value.template cast<FESRangeType>());
fes.getMapping({ faceDim, i }, value);
for (Index local = 0; local < fe.getCount(); local++)
{
const Index global = fes.getGlobalIndex({ faceDim, i }, local);
Expand Down
10 changes: 5 additions & 5 deletions src/Rodin/Assembly/Sequential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Rodin::Assembly
{
SequentialIteration<Geometry::Mesh<Context::Local>>
::SequentialIteration(const Geometry::Mesh<Context::Local>& mesh, Variational::Integrator::Region region)
::SequentialIteration(const Geometry::Mesh<Context::Local>& mesh, const Geometry::Region& region)
: m_mesh(mesh), m_region(region)
{}

Expand All @@ -20,22 +20,22 @@ namespace Rodin::Assembly
Geometry::PolytopeIterator it;
switch (m_region)
{
case Variational::Integrator::Region::Cells:
case Geometry::Region::Cells:
{
it = m_mesh.get().getCell();
break;
}
case Variational::Integrator::Region::Faces:
case Geometry::Region::Faces:
{
it = m_mesh.get().getFace();
break;
}
case Variational::Integrator::Region::Boundary:
case Geometry::Region::Boundary:
{
it = m_mesh.get().getBoundary();
break;
}
case Variational::Integrator::Region::Interface:
case Geometry::Region::Interface:
{
it = m_mesh.get().getInterface();
break;
Expand Down
14 changes: 8 additions & 6 deletions src/Rodin/Assembly/Sequential.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
#include "Rodin/Context/Local.h"

#include "Rodin/Tuple.h"

#include "Rodin/Math/Traits.h"
#include "Rodin/Math/Vector.h"
#include "Rodin/Math/SparseMatrix.h"

#include "Rodin/Geometry/Mesh.h"
#include "Rodin/Geometry/Region.h"

#include "Rodin/Variational/ForwardDecls.h"
#include "Rodin/Variational/Integrator.h"

#include "ForwardDecls.h"

Expand All @@ -27,17 +30,17 @@ namespace Rodin::Assembly
public:
using MeshType = Geometry::Mesh<Context::Local>;

SequentialIteration(const MeshType& mesh, Variational::Integrator::Region);
SequentialIteration(const MeshType& mesh, const Geometry::Region&);

Geometry::PolytopeIterator getIterator() const;

private:
std::reference_wrapper<const MeshType> m_mesh;
Variational::Integrator::Region m_region;
Geometry::Region m_region;
};

SequentialIteration(
const Geometry::Mesh<Context::Local>& mesh, Variational::Integrator::Region)
const Geometry::Mesh<Context::Local>& mesh, const Geometry::Region&)
-> SequentialIteration<Geometry::Mesh<Context::Local>>;
}

Expand Down Expand Up @@ -666,8 +669,7 @@ namespace Rodin::Assembly
if (essBdr.size() == 0 || essBdr.count(mesh.getAttribute(faceDim, i)))
{
const auto& fe = fes.getFiniteElement(faceDim, i);
const auto& mapping =
fes.getMapping({ faceDim, i }, value.template cast<FESRangeType>());
const auto& mapping = fes.getMapping({ faceDim, i }, value);
for (Index local = 0; local < fe.getCount(); local++)
{
const Index global = fes.getGlobalIndex({ faceDim, i }, local);
Expand Down
15 changes: 15 additions & 0 deletions src/Rodin/Geometry/Region.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef RODIN_GEOMETRY_REGION_H
#define RODIN_GEOMETRY_REGION_H

namespace Rodin::Geometry
{
enum class Region
{
Cells,
Faces,
Boundary,
Interface
};
}

#endif
2 changes: 1 addition & 1 deletion src/Rodin/IO/EnSight6.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ namespace Rodin::IO
it->getCoordinates()
);

gf(v, p);
v = gf(p);

if constexpr (std::is_same_v<RangeType, Real>)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Rodin/MPI/Assembly/MPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Rodin::Assembly
{
MPIIteration::MPIIteration(const Geometry::Mesh<Context::MPI>& mesh, Variational::Integrator::Region region)
MPIIteration::MPIIteration(const Geometry::Mesh<Context::MPI>& mesh, Geometry::Region region)
: m_mesh(mesh), m_region(region)
{}

Expand All @@ -11,22 +11,22 @@ namespace Rodin::Assembly
Geometry::PolytopeIterator it;
switch (m_region)
{
case Variational::Integrator::Region::Cells:
case Geometry::Region::Cells:
{
it = m_mesh.get().getShard().getCell();
break;
}
case Variational::Integrator::Region::Faces:
case Geometry::Region::Faces:
{
it = m_mesh.get().getShard().getFace();
break;
}
case Variational::Integrator::Region::Boundary:
case Geometry::Region::Boundary:
{
it = m_mesh.get().getShard().getBoundary();
break;
}
case Variational::Integrator::Region::Interface:
case Geometry::Region::Interface:
{
it = m_mesh.get().getShard().getInterface();
break;
Expand Down
Loading
Loading