As much as I want to create an MVCE of this problem...I really can't. I am using an open source fluid flow solver called Palabos with its dev guide also available . It is based on generic structures and mpi. Probably the best available open source solver of its kind
The developers there use Box Processors for cycling through arrays(generally speaking..it can be tensors, lattice are other objects). Here is a way they use processors for a single lattice case
struct IniTemperatureRayleighBenardProcessor2D :
public BoxProcessingFunctional2D_L<T,adDescriptor>
{
IniTemperatureRayleighBenardProcessor2D(RayleighBenardFlowParam<T,nsDescriptor,adDescriptor> parameters_)
: parameters(parameters_)
{ }
virtual void process(Box2D domain, BlockLattice2D<T,adDescriptor>& adLattice)
{
Dot2D absoluteOffset = adLattice.getLocation();
Array<T,adDescriptor<T>::d> jEq(0.0, 0.0);
for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
//some operations...............
}
}
}
virtual IniTemperatureRayleighBenardProcessor2D<T,nsDescriptor,adDescriptor>* clone() const
{
return new IniTemperatureRayleighBenardProcessor2D<T,nsDescriptor,adDescriptor>(*this);
}
virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const {
modified[0] = modif::staticVariables;
}
virtual BlockDomain::DomainT appliesTo() const {
return BlockDomain::bulkAndEnvelope;
}
private :
RayleighBenardFlowParam<T,nsDescriptor,adDescriptor> parameters;
};
Here how they call it
applyProcessingFunctional (
new IniTemperatureRayleighBenardProcessor2D<T,NSDESCRIPTOR,ADESCRIPTOR>(parameters), adLattice.getBoundingBox(),
adLattice );
Details of the whole procedure are at (http://ift.tt/1Ekzffz)
with related source code at (http://ift.tt/18n6SiQ)
Now, here is my problem. I am using a similar data processor to perform operation on two scalar arrays. Tried to understand as much as of the source code as possible
template<typename T1, typename T2>
//template<typename T, template<typename NSU> class nsDescriptor,
// template<typename ADU> class adDescriptor, typename T1, typename T2>
struct IniFluxMultiplier2D :
public BoxProcessingFunctional2D_SS<T,T>
{
IniFluxMultiplier2D(RayleighBenardFlowParam<T,NSDESCRIPTOR,ADESCRIPTOR> parameters_)
: parameters(parameters_)
{ }
virtual void process(Box2D domain,
MultiScalarField2D<bool>& boolMask,
MultiScalarField2D<T> &FluxMultiplier)
{
//Dot2D absoluteOffset = adLattice.getLocation();
//Array<T,adDescriptor<T>::d> jEq(0.0, 0.0);
for (plint iX=domain.x0; iX<=domain.x1; ++iX) {
for (plint iY=domain.y0; iY<=domain.y1; ++iY) {
//plint absoluteX = absoluteOffset.x + iX;
//plint absoluteY = absoluteOffset.y + iY;
bool solidblock = boolMask.get(iX,iY);
if(solidblock== true){
FluxMultiplier.get(iX,iY)=(parameters.getTemperatureTau()-(T)0.5)/parameters.getTemperatureTau();}
else{
FluxMultiplier.get(iX,iY)=(parameters.getSolventTau()-(T)0.5)/parameters.getSolventTau();}
}
}
}
virtual IniFluxMultiplier2D<T1,T2>* clone() const
{
return new IniFluxMultiplier2D<T1,T2>(*this);
}
virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const {
modified[0] = modif::staticVariables;
}
virtual BlockDomain::DomainT appliesTo() const {
return BlockDomain::bulkAndEnvelope;
}
private :
RayleighBenardFlowParam<T,NSDESCRIPTOR,ADESCRIPTOR> parameters;
};
and here is how I call it
applyProcessingFunctional (
new IniFluxMultiplier2D<T,T>(parameters), boolMask.getBoundingBox(), boolMask,FluxMultiplier);
I am getting the error
error: cannot allocate an object of abstract type ‘IniFluxMultiplier2D<double, double>’|
Tried debugging it but I am stuck and really can't figure a way out. I don't really expect anyone to run this, but I know I am making a conceptual mistake at the starting of the structure which I can't really figure out.
T is decalared as
typedef double T;
globally
Aucun commentaire:
Enregistrer un commentaire