4 refined_old(vector<int>()) {}
10 int nrefine=
static_cast<int>(ToRefine.size());
13 vector<Vector2D> newdirections;
14 for(
int i=0;i<nrefine;++i)
16 vector<int>
const& edges=tess.
GetCellEdges(ToRefine[static_cast<size_t>(i)]);
17 int nedge=
static_cast<int>(edges.size());
19 for(
int j=0;j<nedge;++j)
21 Edge const& edge=tess.
GetEdge(edges[static_cast<size_t>(j)]);
30 res.push_back(ToRefine[static_cast<size_t>(i)]);
31 if(!directions.empty())
32 newdirections.push_back(directions[static_cast<size_t>(i)]);
35 directions=newdirections;
40 int Npoints,vector<Vector2D> &directions,vector<int>
const& Removed,
48 for(
size_t i=0;i<sentcells.size();++i)
49 if(!sentcells[i].empty())
50 allsent.insert(allsent.end(),sentcells[i].begin(),sentcells[i].end());
53 sort(allsent.begin(),allsent.end());
57 const size_t toAdd=
static_cast<size_t>(lower_bound(allsent.begin(),allsent.end(),
refined_old[i])-
70 const size_t toAdd=
static_cast<size_t>(lower_bound(Removed.begin(),Removed.end(),
refined_old[i])-
76 vector<Vector2D> newdirections;
77 for(
size_t i=0;i<ToRefine.size();++i)
82 const double R=tess.
GetWidth(ToRefine[i]);
84 vector<int> temp(1, -1);
86 const int nn=
static_cast<int>(neigh.size());
94 res.push_back(ToRefine[i]);
95 if(!directions.empty())
96 newdirections.push_back(directions[i]);
100 directions=newdirections;
101 vector<int> temp=res;
102 sort(temp.begin(),temp.end());
105 int N=int(res.size());
107 refined_old.push_back(Npoints+i);
114 vector<Edge>
const& edges,
double R,
Vector2D &normal)
118 int nedges=
static_cast<int>(edges.size());
119 if(point.distance(tess->
GetCellCM(PointToRefine))<0.1*R)
124 for(
int j=1;j<nedges;++j)
133 slope=
Parallel(edges[static_cast<size_t>(min_edge)]);
134 slope=slope/
abs(slope);
135 Vector2D v=point-edges[
static_cast<size_t>(min_edge)].vertices.first;
137 normal=normal/
abs(normal);
141 normal=tess->
GetCellCM(PointToRefine)-point;
142 normal=normal/
abs(normal);
143 slope.
Set(normal.
y,-normal.
x);
vector< T > unique(vector< T > const &v)
Returns a vector containing only unique elements.
double distance(Vector2D const &v1) const
Caluclates the distance from the Vector to v1.
Vector2D FindBestSplit(Tessellation const *tess, int PointToRefine, vector< Edge > const &edges, double R, Vector2D &normal)
Finds the best way to spit the cell by finding the line connecting the mesh point and the cell's CM...
RefineStrategy(void)
Class constructor.
Vector2D Parallel(Edge const &edge)
Calculates a unit vector parallel to an edge.
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
vector< int > refined_old
The cells that were refined in the previous time step.
virtual Vector2D const & GetCellCM(int index) const =0
Returns Position of Cell's CM.
virtual ~RefineStrategy(void)
Virtual destructor.
vector< int > RemoveDuplicatedLately(vector< int > const &ToRefine, int Npoints, vector< Vector2D > &directions, vector< int > const &Removed, Tessellation const &tess)
Removes cells that were splitted in the last time step.
Interface between two cells.
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
double y
Component in the y direction.
virtual vector< vector< int > > const & GetSentPoints(void) const =0
Returns the indeces of the points that where sent to other processors.
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Abstract class for refinement scheme.
virtual double GetWidth(int index) const =0
Returns the effective width of a cell.
void Set(double ix, double iy)
Set vector components.
std::pair< int, int > neighbors
Neighboring cells.
double DistanceToEdge(Vector2D const &point, Edge const &edge)
Calculates the distance of a point to an edge.
double abs(Vector3D const &v)
Norm of a vector.
vector< int > RemoveNearBoundary(vector< int > const &ToRefine, vector< Vector2D > &directions, Tessellation const &tess)
Removed from the list cells near periodic boundaries.
virtual vector< int > const & GetCellEdges(int index) const =0
Returns the indexes of a cell's edges.
vector< T > RemoveList(vector< T > const &v, vector< T > const &list)
Returns only elements from vector v which are not in vector list, assumes list is sorted...
virtual vector< int > GetNeighbors(int index) const =0
Returns the indeces of the neighbors.
double x
Component in the x direction.