The guide for the Data Processor structure of Palabos
In this article, the execution of data processors and the related functions are briefly summarized, based on the official documentation.
First, two data processor wrappers, the function can be called directly by the end users
- Two Data Processor Wrappers
applyProcessingFunctional(),- the wrapper of
executeDataProcessor() - executed just once, on one or more blocks
- the wrapper of
integrateProcessingFunctional(),- the wrapper of
addInternalProcessor() - added data processors to a block, which becomes part of the block and can be executed as many times as wished. The added processors are implicitly (to the users) called by the function
executeInternalProcessors
- the wrapper of
- They accept three main parameters:
BoxProcessingFunctionalXD_LSTN functionalBoxXD domainMultiBlockLatticeXD lattice;- A
integrateProcessingFunctionalaccepts an additional parameter:plint level;
- They are based on the functional, which defines the operation of the data processor.
- where in library
- multiBlock version /src/multiBlock/multiDataProcessorWrapperXD.h/hh/cpp.
- atomicBlock version /src/atomicBlock/dataProcessorWrapperXD.h/hh.
Second, two multi block data processor operators
- Two operators
excuteDataProcessor()addInternalProcessor()
- The functional is wrapped into a
DataProcessorGeneratorXDand passed to either theexecuteDataProcessor()oraddInternalProcessor()- The
DataProcessorGeneratorXDstores a pointer to thefunctionalas a private member.
- The
- The main job is to deal with the multi-block structure and pass the functional into the atomic block operators
- where in library
- operators: /src/multiBlock/multiBlockOperationsXD.h/cpp.
- Data processor generators: /src/atomicBlock/dataProcessingFunctionalXD.h/hh/cpp.
- Data processor generator base struct: /src/atomicBlock/dataProcessorXD.h/hh/cpp.
Third, two atomic block data processor operators
- The
DataProcessorGeneratorXD generatoris passed from the multi-block operators. - The
generatorgenerates aprocessor:generator.gererates(objects)with thefunctionalembeded. - Two operators
excuteDataProcessor- The processor is finally processed
processor-process()
- The processor is finally processed
addInternalProcessor- The processor is integrated using the function
integrateDataProcessor()and the processor is pushed to thevector<processor> processorsin each atomic block throughprocessors[level].push_back(processor);
- The processor is integrated using the function
- Folders
- Operators: /src/atomicBlock/atomicBlockOperationsXD.h/.cpp
- Data Processors: /src/atomicBlock/dataProcessingFunctionalXD.h/.cpp
- Data Processor Base struct: /src/atomicBlock/dataProcessorXD.h/.cpp
As a summary
- The
functionalis the key, where the main algorithm is implemented. - It is first passed to the
applyProcessingFunctional()as an argument, inside which, it is cloned to the newedDataProcessorGeneratorthat is passed to theexecuteDataProcessor(). - It goes into the atomic version operator and finally cloned in to the
processorgenerated from thegenerator. - The
processor->process()finally calls thefunctional->process().
In addition: BoxProcessingFunctionalXD
BoxProcessingFunctionalXDhas the algorithm implemented inprocessGenericBlock()instead ofprocess()BoxProcessingFunctionalXDis a base class defined in the same file as many of its subclasses.
BoxProcessorXD :: DataProcessorXDis designed forBoxProcessingFunctionalXD,which overrides the functionprocess()process()runsfunctional -> processGenericBlock(domain, atomicBlocks)
- Inheritance:
ACertainFunctional==>BoxProcessingFunctionalXD_LLetc. ==>BoxProcessingFunctionalXD- src/atomicBlock/dataProcessingFunctionalXD.h
In addition: excuteInternalProcessors()
- It is called in
MultiBlockLatticeXD::stream(),MultiBlockLatticeXD::collideAndStream()MultiBlockXD::initialize()
- The
MultiBlockXD::executeInternalProcessors(level)calls thegetComponent(blockId).excuteInternalProcessors(leve)which is at the atomicBlocks unit. (line511@/src/multiBlock/multiBlock3D.cpp) - The
AtomicBlockXD::executeInternalProcessors(level, processors)finally calls the processors -> process(); in (line254@/src/atomicBlock/atomicBlock3D.cpp)
There is more to be discussed about the design for sure.