Hi guys,
I´m trying to write a data processor to count all solid cells in a plane of the lattice. Since I generate the lattice from a simple boolmask, I figured it would be the most easiest way to just count all solid cells in the MultiScalarField3D (for a plane).
Here is my code:
template<typename T, template<typename U> class Descriptor>
class MyFunctional : public BoxProcessingFunctional3D_S<T> {
private:
plint z;
plint xmax, ymax;
plint area;
public:
MyFunctional (plint z_, plint xmax_, plint ymax_) : z(z_), xmax(xmax_), ymax(ymax_), area(0) {
}
virtual void process (MultiScalarField3D<bool>& matrix) {
for (plint i=0; i<xmax; i++) {
for (plint j=0; j<ymax; j++) {
if (matrix.get(i, j, z)) area++;
}
}
}
virtual MyFunctional<T, Descriptor>* clone() const {
return new MyFunctional<T, Descriptor> (*this);
}
};
void CreateMyFunctional (MultiScalarField3D<bool> &matrix, plint z, plint xmax, plint ymax) {
Box3D foo(0,xmax,0,ymax,z,z);
applyProcessingFunctional (new MyFunctional<T, DESCRIPTOR> (z, xmax, ymax), foo, matrix);
}
The function CreateMyFunctional is not correct, I think it should look like:
void plb::applyProcessingFunctional(plb::BoxProcessingFunctional3D*, plb::Box3D, std::vector<plb::MultiBlock3D*, std::allocatorplb::MultiBlock3D* >)
but thats where I´m stuck atm, since it´s above my programming skills… I´m reading about std::allocator, but so far it doesn´t make any sense
thanks for any input