Commit 208afb6a authored by berenger-bramas's avatar berenger-bramas

Change pointer of pointer to array of pointer when passing parameters.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@96 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 28cc32a6
......@@ -46,7 +46,7 @@ public:
* @param size the number of neighbors
* @param inLevel the current level of the computation
*/
virtual void M2L(CellClass* const FRestrict local, const CellClass*const FRestrict *const FRestrict distantNeighbors, const int size, const int inLevel) = 0;
virtual void M2L(CellClass* const FRestrict local, const CellClass* distantNeighbors[208], const int size, const int inLevel) = 0;
/**
* L2L
......@@ -76,7 +76,7 @@ public:
* @param size the number of direct neighbors (the size of the array directNeighborsParticles)
*/
virtual void P2P(FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>*const FRestrict *const FRestrict directNeighborsParticles, const int size) = 0;
const FList<ParticleClass*>* const directNeighborsParticles[26], const int size) = 0;
/**
* P2P
......@@ -90,7 +90,7 @@ public:
*/
virtual void P2P(const MortonIndex inCurrentLeafIndex,
FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, MortonIndex const* FRestrict inNeighborsIndex, const int size) = 0;
FList<ParticleClass*>* const directNeighborsParticles[26], const MortonIndex inNeighborsIndex[26], const int size) = 0;
};
......
......@@ -35,7 +35,7 @@ public:
}
/** Print the morton index */
virtual void M2L(CellClass* const FRestrict , const CellClass*const FRestrict *const FRestrict , const int , const int ) {
virtual void M2L(CellClass* const FRestrict , const CellClass* [], const int , const int ) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
......@@ -54,14 +54,14 @@ public:
/** Print the number of particles */
virtual void P2P(FList<ParticleClass*>* const FRestrict , const FList<ParticleClass*>* const FRestrict ,
FList<ParticleClass*>* FRestrict const* FRestrict , const int ) {
const FList<ParticleClass*>* const [26], const int ) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
virtual void P2P(const MortonIndex,
FList<ParticleClass*>* const FRestrict, const FList<ParticleClass*>* const FRestrict,
FList<ParticleClass*>* FRestrict const* FRestrict, MortonIndex const* FRestrict, const int){
virtual void P2P(const MortonIndex ,
FList<ParticleClass*>* const FRestrict , const FList<ParticleClass*>* const FRestrict ,
FList<ParticleClass*>* const [26], const MortonIndex [26], const int ){
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
......
......@@ -48,7 +48,7 @@ public:
}
// Before Downward
void M2L(CellClass* const FRestrict pole, const CellClass*const FRestrict *const distantNeighbors, const int size, const int ) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int ) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
// The pole is impacted by what represent other poles
for(int idx = 0 ; idx < size ; ++idx){
......@@ -83,7 +83,7 @@ public:
// After Downward
void P2P(FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, const int size) {
const FList<ParticleClass*>* const directNeighborsParticles[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
// Each particles targeted is impacted by the particles sources
long inc = sources->getSize();
......@@ -91,7 +91,7 @@ public:
inc -= 1;
}
for(int idx = 0 ; idx < size ; ++idx){
inc += directNeighbors[idx]->getSize();
inc += directNeighborsParticles[idx]->getSize();
}
typename FList<ParticleClass*>::BasicIterator iter(*targets);
......@@ -104,10 +104,9 @@ public:
// After Downward
void P2P(const MortonIndex,
void P2P(const MortonIndex ,
FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors,
MortonIndex const* FRestrict, const int size) {
FList<ParticleClass*>* const directNeighborsParticles[26], const MortonIndex [26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
// Each particles targeted is impacted by the particles sources
long inc = sources->getSize();
......@@ -115,7 +114,7 @@ public:
inc -= 1;
}
for(int idx = 0 ; idx < size ; ++idx){
inc += directNeighbors[idx]->getSize();
inc += directNeighborsParticles[idx]->getSize();
}
typename FList<ParticleClass*>::BasicIterator iter(*targets);
......
......@@ -657,7 +657,7 @@ public:
* @param inLevel the level of the element
* @return the number of neighbors
*/
int getDistantNeighbors(CellClass* inNeighbors[208], const MortonIndex inIndex, const int inLevel) const{
int getDistantNeighbors(const CellClass* inNeighbors[208], const MortonIndex inIndex, const int inLevel) const{
MortonIndex inNeighborsIndex[208];
return getDistantNeighborsWithIndex(inNeighbors, inNeighborsIndex, inIndex, inLevel);
}
......@@ -670,7 +670,7 @@ public:
* @param inLevel the level of the element
* @return the number of neighbors
*/
int getDistantNeighborsWithIndex(CellClass* inNeighbors[208], MortonIndex inNeighborsIndex[208], const MortonIndex inIndex, const int inLevel) const{
int getDistantNeighborsWithIndex(const CellClass* inNeighbors[208], MortonIndex inNeighborsIndex[208], const MortonIndex inIndex, const int inLevel) const{
// Take the neighbors != brothers
CellClass* directNeighbors[26];
const int nbDirectNeighbors = getNeighborsNoBrothers(directNeighbors,inIndex,inLevel);
......
......@@ -154,7 +154,7 @@ public:
FOctreeIterator avoidGotoLeftIterator(octreeIterator);
CellClass* neighbors[208];
const CellClass* neighbors[208];
// for each levels
for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){
// for each cells
......
......@@ -233,7 +233,7 @@ public:
#pragma omp parallel
{
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
CellClass* neighbors[208];
const CellClass* neighbors[208];
#pragma omp for
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
const int counter = tree->getDistantNeighbors(neighbors, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
......
......@@ -469,7 +469,7 @@ public:
FBoolArray* const indexToReceive = new FBoolArray(1 << (3*(OctreeHeight-1)));
struct LimitCell { int counter; CellClass* neighbors[208]; };
struct LimitCell { int counter; const CellClass* neighbors[208]; };
LimitCell ** const unfinishedCells = new LimitCell*[this->leafRight - this->leafLeft + 1];
FBoolArray* alreadySent[this->nbProcess];
......@@ -510,7 +510,7 @@ public:
#pragma omp parallel
{
CellClass* neighbors[208];
const CellClass* neighbors[208];
MortonIndex neighborsIndexes[208];
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
......
......@@ -231,7 +231,7 @@ public:
#pragma omp parallel
{
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
CellClass* neighbors[208];
const CellClass* neighbors[208];
#pragma omp for
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
CellClass* const currentCell = iterArray[idxCell].getCurrentCell();
......
......@@ -838,7 +838,7 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass*const FRestrict *const FRestrict distantNeighbors, const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......@@ -1333,7 +1333,7 @@ public:
*/
void P2P(const MortonIndex inCurrentIndex,
FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, MortonIndex const* FRestrict inNeighborsIndex, const int size) {
FList<ParticleClass*>* const directNeighbors[26], const MortonIndex inNeighborsIndex[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......@@ -1410,7 +1410,7 @@ public:
*
*/
void P2P(FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, const int size) {
const FList<ParticleClass*>* const directNeighbors[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......
......@@ -904,7 +904,7 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass*const FRestrict *const FRestrict distantNeighbors, const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......@@ -1384,7 +1384,7 @@ public:
*/
void P2P(const MortonIndex inCurrentIndex,
FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, MortonIndex const* FRestrict inNeighborsIndex, const int size) {
FList<ParticleClass*>* const directNeighbors[26], const MortonIndex inNeighborsIndex[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......@@ -1461,7 +1461,7 @@ public:
*
*/
void P2P(FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, const int size) {
const FList<ParticleClass*>* const directNeighbors[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......
......@@ -1208,7 +1208,7 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass*const FRestrict *const FRestrict distantNeighbors, const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......@@ -1637,7 +1637,7 @@ public:
*/
void P2P(const MortonIndex inCurrentIndex,
FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, MortonIndex const* FRestrict inNeighborsIndex, const int size) {
FList<ParticleClass*>* const directNeighbors[26], const MortonIndex inNeighborsIndex[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......@@ -1715,7 +1715,7 @@ public:
*
*/
void P2P(FList<ParticleClass*>* const FRestrict targets, const FList<ParticleClass*>* const FRestrict sources,
FList<ParticleClass*>* FRestrict const* FRestrict directNeighbors, const int size) {
const FList<ParticleClass*>* const directNeighbors[26], const int size) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
typename FList<ParticleClass*>::BasicIterator iterTarget(*targets);
while( iterTarget.isValide() ){
......
......@@ -210,7 +210,7 @@ int main(int argc, char ** argv){
if(child[idxChild]) ++nbChildAtLevel[idxArray];
}
FBasicCell* neighbors[208];
const FBasicCell* neighbors[208];
MortonIndex neighborsIndexes[208];
M2LCalculusAtLevel[idxArray] += tree.getDistantNeighborsWithIndex(neighbors, neighborsIndexes, octreeIterator.getCurrentGlobalIndex(),idxLevel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment