Skip to content

Commit ee16837

Browse files
committed
integrate over non-mesh dimension
closes #190
1 parent 064e132 commit ee16837

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

apf/apf.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,13 @@ class Integrator
411411
/** \brief Construct an Integrator given an order of accuracy. */
412412
Integrator(int o);
413413
virtual ~Integrator();
414-
/** \brief Run the Integrator over the local Mesh. */
415-
void process(Mesh* m);
414+
/** \brief Run the Integrator over the local Mesh.
415+
* \param m mesh to integrate over
416+
* \param dim optional dimension to integrate over. This defaults to
417+
* integration over the mesh dimesion which may not be correct e.g. in the case
418+
* of a 1D element embeded in 3D space.
419+
* */
420+
void process(Mesh* m, int dim=-1);
416421
/** \brief Run the Integrator over a Mesh Element. */
417422
void process(MeshElement* e);
418423
/** \brief User callback: element entry.

apf/apfIntegrate.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "apfIntegrate.h"
99
#include "apfMesh.h"
1010
#include "apf.h"
11+
#include "pcu_util.h"
1112

1213
namespace apf {
1314

@@ -640,9 +641,11 @@ void Integrator::parallelReduce()
640641
{
641642
}
642643

643-
void Integrator::process(Mesh* m)
644+
void Integrator::process(Mesh* m, int d)
644645
{
645-
int d = m->getDimension();
646+
if(d<0)
647+
d = m->getDimension();
648+
PCU_DEBUG_ASSERT(d<=m->getDimension());
646649
MeshEntity* entity;
647650
MeshIterator* elements = m->begin(d);
648651
while ((entity = m->iterate(elements)))

0 commit comments

Comments
 (0)