Commit c2671a54 authored by Jund Thomas's avatar Jund Thomas

particleMemo: using references instead of pointers

parent d2c82ad7
......@@ -42,14 +42,14 @@ public:
}
void vertexState(const VEC3& current, CellMarkerMemo<FACE> * memo_cross) ;
void vertexState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross) ;
void edgeState(const VEC3& current, CellMarkerMemo<FACE> * memo_cross, Geom::Orientation2D sideOfEdge = Geom::ALIGNED) ;
void edgeState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross, Geom::Orientation2D sideOfEdge = Geom::ALIGNED) ;
void faceState(const VEC3& current, CellMarkerMemo<FACE> * memo_cross) ;
void faceState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross) ;
void move(const VEC3& goal, CellMarkerMemo<FACE> * memo_cross) ;
std::vector<Dart> get_memo(const VEC3& goal);
std::vector<Dart> move(const VEC3& goal) ;
std::vector<Dart> move(const VEC3& goal, CellMarkerMemo<FACE>& memo_cross) ;
} ;
#include "particle_cell_2D_memo.hpp"
......
template <typename PFP>
void ParticleCell2DMemo<PFP>::move(const VEC3& goal, CellMarkerMemo<FACE> * memo_cross)
std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal)
{
this->crossCell = NO_CROSS ;
if (!Geom::arePointsEquals(goal, this->getPosition()))
{
CellMarkerMemo<FACE> memo_cross(this->m);
memo_cross.mark(this->d);
switch (this->getState())
{
case VERTEX :
......@@ -16,28 +19,52 @@ void ParticleCell2DMemo<PFP>::move(const VEC3& goal, CellMarkerMemo<FACE> * memo
faceState(goal,memo_cross) ;
break ;
}
return memo_cross.get_markedCells();
}
else
this->ParticleBase<PFP>::move(goal) ;
std::vector<Dart> res;
res.push_back(this->d);
return res;
}
template <typename PFP>
std::vector<Dart> ParticleCell2DMemo<PFP>::get_memo(const VEC3& goal)
std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal, CellMarkerMemo<FACE>& memo_cross)
{
CellMarkerMemo<FACE> memo_cross(this->m);
memo_cross.mark(this->d);
this->move(goal,&memo_cross);
this->crossCell = NO_CROSS ;
if (!Geom::arePointsEquals(goal, this->getPosition()))
{
switch (this->getState())
{
case VERTEX :
vertexState(goal,memo_cross) ;
break ;
case EDGE :
edgeState(goal,memo_cross) ;
break ;
case FACE :
faceState(goal,memo_cross) ;
break ;
}
}
else
this->ParticleBase<PFP>::move(goal) ;
return memo_cross.get_markedCells();
}
template <typename PFP>
void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<FACE> * memo_cross)
void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross)
{
#ifdef DEBUG
CGoGNout << "vertexState" << this->d << CGoGNendl ;
#endif
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])) ;
(*memo_cross).mark(this->d);
memo_cross.mark(this->d);
this->crossCell = CROSS_OTHER ;
if (Algo::Geometry::isPointOnVertex < PFP > (this->m, this->d, this->positionAttribut, current))
......@@ -119,7 +146,7 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<FA
}
template <typename PFP>
void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<FACE>* memo_cross, Geom::Orientation2D sideOfEdge)
void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross, Geom::Orientation2D sideOfEdge)
{
#ifdef DEBUG
CGoGNout << "edgeState" << this->d << CGoGNendl ;
......@@ -127,7 +154,7 @@ void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<FACE
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])) ;
// assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
(*memo_cross).mark(this->d);
memo_cross.mark(this->d);
if (this->crossCell == NO_CROSS)
{
this->crossCell = CROSS_EDGE ;
......@@ -173,7 +200,7 @@ void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<FACE
}
template <typename PFP>
void ParticleCell2DMemo<PFP>::faceState(const VEC3& current, CellMarkerMemo<FACE> * memo_cross)
void ParticleCell2DMemo<PFP>::faceState(const VEC3& current, CellMarkerMemo<FACE>& memo_cross)
{
#ifdef DEBUG
CGoGNout << "faceState" << this->d << CGoGNendl ;
......@@ -184,7 +211,7 @@ void ParticleCell2DMemo<PFP>::faceState(const VEC3& current, CellMarkerMemo<FACE
&& std::isfinite(this->getPosition()[2])) ;
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])) ;
// assert(Algo::Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
(*memo_cross).mark(this->d);
memo_cross.mark(this->d);
Dart dd = this->d ;
float wsoe = this->getOrientationFace(current, this->m.phi1(this->d)) ;
......
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