Commit a6c4ebc3 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

FmaR4W8Particle does not exist anymore, changes to the only class using it :...

FmaR4W8Particle does not exist anymore, changes to the only class using it : DirectComputation, done
parent 64e8b292
......@@ -98,13 +98,13 @@ int main(int argc, char ** argv){
// int nbDataToRead = particles[0].getReadDataNumber();
for(int idx = 0 ; idx<nbParticles ; ++idx){
//
loader.fillParticle(&particles[idx].position, &particles[idx].physicalValue);
loader.fillParticle(particles[idx].getPtrFirstData(), particles[idx].getReadDataNumber());
// loader.fillParticle(particles[idx].getPtrFirstData(), nbDataToRead); // OK
// loader.fillParticle(particles[idx]); // OK
std::cout << idx <<" "<< particles[idx].position << " "<<particles[idx].physicalValue << " "<<particles[idx].potential
<<" " << particles[idx].forces[0]<<" " <<particles[idx].forces[1]<<" " <<particles[idx].forces[2]<<" " <<std::endl;
std::cout << idx <<" "<< particles[idx].getPosition() << " "<<particles[idx].getPhysicalValue() << " "<<particles[idx].getPotential()
<<" " << particles[idx].getForces()[0]<<" " <<particles[idx].getForces()[1]<<" " <<particles[idx].getForces()[2]<<" " <<std::endl;
//
totalCharge += particles[idx].physicalValue ;
totalCharge += particles[idx].getPhysicalValue() ;
}
counter.tac();
......@@ -137,19 +137,19 @@ int main(int argc, char ** argv){
for(int idxOther = 0; idxOther < nbParticles ; ++idxOther){
if( idxOther != idxTarget ){
FP2P::NonMutualParticles(
particles[idxOther].position.getX(), particles[idxOther].position.getY(),
particles[idxOther].position.getZ(),particles[idxOther].physicalValue,
particles[idxTarget].position.getX(), particles[idxTarget].position.getY(),
particles[idxTarget].position.getZ(),particles[idxTarget].physicalValue,
&particles[idxTarget].forces[0],&particles[idxTarget].forces[1],
&particles[idxTarget].forces[2],&particles[idxTarget].potential);
particles[idxOther].getPosition().getX(), particles[idxOther].getPosition().getY(),
particles[idxOther].getPosition().getZ(),particles[idxOther].getPhysicalValue(),
particles[idxTarget].getPosition().getX(), particles[idxTarget].getPosition().getY(),
particles[idxTarget].getPosition().getZ(),particles[idxTarget].getPhysicalValue(),
&particles[idxTarget].setForces()[0],&particles[idxTarget].setForces()[1],
&particles[idxTarget].setForces()[2],particles[idxTarget].setPotential());
}
}
} // end for
// Compute the energy
#pragma omp for reduction(+:denergy)
for(int idx = 0 ; idx < nbParticles ; ++idx){
denergy += particles[idx].potential*particles[idx].physicalValue ;
denergy += particles[idx].getPotential()*(particles[idx].getPhysicalValue()) ;
}
} // end pragma parallel
//
......@@ -187,11 +187,11 @@ int main(int argc, char ** argv){
denergy = 0 ;
for(int idx = 0 ; idx < nbParticles ; ++idx){
std::cout << ">> index " << idx << std::endl;
std::cout << " x " << particles[idx].position.getX() << " y " << particles[idx].position.getY() << " z " << particles[idx].position.getZ() << std::endl;
std::cout << " Q " << particles[idx].physicalValue << " V " << particles[idx].potential << std::endl;
std::cout << " fx " << particles[idx].forces[0] << " fy " << particles[idx].forces[1] << " fz " << particles[idx].forces[2] << std::endl;
std::cout << " x " << particles[idx].getPosition().getX() << " y " << particles[idx].getPosition().getY() << " z " << particles[idx].getPosition().getZ() << std::endl;
std::cout << " Q " << particles[idx].getPhysicalValue() << " V " << particles[idx].getPotential() << std::endl;
std::cout << " fx " << particles[idx].getForces()[0] << " fy " << particles[idx].getForces()[1] << " fz " << particles[idx].getForces()[2] << std::endl;
std::cout << "\n";
denergy += particles[idx].potential*particles[idx].physicalValue ;
denergy += particles[idx].getPotential()*particles[idx].getPhysicalValue() ;
}
}
std::cout << " ENERGY " << denergy << std::endl;
......
......@@ -84,8 +84,8 @@ public:
const FReal * getPtrFirstData() const{
return data;
}
int getReadDataNumber() const{
return READ;
unsigned int getReadDataNumber() const{
return (unsigned int) (READ);
}
int getWriteDataNumber() const{
return WRITE;
......@@ -143,36 +143,36 @@ public:
//! but we read (R4) only the four first values: the position and the physical value and we write (W8) all the data (8 values) in a file.
//! This class can be used if you read a file generated by generateDistributions and you want to store the result of a direct computations or a FFM one..
//!
class FmaR4W8Particle {
public:
FPoint position; ///< position of the particle
FReal physicalValue; ///< its physical value (mass or charge
FReal potential; ///< the potential
FReal forces[3]; ///<the force
// class FmaR4W8Particle {
// public:
// FPoint position; ///< position of the particle
// FReal physicalValue; ///< its physical value (mass or charge
// FReal potential; ///< the potential
// FReal forces[3]; ///<the force
/**
* return a pointer on the first value of the structure
*/
FReal * getPtrFirstData()
{return position.getDataValue() ;}
const FReal * getPtrFirstData() const
{return position.getDataValue() ;}
/**
* return The number of data to read. it is used in FMAGenericLoader (here 4)
*/
int getReadDataNumber()
{ return 4;}
/**
* return The number of data to write. it is used in FMAGenericWriter (here 8)
*/
int getWriteDataNumber() const
{ return 8;}
/**
* return size in byte of the structure. it is used in FMAGenericWriter
*/
unsigned int getWriteDataSize() const
{ return sizeof(FmaR4W8Particle);}
};
// /**
// * return a pointer on the first value of the structure
// */
// FReal * getPtrFirstData()
// {return position.getDataValue() ;}
// const FReal * getPtrFirstData() const
// {return position.getDataValue() ;}
// /**
// * return The number of data to read. it is used in FMAGenericLoader (here 4)
// */
// int getReadDataNumber()
// { return 4;}
// /**
// * return The number of data to write. it is used in FMAGenericWriter (here 8)
// */
// int getWriteDataNumber() const
// { return 8;}
// /**
// * return size in byte of the structure. it is used in FMAGenericWriter
// */
// unsigned int getWriteDataSize() const
// { return sizeof(FmaR4W8Particle);}
// };
//
//! \class FmaR8W8Particle
//!
......@@ -197,7 +197,7 @@ public:
//! Particle contains 4 values of type FReal and we read and write the four values
//!
typedef FmaR4W4Particle FmaBasicParticle ;
typedef FmaR4W8Particle FmaRParticle ;
typedef FmaRWParticle<4,8> FmaRParticle ;
typedef FmaRWParticle<8,8> FmaParticle ;
//
//! \class FFmaGenericLoader
......@@ -389,7 +389,7 @@ public:
* @param dataToRead is an array of type FReal. It contains all the values of a particles (for instance X,Y,Z,Q, ..
* @param nbDataToRead number of value to read (I.e. size of the array)
*/
void fillParticle(FReal* dataToRead, const unsigned int nbDataToRead){
void fillParticle(FReal* dataToRead, const unsigned int nbDataToRead){
if(binaryFile){
file->read((char*)(dataToRead), sizeof(FReal)*nbDataToRead);
if(nbDataToRead< typeData[1]){
......
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