Commit 05476fcf authored by berenger-bramas's avatar berenger-bramas

Rename list vector methods

(step 2/2)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@102 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 6cfc352f
......@@ -74,8 +74,8 @@ public:
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
// The particles is impacted by the parent cell
typename FList<ParticleClass>::BasicIterator iter(*particles);
while( iter.isValide() ){
iter.value().setDataDown(iter.value().getDataDown() + local->getDataDown());
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + local->getDataDown());
iter.gotoNext();
}
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
......@@ -95,8 +95,8 @@ public:
}
typename FList<ParticleClass>::BasicIterator iter(*targets);
while( iter.isValide() ){
iter.value().setDataDown(iter.value().getDataDown() + inc);
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + inc);
iter.gotoNext();
}
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
......@@ -118,8 +118,8 @@ public:
}
typename FList<ParticleClass>::BasicIterator iter(*targets);
while( iter.isValide() ){
iter.value().setDataDown(iter.value().getDataDown() + inc);
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + inc);
iter.gotoNext();
}
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
......@@ -178,12 +178,12 @@ void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass, TreeHeight , S
const bool isUsingTsm = (octreeIterator.getCurrentListTargets() != octreeIterator.getCurrentListSrc());
while( iter.isValide() ){
while( iter.hasNotFinished() ){
// If a particles has been impacted by less than NbPart - 1 (the current particle)
// there is a problem
if( (!isUsingTsm && iter.value().getDataDown() != NbPart - 1) ||
(isUsingTsm && iter.value().getDataDown() != NbPart) ){
std::cout << "Problem L2P + P2P : " << iter.value().getDataDown() << "\n";
if( (!isUsingTsm && iter.data().getDataDown() != NbPart - 1) ||
(isUsingTsm && iter.data().getDataDown() != NbPart) ){
std::cout << "Problem L2P + P2P : " << iter.data().getDataDown() << "\n";
}
iter.gotoNext();
}
......
......@@ -164,8 +164,8 @@ public:
* FList<int> values; <br>
* // inserting ... <br>
* FList<int>::BasicIterator iter(values); <br>
* while( iter.isValide() ){ <br>
* iter.value() += 1; <br>
* while( iter.hasNotFinished() ){ <br>
* iter.data() += 1; <br>
* iter.gotoNext(); <br>
* } <br>
* </code>
......@@ -189,17 +189,17 @@ public:
/**
* Current pointed value
* current iterator must be valide (isValide()) to use this function
* current iterator must be valide (hasNotFinished()) to use this function
*/
Object& value(){
Object& data(){
return this->iter->target;
}
/**
* Current pointed value
* current iterator must be valide (isValide()) to use this function
* current iterator must be valide (hasNotFinished()) to use this function
*/
const Object& value() const{
const Object& data() const{
return this->iter->target;
}
......@@ -207,7 +207,7 @@ public:
* To know if an iterator is at the end of the list
* @return true if the current iterator can gotoNext and access to value, else false
*/
bool isValide() const{
bool hasNotFinished() const{
return iter;
}
......@@ -221,8 +221,8 @@ public:
* FList<int> values; <br>
* // inserting ... <br>
* FList<int>::ConstBasicIterator iter(values); <br>
* while( iter.isValide() ){ <br>
* iter.value() += 1; <br>
* while( iter.hasNotFinished() ){ <br>
* iter.data() += 1; <br>
* iter.gotoNext(); <br>
* } <br>
* </code>
......@@ -246,17 +246,17 @@ public:
/**
* Current pointed value
* current iterator must be valide (isValide()) to use this function
* current iterator must be valide (hasNotFinished()) to use this function
*/
Object value(){
Object data(){
return this->iter->target;
}
/**
* Current pointed value
* current iterator must be valide (isValide()) to use this function
* current iterator must be valide (hasNotFinished()) to use this function
*/
const Object& value() const{
const Object& data() const{
return this->iter->target;
}
......@@ -264,7 +264,7 @@ public:
* To know if an iterator is at the end of the list
* @return true if the current iterator can gotoNext and access to value, else false
*/
bool isValide() const{
bool hasNotFinished() const{
return iter;
}
};
......
......@@ -178,15 +178,15 @@ public:
++this->index;
}
bool isValide() const{
bool hasNotFinished() const{
return this->index < this->vector->index;
}
T& value(){
T& data(){
return this->vector->array[this->index];
}
const T& value() const{
const T& data() const{
return this->vector->array[this->index];
}
......@@ -209,11 +209,11 @@ public:
++this->index;
}
bool isValide() const{
bool hasNotFinished() const{
return this->index < this->vector->index;
}
const T& value() const{
const T& data() const{
return this->vector->array[this->index];
}
......
......@@ -49,7 +49,7 @@ public:
* To know if the loader is valide (file opened, etc.)
* @return true if file is open
*/
virtual bool isValide() const = 0;
virtual bool hasNotFinished() const = 0;
/**
* Fill the next particle
......
......@@ -20,7 +20,7 @@
* ....
* <code>
* FBasicLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* if(!loader.isValide()){ <br>
* if(!loader.hasNotFinished()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
* } <br>
......@@ -46,7 +46,7 @@ public:
/**
* The constructor need the file name
* @param filename the name of the file to open
* you can test if file is successfuly open by calling isValide()
* you can test if file is successfuly open by calling hasNotFinished()
*/
FBasicLoader(const char* const filename): file(filename,std::ifstream::in){
// test if open
......@@ -72,7 +72,7 @@ public:
* To know if file is open and ready to read
* @return true if loader can work
*/
bool isValide() const{
bool hasNotFinished() const{
return this->file.is_open() && !this->file.eof();
}
......
......@@ -20,7 +20,7 @@
* ....
* <code>
* FFmaLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* if(!loader.isValide()){ <br>
* if(!loader.hasNotFinished()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
* } <br>
......@@ -48,7 +48,7 @@ public:
/**
* The constructor need the file name
* @param filename the name of the file to open
* you can test if file is successfuly open by calling isValide()
* you can test if file is successfuly open by calling hasNotFinished()
*/
FFmaLoader(const char* const filename): file(filename,std::ifstream::in){
// test if open
......@@ -75,7 +75,7 @@ public:
* To know if file is open and ready to read
* @return true if loader can work
*/
bool isValide() const{
bool hasNotFinished() const{
return this->file.is_open() && !this->file.eof();
}
......
......@@ -20,7 +20,7 @@
* ....
* <code>
* FFmaScanfLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* if(!loader.isValide()){ <br>
* if(!loader.hasNotFinished()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
* } <br>
......@@ -48,7 +48,7 @@ public:
/**
* The constructor need the file name
* @param filename the name of the file to open
* you can test if file is successfuly open by calling isValide()
* you can test if file is successfuly open by calling hasNotFinished()
*/
FFmaScanfLoader(const char* const filename): file(0){
file = fopen(filename,"r");
......@@ -83,7 +83,7 @@ public:
* To know if file is open and ready to read
* @return true if loader can work
*/
bool isValide() const{
bool hasNotFinished() const{
return this->file != NULL;
}
......
......@@ -20,7 +20,7 @@
* ....
* <code>
* FFmaTsmLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* if(!loader.isValide()){ <br>
* if(!loader.hasNotFinished()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
* } <br>
......@@ -48,7 +48,7 @@ public:
/**
* The constructor need the file name
* @param filename the name of the file to open
* you can test if file is successfuly open by calling isValide()
* you can test if file is successfuly open by calling hasNotFinished()
*/
FFmaTsmLoader(const char* const filename): file(filename,std::ifstream::in){
// test if open
......@@ -75,7 +75,7 @@ public:
* To know if file is open and ready to read
* @return true if loader can work
*/
bool isValide() const{
bool hasNotFinished() const{
return this->file.is_open() && !this->file.eof();
}
......
......@@ -20,7 +20,7 @@
* ....
* <code>
* FHLoader<FBasicParticle> loader("../FMB++/Tests/particles.basic.txt"); <br>
* if(!loader.isValide()){ <br>
* if(!loader.hasNotFinished()){ <br>
* std::cout << "Loader Error\n"; <br>
* return 1; <br>
* } <br>
......@@ -48,7 +48,7 @@ public:
/**
* The constructor need the file name
* @param filename the name of the file to open
* you can test if file is successfuly open by calling isValide()
* you can test if file is successfuly open by calling hasNotFinished()
*/
FHLoader(const char* const filename): file(0){
file = fopen(filename,"r");
......@@ -86,7 +86,7 @@ public:
* To know if file is open and ready to read
* @return true if loader can work
*/
bool isValide() const{
bool hasNotFinished() const{
return this->file != NULL;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -78,7 +78,7 @@ int main(int argc, char ** argv){
}
FFmaLoader<FmbParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......@@ -122,12 +122,12 @@ int main(int argc, char ** argv){
octreeIterator.gotoBottomLeft();
do{
FList<FmbParticle>::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.isValide() ){
potential += iter.value().getPotential() * iter.value().getPhysicalValue();
forces += iter.value().getForces();
while( iter.hasNotFinished() ){
potential += iter.data().getPotential() * iter.data().getPhysicalValue();
forces += iter.data().getForces();
//printf("x = %e y = %e z = %e \n",iter.value()->getPosition().getX(),iter.value()->getPosition().getY(),iter.value()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.value()->getForces().getX(),iter.value()->getForces().getY(),iter.value()->getForces().getZ());
//printf("x = %e y = %e z = %e \n",iter.data()->getPosition().getX(),iter.data()->getPosition().getY(),iter.data()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.data()->getForces().getX(),iter.data()->getForces().getY(),iter.data()->getForces().getZ());
//printf("\t\t Sum Forces ( %e , %e , %e)\n",
//forces.getX(),forces.getY(),forces.getZ());
......
......@@ -218,22 +218,22 @@ void ValidateFMMAlgoProc(FOctree<ParticleClass, CellClass, LeafClass, OctreeHeig
std::cout << idx << " Index are differents " << std::endl;
}
while( iter.isValide() && iterValide.isValide() ){
while( iter.hasNotFinished() && iterValide.hasNotFinished() ){
// If a particles has been impacted by less than NbPart - 1 (the current particle)
// there is a problem
if( iterValide.value().getPotential() != iter.value().getPotential() ){
std::cout << idx << " Potential error : " << iterValide.value().getPotential() << " " << iter.value().getPotential() << "\n";
if( iterValide.data().getPotential() != iter.data().getPotential() ){
std::cout << idx << " Potential error : " << iterValide.data().getPotential() << " " << iter.data().getPotential() << "\n";
}
if( !FMath::LookEqual(iterValide.value().getForces().getX(),iter.value().getForces().getX())
|| !FMath::LookEqual(iterValide.value().getForces().getY(),iter.value().getForces().getY())
|| !FMath::LookEqual(iterValide.value().getForces().getZ(),iter.value().getForces().getZ()) ){
/*std::cout << idx << " Forces error : " << (iterValide.value().getForces().getX() - iter.value().getForces().getX())
<< " " << (iterValide.value().getForces().getY() - iter.value().getForces().getY())
<< " " << (iterValide.value().getForces().getZ() - iter.value().getForces().getZ()) << "\n";*/
std::cout << idx << " Forces error : x " << iterValide.value().getForces().getX() << " " << iter.value().getForces().getX()
<< " y " << iterValide.value().getForces().getY() << " " << iter.value().getForces().getY()
<< " z " << iterValide.value().getForces().getZ() << " " << iter.value().getForces().getZ() << "\n";
if( !FMath::LookEqual(iterValide.data().getForces().getX(),iter.data().getForces().getX())
|| !FMath::LookEqual(iterValide.data().getForces().getY(),iter.data().getForces().getY())
|| !FMath::LookEqual(iterValide.data().getForces().getZ(),iter.data().getForces().getZ()) ){
/*std::cout << idx << " Forces error : " << (iterValide.data().getForces().getX() - iter.data().getForces().getX())
<< " " << (iterValide.data().getForces().getY() - iter.data().getForces().getY())
<< " " << (iterValide.data().getForces().getZ() - iter.data().getForces().getZ()) << "\n";*/
std::cout << idx << " Forces error : x " << iterValide.data().getForces().getX() << " " << iter.data().getForces().getX()
<< " y " << iterValide.data().getForces().getY() << " " << iter.data().getForces().getY()
<< " z " << iterValide.data().getForces().getZ() << " " << iter.data().getForces().getZ() << "\n";
}
iter.gotoNext();
iterValide.gotoNext();
......@@ -274,7 +274,7 @@ int main(int argc, char ** argv){
}
FFmaLoader<FmbParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......@@ -355,16 +355,16 @@ int main(int argc, char ** argv){
#ifdef VALIDATE_FMM
FList<FmbParticle>::ConstBasicIterator iterValide(*octreeIteratorValide.getCurrentListTargets());
#endif
while( iter.isValide()
while( iter.hasNotFinished()
#ifdef VALIDATE_FMM
&& iterValide.isValide()
&& iterValide.hasNotFinished()
#endif
){
potential += iter.value().getPotential() * iter.value().getPhysicalValue();
forces += iter.value().getForces();
potential += iter.data().getPotential() * iter.data().getPhysicalValue();
forces += iter.data().getForces();
#ifdef VALIDATE_FMM
potentialValide += iterValide.value().getPotential() * iterValide.value().getPhysicalValue();
forcesValide += iterValide.value().getForces();
potentialValide += iterValide.data().getPotential() * iterValide.data().getPhysicalValue();
forcesValide += iterValide.data().getForces();
iterValide.gotoNext();
#endif
iter.gotoNext();
......
......@@ -79,7 +79,7 @@ int main(int argc, char ** argv){
}
FFmaScanfLoader<FmbParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......@@ -126,12 +126,12 @@ int main(int argc, char ** argv){
octreeIterator.gotoBottomLeft();
do{
FList<FmbParticle>::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.isValide() ){
potential += iter.value().getPotential() * iter.value().getPhysicalValue();
forces += iter.value().getForces();
while( iter.hasNotFinished() ){
potential += iter.data().getPotential() * iter.data().getPhysicalValue();
forces += iter.data().getForces();
//printf("x = %e y = %e z = %e \n",iter.value()->getPosition().getX(),iter.value()->getPosition().getY(),iter.value()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.value()->getForces().getX(),iter.value()->getForces().getY(),iter.value()->getForces().getZ());
//printf("x = %e y = %e z = %e \n",iter.data()->getPosition().getX(),iter.data()->getPosition().getY(),iter.data()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.data()->getForces().getX(),iter.data()->getForces().getY(),iter.data()->getForces().getZ());
//printf("\t\t Sum Forces ( %e , %e , %e)\n",
//forces.getX(),forces.getY(),forces.getZ());
......
......@@ -77,7 +77,7 @@ int main(int argc, char ** argv){
}
FFmaTsmLoader<FmbParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......@@ -123,12 +123,12 @@ int main(int argc, char ** argv){
octreeIterator.gotoBottomLeft();
do{
FList<FmbParticle>::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.isValide() ){
potential += iter.value().getPotential() * iter.value().getPhysicalValue();
forces += iter.value().getForces();
while( iter.hasNotFinished() ){
potential += iter.data().getPotential() * iter.data().getPhysicalValue();
forces += iter.data().getForces();
//printf("x = %e y = %e z = %e \n",iter.value()->getPosition().getX(),iter.value()->getPosition().getY(),iter.value()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.value()->getForces().getX(),iter.value()->getForces().getY(),iter.value()->getForces().getZ());
//printf("x = %e y = %e z = %e \n",iter.data()->getPosition().getX(),iter.data()->getPosition().getY(),iter.data()->getPosition().getZ());
//printf("\t fx = %e fy = %e fz = %e \n",iter.data()->getForces().getX(),iter.data()->getForces().getY(),iter.data()->getForces().getZ());
//printf("\t\t Sum Forces ( %e , %e , %e)\n",
//forces.getX(),forces.getY(),forces.getZ());
......
......@@ -178,12 +178,12 @@ void ValidateFMMAlgoProc(FOctree<ParticleClass, CellClass, LeafClass, OctreeHeig
const bool isUsingTsm = (octreeIterator.getCurrentListTargets() != octreeIterator.getCurrentListSrc());
while( iter.isValide() ){
while( iter.hasNotFinished() ){
// If a particles has been impacted by less than NbPart - 1 (the current particle)
// there is a problem
if( (!isUsingTsm && iter.value().getDataDown() != NbPart - 1) ||
(isUsingTsm && iter.value().getDataDown() != NbPart) ){
std::cout << "Problem L2P + P2P, value on particle is : " << iter.value().getDataDown() << "\n";
if( (!isUsingTsm && iter.data().getDataDown() != NbPart - 1) ||
(isUsingTsm && iter.data().getDataDown() != NbPart) ){
std::cout << "Problem L2P + P2P, value on particle is : " << iter.data().getDataDown() << "\n";
}
iter.gotoNext();
}
......@@ -240,7 +240,7 @@ int main(int argc, char ** argv){
}
FFmaLoader<TestParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......
......@@ -59,7 +59,7 @@ int main(int argc, char ** argv){
// open basic particles loader
FBasicLoader<FBasicParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << "is missing\n";
return 1;
}
......
......@@ -59,7 +59,7 @@ int main(int argc, char ** argv ){
// open basic particles loader
FFmaLoader<FFmaParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << "is missing\n";
return 1;
}
......
......@@ -59,7 +59,7 @@ int main(int argc, char ** argv ){
// open basic particles loader
FFmaTsmLoader<ParticleTsm> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << "is missing\n";
return 1;
}
......
......@@ -85,7 +85,7 @@ int main(int argc, char ** argv){
}
FHLoader<Particle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......@@ -124,9 +124,9 @@ int main(int argc, char ** argv){
std::cout << "Particles :" << std::endl;
FList<Particle>::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.isValide() ){
while( iter.hasNotFinished() ){
printf("\tx = %e y = %e z = %e data = %c\n",iter.value().getPosition().getX(),iter.value().getPosition().getY(),iter.value().getPosition().getZ(),iter.value().getData());
printf("\tx = %e y = %e z = %e data = %c\n",iter.data().getPosition().getX(),iter.data().getPosition().getY(),iter.data().getPosition().getZ(),iter.data().getData());
iter.gotoNext();
}
......
......@@ -62,7 +62,7 @@ int main(int argc, char ** argv){
}
FFmaLoader<FFmaParticle> loader(filename);
if(!loader.isValide()){
if(!loader.hasNotFinished()){
std::cout << "Loader Error, " << filename << " is missing\n";
return 1;
}
......
......@@ -73,7 +73,7 @@ class TestList : public FUTester<TestList> {
FList<TestObject> list;
{
FList<TestObject>::BasicIterator iter(list);
assert(!iter.isValide());
assert(!iter.hasNotFinished());
}
{
list.push(TestObject());
......@@ -81,11 +81,11 @@ class TestList : public FUTester<TestList> {
list.push(TestObject());
FList<TestObject>::BasicIterator iter(list);
assert(iter.isValide());
assert(iter.hasNotFinished());
int counter = 0;
while(iter.isValide()){ iter.gotoNext(); ++counter; }
assert(!iter.isValide());
while(iter.hasNotFinished()){ iter.gotoNext(); ++counter; }
assert(!iter.hasNotFinished());
assert(counter == list.getSize());
}
}
......
......@@ -79,7 +79,7 @@ class TestVector : public FUTester<TestVector> {
FVector<TestObject> vector;
{
FVector<TestObject>::BasicIterator iter(vector);
assert(!iter.isValide());
assert(!iter.hasNotFinished());
}
{
vector.push(TestObject());
......@@ -87,11 +87,11 @@ class TestVector : public FUTester<TestVector> {
vector.push(TestObject());
FVector<TestObject>::BasicIterator iter(vector);
assert(iter.isValide());
assert(iter.hasNotFinished());
int counter = 0;
while(iter.isValide()){ iter.gotoNext(); ++counter; }
assert(!iter.isValide());
while(iter.hasNotFinished()){ iter.gotoNext(); ++counter; }
assert(!iter.hasNotFinished());
assert(counter == vector.getSize());
}
}
......
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