Commit ea598213 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Remove cell extenssion and put coordinate and morton index directly in basic cell

parent 455e32e9
......@@ -16,10 +16,9 @@
#ifndef FBASICCELL_HPP
#define FBASICCELL_HPP
#include "../Utils/FGlobal.hpp"
#include "../Containers/FTreeCoordinate.hpp"
#include "FAbstractSerializable.hpp"
#include "../Extensions/FExtendMortonIndex.hpp"
#include "../Extensions/FExtendCoordinate.hpp"
/**
......@@ -34,27 +33,61 @@
*
*
*/
class FBasicCell : public FExtendMortonIndex, public FExtendCoordinate, public FAbstractSerializable {
class FBasicCell : public FAbstractSerializable {
MortonIndex mortonIndex; //< Morton index (need by most elements)
FTreeCoordinate coordinate; //< The position
public:
/** Default constructor */
FBasicCell() : mortonIndex(0) {
}
/** Default destructor */
virtual ~FBasicCell(){
}
/** To get the morton index */
MortonIndex getMortonIndex() const {
return this->mortonIndex;
}
/** To set the morton index */
void setMortonIndex(const MortonIndex inMortonIndex) {
this->mortonIndex = inMortonIndex;
}
/** To get the position */
const FTreeCoordinate& getCoordinate() const {
return this->coordinate;
}
/** To set the position */
void setCoordinate(const FTreeCoordinate& inCoordinate) {
this->coordinate = inCoordinate;
}
/** To set the position from 3 FReals */
void setCoordinate(const int inX, const int inY, const int inZ) {
this->coordinate.setX(inX);
this->coordinate.setY(inY);
this->coordinate.setZ(inZ);
}
/** Save the current cell in a buffer */
template <class BufferWriterClass>
void save(BufferWriterClass& buffer) const{
FExtendMortonIndex::save(buffer);
FExtendCoordinate::save(buffer);
buffer << mortonIndex;
coordinate.save(buffer);
}
/** Restore the current cell from a buffer */
template <class BufferReaderClass>
void restore(BufferReaderClass& buffer){
FExtendMortonIndex::restore(buffer);
FExtendCoordinate::restore(buffer);
buffer >> mortonIndex;
coordinate.restore(buffer);
}
int getSavedSize() const {
return FExtendMortonIndex::getSavedSize() + FExtendMortonIndex::getSavedSize();
return int(sizeof(mortonIndex)) + coordinate.getSavedSize();
}
/** Do nothing */
......
......@@ -46,7 +46,7 @@
*
* Particles and cells has to respect the Abstract class definition.
* Particle must extend {FExtendPosition}
* Cell must extend extend {FTreeCoordinate,FExtendMortonIndex}
* Cell must extend extend proposes accessors to FTreeCoordinate and MortonIndex.
*
* If the octree as an height H, then it goes from 0 to H-1
* at level 0 the space is not split
......
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
#ifndef FEXTENDCOORDINATE_HPP
#define FEXTENDCOORDINATE_HPP
#include "../Utils/FGlobal.hpp"
#include "../Containers/FTreeCoordinate.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendCoordinate
* Please read the license
* This class is an extenssion.
* It proposes a tree coordinate.
*/
class FExtendCoordinate {
protected:
FTreeCoordinate coordinate; //< The position
public:
/** Default constructor */
FExtendCoordinate() {
}
/** Copy constructor */
FExtendCoordinate(const FExtendCoordinate& other) : coordinate(other.coordinate) {
}
/** Copy operator */
FExtendCoordinate& operator=(const FExtendCoordinate& other) {
this->coordinate = other.coordinate;
return *this;
}
/** To get the position */
const FTreeCoordinate& getCoordinate() const {
return this->coordinate;
}
/** To set the position */
void setCoordinate(const FTreeCoordinate& inCoordinate) {
this->coordinate = inCoordinate;
}
/** To set the position from 3 FReals */
void setCoordinate(const int inX, const int inY, const int inZ) {
this->coordinate.setX(inX);
this->coordinate.setY(inY);
this->coordinate.setZ(inZ);
}
/** Save current object */
template <class BufferWriterClass>
void save(BufferWriterClass& buffer) const {
coordinate.save(buffer);
}
/** Retrieve current object */
template <class BufferReaderClass>
void restore(BufferReaderClass& buffer) {
coordinate.restore(buffer);
}
int getSavedSize() const {
return coordinate.getSavedSize();
}
};
#endif //FEXTENDCOORDINATE_HPP
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
#ifndef FEXTENDMORTONINDEX_HPP
#define FEXTENDMORTONINDEX_HPP
#include "../Utils/FGlobal.hpp"
#include "../Containers/FTreeCoordinate.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendMortonIndex
* Please read the license
* This class is an extenssion.
* It proposes a mortonIndex.
*/
class FExtendMortonIndex {
protected:
MortonIndex mortonIndex; //< Morton index (need by most elements)
public:
/** Default constructor */
FExtendMortonIndex() : mortonIndex(0) {
}
/** Copy constructor */
FExtendMortonIndex(const FExtendMortonIndex& other) : mortonIndex(other.mortonIndex) {
}
/** Copy operator */
FExtendMortonIndex& operator=(const FExtendMortonIndex& other) {
this->mortonIndex = other.mortonIndex;
return *this;
}
/** To get the morton index */
MortonIndex getMortonIndex() const {
return this->mortonIndex;
}
/** To set the morton index */
void setMortonIndex(const MortonIndex inMortonIndex) {
this->mortonIndex = inMortonIndex;
}
/** Save current object */
template <class BufferWriterClass>
void save(BufferWriterClass& buffer) const {
buffer << mortonIndex;
}
/** Retrieve current object */
template <class BufferReaderClass>
void restore(BufferReaderClass& buffer) {
buffer >> mortonIndex;
}
int getSavedSize() const {
return int(sizeof(mortonIndex));
}
};
#endif //FEXTENDMORTONINDEX_HPP
......@@ -18,8 +18,6 @@
#include <iostream>
#include "../../Components/FBasicCell.hpp"
#include "../../Extensions/FExtendMortonIndex.hpp"
#include "../../Extensions/FExtendCoordinate.hpp"
#include "./FChebTensor.hpp"
#include "../../Extensions/FExtendCellType.hpp"
......
......@@ -17,9 +17,6 @@
#define FINTERPCELL_HPP
#include "../../Extensions/FExtendMortonIndex.hpp"
#include "../../Extensions/FExtendCoordinate.hpp"
#include "./FInterpTensor.hpp"
#include "../../Components/FBasicCell.hpp"
#include "../../Extensions/FExtendCellType.hpp"
......
......@@ -20,9 +20,6 @@
#define FUNIFCELL_HPP
#include "../../Extensions/FExtendMortonIndex.hpp"
#include "../../Extensions/FExtendCoordinate.hpp"
#include "./FUnifTensor.hpp"
#include "../../Components/FBasicCell.hpp"
#include "../../Extensions/FExtendCellType.hpp"
......
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