Is it possible to setup a multiscalarfield with vicinity of 2?

Hi, everyone
I’m trying to calculate the local curvature in palabos based on the BBS model which needs to get the solid fraction of the neighboring nodes with the vicinity of 2. I do not know whether it is possible to setup a multiscalarfield of vicinity 2.



There exist several approaches. The simplest one is to use the function

std::auto_ptr<MultiScalarField3D > generateMultiScalarField (
Box3D boundingBox, T iniVal, plint envelopeWidth );

defined in


You can for example create the 100x100x100 MultiScalarField "a" with vicinity of 2 as follows:

MultiScalarField3D<double>* a = generateMultiScalarField(Box3D(0,99, 0,99, 0,99), 0., 2);

There’s a minor inconvenience: “a” is a pointer and is then a bit more clumsy to handle than a static variable, but all in all, this remains the most convenient approach.


Hi, jonas
I tried your suggestion and used:
MultiScalarField2D * solidfraction_dis = generateMultiScalarField (domain, 0., 1);

But the I got the error:

cannot convert ‘std::auto_ptr<plb::MultiScalarField2D >’ to ‘plb::MultiScalarField2D*’ in initialization

How can I fix this error?


Right, there is a misprint in my post. The right syntax is

std::auto_ptr<MultiScalarField2D > solidfraction_dis = generateMultiScalarField (domain, 0., 1);


solidfraction_dis is an "auto-pointer", which has the same syntax as a normal pointer, but is automatically de-allocated when the program gets out of the current scope.


I set up the scalar field successfully by using “std::auto_ptr<MultiScalarField2D >”. Thanks a lot.
But now, new problem comes up:
If I want to use the BoxProcessingFunctional2D to define a process for the scalar field, I need firstly define an argument to include all the involved data field, for example:
vector <MultiBlock2D*> get_curvature_arg;
get_curvature_arg.push_back (phase);
get_curvature_arg.push_back (curvature_dis);
get_curvature_arg.push_back (solidfraction_dis);

and then we can use
applyProcessingFunctional (new get_curvature (nx, ny), phase->getBoundingBox (), get_curvature_arg);
to carry out the calculation in the data field.

But the when I compile for this code, I get the error:
error: no matching function for call to ‘std::vector<plb::MultiBlock2D*, std::allocatorplb::MultiBlock2D* >::push_back(std::auto_ptr<plb::MultiScalarField2D >&)’
note: candidates are: void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = plb::MultiBlock2D*, _Alloc = std::allocatorplb::MultiBlock2D*

It seems that the “std::auto_ptr<MultiScalarField2D >” will conflict with the " MultiScalarField3D* " type.
What can I do about this?

Thanks a lot!


Write for example


to access the raw pointer.