5 #define GET_MASK_X 0x00f 6 #define GET_MASK_Y 0x0f0 7 #define GET_MASK_Z 0xf00 11 #define DOM_SET_POS(n,p,m) ( (n)|=((p)<<(m)) ) 12 #define DOM_GET_POS(n,m,g) ( ((n)&(g))>>(m) ) 14 #define DOM_IF_POS(n,m,d) ( ((n)>>(m))==(d) ) 29 fprintf(stderr,
"Dom Dec error: ");
30 vfprintf(stderr, s, args);
31 fprintf(stderr,
"exiting the program\n");
43 printf(
"CutOff larger than the cell size\n");
65 SigErr(c < 0 || c >
NCell,
"cell value %d over the ranges\n",c);
72 NeiMod[2] = (int)(c/(
double)
Mod10[2]);
73 NeiMod[1] = (int)((c-NeiMod[2]*
Mod10[2])/(double)Mod10[1]);
74 NeiMod[0] = (int)(c-NeiMod[1]*Mod10[1]-NeiMod[2]*Mod10[2]);
75 for(
int n=0;n<27;n++)
for(
int d=0;d<3;d++)
BoundCond[n][d] = 0.;
76 for(
int cx=-1;cx<=1;cx++){
77 NeiCell[0] = NeiMod[0] + cx;
78 if(NeiCell[0] >=
NSect[0]){
79 NeiCell[0] -=
NSect[0];
83 NeiCell[0] +=
NSect[0];
86 for(
int cy=-1;cy<=1;cy++){
87 NeiCell[1] = NeiMod[1] + cy;
88 if(NeiCell[1] >=
NSect[1]){
89 NeiCell[1] -=
NSect[1];
93 NeiCell[1] +=
NSect[1];
96 for(
int cz=-1;cz<=1;cz++){
97 NeiCell[2] = NeiMod[2] + cz;
98 if(NeiCell[2] >=
NSect[2]){
99 NeiCell[2] -=
NSect[2];
103 NeiCell[2] +=
NSect[2];
106 NeiList[NNei] = NeiCell[0]*Mod10[0] + NeiCell[1]*Mod10[1] + NeiCell[2]*Mod10[2];
122 SigErr(c < 0,
"Probably the particle position is not a number cell %d\n",c);
126 int Mask[3] = {MASK_X,MASK_Y,MASK_Z};
127 int GetMask[3] = {GET_MASK_X,GET_MASK_Y,GET_MASK_Z};
128 int Move[3] = {0,0,0};
129 NeiCell[2] = (int)(c/(
double)
Mod10[2]);
130 NeiCell[1] = (int)((c-NeiCell[2]*
Mod10[2])/(double)Mod10[1]);
131 NeiCell[0] = (int)(c-NeiCell[1]*Mod10[1]-NeiCell[2]*Mod10[2]);
132 for(
int n=0;n<27;n++)
for(
int d=0;d<3;d++)
BoundCond[n][d] = 0.;
133 for(
int d=0;d<3;d++){
136 if( DOM_GET_POS(Coord,Mask[d],GetMask[d]) == DOM_RIGHT ){
138 int nc = NeiCell[d] + 1.;
143 NeiList[NNei++] = nc*Mod10[d] + NeiCell[d1]*Mod10[d1] + NeiCell[d2]*Mod10[d2];
145 else if( DOM_GET_POS(Coord,Mask[d],GetMask[d]) == DOM_LEFT ){
147 int nc = NeiCell[d] - 1.;
152 NeiList[NNei++] = nc*Mod10[d] + NeiCell[d1]*Mod10[d1] + NeiCell[d2]*Mod10[d2];
156 for(
int d=0;d<3;d++){
157 nNei[d] = NeiCell[d];
158 if(Move[d] == DOM_LEFT){
159 nNei[d] = NeiCell[d] - 1;
160 if(nNei[d] < 0) nNei[d] =
NSect[d] - 1;
162 if(Move[d] == DOM_RIGHT){
163 nNei[d] = NeiCell[d] + 1;
164 if(nNei[d] >=
NSect[d]) nNei[d] = 0;
167 NeiList[NNei++] = nNei[0]*Mod10[0] + nNei[1]*Mod10[1] + nNei[2]*Mod10[2];
170 for(
int dd=0;dd<3;dd++){
171 for(
int d=0;d<3;d++){
172 nNei[d] = NeiCell[d];
173 if(d == dd)
continue;
174 if(Move[d] == DOM_LEFT){
175 nNei[d] = NeiCell[d] - 1;
176 if(nNei[d] < 0) nNei[d] =
NSect[d] - 1;
178 if(Move[d] == DOM_RIGHT){
179 nNei[d] = NeiCell[d] + 1;
180 if(nNei[d] >=
NSect[d]) nNei[d] = 0;
183 NeiList[NNei++] = nNei[0]*Mod10[0] + nNei[1]*Mod10[1] + nNei[2]*Mod10[2];
194 for(
int d=0;d<3;d++){
195 double PosBox = Pos[d] - floor(Pos[d]*
InvEdge[d])*
Edge[d];
196 ris[d] = (int)(PosBox/Edge[d]*
NSect[d]);
199 SigErr(risp >=
NCell,
"Probably the particle position is not a number\n");
204 for(
int d=0;d<3;d++){
205 double PosBox = Pos[d];
209 SigErr(c[4] >=
NCell,
"Probably the particle position is not a number\n");
216 int Mask[3] = {MASK_X,MASK_Y,MASK_Z};
218 for(
int d=0;d<3;d++){
219 Border[d] = (int)(Pos[d]/
Edge[d]*
NSect[d]);
221 if(Pos[d] - Border[d]*CellLen[d] <
CutOff){
222 DOM_SET_POS(Coord,DOM_LEFT,Mask[d]);
224 if(-Pos[d] + (Border[d]+1)*CellLen[d] <
CutOff){
225 DOM_SET_POS(Coord,DOM_RIGHT,Mask[d]);
233 for(
int d=0;d<3;d++){
234 Edge[d] = EdgeExt[d];
238 SigErr(CutOffExt > 2.*
Edge[d],
"Insufficient number of cells \n");
247 SigErr(Cella==NULL,
"DomCell not allocated\n");
248 for(
int c=0;c<
NCell;c++){
250 Cella[c].First = Cella[c].Last = -2;
254 SigErr(Pc == NULL,
"DOMAIN_PART not allocated\n");
255 printf(
"%d\n",NCell);
259 for(
int c=0;c<
NCell;c++){
263 for(
int p=0;p<
NPart;p++){
281 for(
int d=0;d<3;d++) Pc[p].Pos[d] = Pos[d];
287 int pl = Cella[c].Last;
288 SigErr(pl == p,
"The particle %d is already the last in the cell %d\n",p,c);
296 if(Cella[c].
NPart == 1){
301 if(pl >= 0) Pc[pl].Next = p;
315 SigErr(Cella[c].
NPart <= 0,
"Cannot remove, the cell is already empty\n");
316 SigErr(c < 0,
"The cell %d does not exist\n",c);
319 if(Cella[c].
NPart == 0){
326 if(pp == -2) Cella[c].First = pn;
327 else Pc[pp].Next = pn;
328 if(pn == -1) Cella[c].Last = pp;
329 else Pc[pn].Prev = pp;
338 SigErr(c < 0,
"The cell %d or the particle %d does not exist\n",c,p);
345 int c1 = Pc[p1].Cell;
346 int c2 = Pc[p2].Cell;
347 for(
int d=0;d<3;d++){
348 Pc[p1].
Pos[d] = Pos2[d];
349 Pc[p2].Pos[d] = Pos1[d];
352 if(Cella[c2].First == p2)
353 Cella[c2].First = p1;
354 if(Cella[c2].Last == p2)
356 if(Cella[c1].First == p1)
357 Cella[c1].First = p2;
358 if(Cella[c1].Last == p1)
362 if(Cella[c1].First == p2)
363 Cella[c1].First = p1;
364 else if(Cella[c1].First == p1)
365 Cella[c1].First = p2;
366 if(Cella[c1].Last == p2)
368 else if(Cella[c1].Last == p1)
371 int p1p = Pc[p1].Prev;
372 int p2p = Pc[p2].Prev;
373 int p1n = Pc[p1].Next;
374 int p2n = Pc[p2].Next;
375 if(p1p >= 0) Pc[p1p].Next = p2;
376 if(p1n >= 0) Pc[p1n].Prev = p2;
377 if(p2p >= 0) Pc[p2p].Next = p1;
378 if(p2n >= 0) Pc[p2n].Prev = p1;
379 Pn.
Prev = Pc[p1].Prev;
380 Pn.
Next = Pc[p1].Next;
381 Pn.
Coord = Pc[p1].Coord;
382 Pn.
Cell = Pc[p1].Cell;
383 Pc[p1].Prev = Pc[p2].Prev;
384 Pc[p1].Next = Pc[p2].Next;
385 Pc[p1].Coord = Pc[p2].Coord;
386 Pc[p1].Cell = Pc[p2].Cell;
387 Pc[p2].Prev = Pn.
Prev;
388 Pc[p2].Next = Pn.
Next;
389 Pc[p2].Coord = Pn.
Coord;
390 Pc[p2].Cell = Pn.
Cell;
396 SetCoorNumb(NewPos,p);
397 for(
int d=0;d<3;d++)Pc[p].Pos[d] = NewPos[d];
406 SetCoorNumb(NewPos,p);
407 for(
int d=0;d<3;d++)Pc[p].Pos[d] = NewPos[d];
408 if(cn == co) return ;
414 for(
int c=0;c<
NCell;c++){
415 Cella[c].Curr1 = Cella[c].First;
416 Cella[c].Curr2 = Cella[c].First;
417 if(Cella[c].
NPart > 1)
418 Cella[c].Curr2 = Pc[Cella[c].Curr1].Next;
422 SigErr(c >=
NCell,
"The cell %d does not exist\n",c);
423 SigErr(Cella[c].Curr1 >=
NAllocP,
"Poiting to a particle %d over the number of allocated particles\n",Cella[c].Curr1,
NAllocP);
424 return Cella[c].Curr1;
428 if(Cella[c].Curr1 < 0 || Cella[c].
NPart == 0){
429 Cella[c].Curr1 = Cella[c].First;
436 Cella[c].Curr1 = Pc[Cella[c].Curr1].Next;
440 for(SetCounters(c);IfItCell(c);IncrCurr(c)){
442 printf(
"%d) # %d %d_%d_%d %x\n",c,Cella[c].
NPart,Pc[p].Prev,ItCell(c),Pc[p].Next,Pc[p].Coord);
447 for(
int c=0;c<
NCell;c++)
455 SigErr(
cCurr < 0,
"The cell %d or the particle %d does not exists\n",
cCurr,p);
503 for(
int d=0;d<3;d++){
508 DistRel[d] -= floor(DistRel[d]*
InvEdge[d] + .5)*
Edge[d];
510 DistRel[3] = SQR(DistRel[0]) + SQR(DistRel[1]) + SQR(DistRel[2]);
519 for(
int d=0;d<3;d++)
PosCurr[d] = Pos[d];
555 for(
int d=0;d<3;d++){
560 DistRel[d] -= floor(DistRel[d]*
InvEdge[d] + .5)*
Edge[d];
562 DistRel[3] = SQR(DistRel[0]) + SQR(DistRel[1]) + SQR(DistRel[2]);
566 SigErr(Cella[c].Curr1 >=
NAllocP,
"Poiting to a particle %d over the number of allocated particles\n",Cella[c].Curr1,
NAllocP);
567 SigErr(Cella[c].Curr2 >=
NAllocP,
"Poiting to a particle %d over the number of allocated particles\n",Cella[c].Curr2,
NAllocP);
568 *p1 = Cella[c].Curr1;
569 *p2 = Cella[c].Curr2;
573 if(Cella[c].
NPart < 2)
return 0;
574 if(Cella[c].Curr1 == -1){
575 Cella[c].Curr1 = Cella[c].First;
576 Cella[c].Curr2 = Pc[Cella[c].First].Next;
583 int p2 = Cella[c].Curr2;
584 Cella[c].Curr2 = Pc[p2].Next;
585 if(Pc[p2].Next == -1){
586 int p1 = Cella[c].Curr1;
587 Cella[c].Curr1 = Pc[p1].Next;
588 Cella[c].Curr2 = Pc[Pc[p1].Next].Next;
589 if(Cella[c].Curr2 == -1){
593 SigErr(Cella[c].Curr2 >=
NAllocP,
"Poiting to a particle %d over the number of allocated particles\n",Cella[c].Curr2,
NAllocP);
598 double DistCurr = 1000000.;
599 for(SetCurr(p1);IfCurr();NextCurr()){
602 if(DistRel[3] < DistCurr){
603 DistCurr = DistRel[3];
622 DomPart::DomPart(
int ExtNPart){
624 Next =
new int[
NPart];
625 Prev =
new int[
NPart];
635 for(
int d=0;d<3;d++){
636 Edge[d] = EdgeExt[d];
638 NSect[d] = (int)(
Edge[d]/(
double)(CutOffExt));
647 if(Cella == NULL) {printf(
"DomCell not allocated\n");}
650 for(
int c=0;c<
NCell;c++){
651 Cella[c].Part.clear();
656 Cella[c].Part.push_back(p);
661 Cella[c].Part.remove(p);
668 Cella[c1].Part.remove(p);
669 Cella[c2].Part.push_back(p);
675 Cella[c1].Part.remove(p1);
676 Cella[c1].Part.push_back(p2);
677 Cella[c2].Part.remove(p2);
678 Cella[c2].Part.push_back(p2);
682 NCurr = Cella[c].Part.begin();
683 NCurr2 = Cella[c].Part.begin();
684 if(Cella[c].Part.size() > 1)
688 if(NCurr == Cella[c].Part.end())
return 0;
702 if(NCurr == Cella[c].Part.end())
708 if(NCurr2 == Cella[c].Part.end()){
715 for(SetCounters(c);IfItCell(c);IncrCurr(c)){
717 printf(
"%d) # %d %d\n",c,Cella[c].Part.size(),ItCell(c));
721 for(
int c=0;c<
NCell;c++)
729 for(
int d=0;d<3;d++){
730 Edge[d] = EdgeExt[d];
732 NSect[d] = (int)(
Edge[d]/(
double)(CutOffExt));
742 for(
int c=0;c<
NCell;c++){
743 Cella[c].
Part =
new int[NPCell];
745 if(Cella == NULL) {printf(
"DomCell not allocated\n");}
748 for(
int c=0;c<
NCell;c++){
749 for(
int p=0;p<Cella[c].NPart;p++){
750 Cella[c].Part[p] = -1;
761 if(Cella[c].
NPart > NPCell){
762 printf(
"Maximum allocated size in the domain decomposition (%d) reached, terminating\n",NPCell);
763 assert(Cella[c].
NPart < NPCell);
765 Cella[c].Part[Cella[c].NPart++] = p;
775 int FoundPartInCell = 0;
777 for(
int p=0;p<Cella[c].NPart;p++){
778 if(p1==Cella[c].Part[p]){
779 for(
int pp=p;pp<Cella[c].NPart-1;pp++){
780 Temp = Cella[c].Part[pp];
781 Cella[c].Part[pp] = Cella[c].Part[pp+1];
782 Cella[c].Part[pp+1] = Temp;
791 assert(FoundPartInCell);
813 if(Cella[c].
NPart > 0) NCurr2++;
816 if(NCurr == Cella[c].
NPart)
return 0;
823 return Cella[c].Part[NCurr];
827 *p1 = Cella[c].Part[NCurr];
828 *p2 = Cella[c].Part[NCurr2];
831 if(NCurr >= Cella[c].
NPart)
837 if(NCurr2 >= Cella[c].
NPart){
844 for(SetCounters(c);IfItCell(c);IncrCurr(c)){
846 printf(
"%d) # %d %d\n",c,Cella[c].
NPart,ItCell(c));
850 for(
int c=0;c<
NCell;c++)
856 for(
int d=0;d<3;d++){
857 Edge[d] = EdgeExt[d];
868 SigErr(Cella==NULL,
"DomCell not allocated\n");
869 for(
int c=0;c<
NCell;c++){
871 Cella[c].First = Cella[c].Last = -2;
875 SigErr(Pc == NULL,
"DOMAIN_PART not allocated\n");
879 for(
int c=0;c<
NCell;c++){
883 for(
int p=0;p<
NPart;p++){
897 for(
int d=0;d<3;d++) Pc[p].Pos[d] = Pos[d];
916 if(Cella[c].
NPart == 0){
923 if(pp == -2) Cella[c].First = pn;
924 else Pc[pp].Next = pn;
925 if(pn == -1) Cella[c].Last = pp;
926 else Pc[pn].Prev = pp;
936 printf(
"Swap part disabled\n");
940 printf(
"Move part disabled\n");
944 printf(
"Move part disabled\n");
970 for(SetCounters(c);IfItCell(c);IncrCurr(c)){
972 printf(
"%d) # %d %d_%d_%d %x\n",c,Cella[c].
NPart,Pc[p].Prev,ItCell(c),Pc[p].Next,Pc[p].Coord);
977 for(
int c=0;c<
NCell;c++)
995 for(
int d=0;d<3;d++){
999 DistRel[d] -= floor(DistRel[d]*
InvEdge[d] + .5)*
Edge[d];
1001 DistRel[3] = SQR(DistRel[0]) + SQR(DistRel[1]) + SQR(DistRel[2]);
1011 NGrid = 2*NGridExt-1;
1012 for(
int d=0;d<3;d++){
1013 Edge[d] = EdgeExt[d];
1015 Vertex =
new VERTEX[NVert];
1016 vMemPos =
new int[NVert];
1017 for(
int v=0;v<NVert;v++){
1018 Vertex[v].
NTria = 0;
1027 for(
int d=0;d<3;d++){
1028 s[d] = (int)(Pos[d]/
Edge[d]*NGrid);
1030 return (s[0]*NGrid+s[1])*NGrid+s[2];
1033 int v = GetVertex(Pos);
1037 Vertex[NVert].v = v;
1038 for(
int d=0;d<3;d++)
1039 Vertex[NVert].Pos[d] = Pos[d];
1040 Vertex[NVert].t[0] = t;
1047 for(
int d=0;d<3;d++) Vert1.
Pos[d] = Vert2.
Pos[d];
1048 for(
int t=0;t<Vert1.
NTria;t++) Vert1.
t[t] = Vert2.
t[t];
1051 VERTEX Vert = Vertex[v1];
1052 Vertex[v1] = Vertex[v2];
1054 CopyVert2To1(Vert,Vertex[v1]);
1055 CopyVert2To1(Vertex[v1],Vertex[v2]);
1056 CopyVert2To1(Vertex[v2],Vert);
1060 for(
int i=0;i<NVert;i++){
1061 for(
int j=i;j>0;j--){
1062 if(Vertex[j].v < Vertex[j-1].v){
1069 for(
int v=0;v<NVert;v++){
1071 Vertex[v].NTria = 1;
1072 for(
int vv=v+1;Vertex[vv].v == Vertex[vv-1].v;vv++){
1073 if(vv > NVert)
break;
1075 Vertex[v].t[t] = Vertex[vv].t[0];
1076 Vertex[v].NTria = t+1;
1078 SigErr(NDel>MAX_JOINT_VERTEX,
"Neighbour Vertices: the vertex has more conjunction points than expected\n");
1080 for(
int d=1;d<NDel+1;d++){
1081 for(
int vv=v+1;vv<NVert-1;vv++){
1094 for(
int vv=vCurr;vv<NVert;vv++){
1095 if(Vertex[vv].v == v){
1103 if(tCurr == Vertex[vCurr].NTria)
return 0;
1113 return Vertex[vCurr].t[tCurr];
1117 for(
int v=0;v<NVert;v++){
1118 printf(
"---- (%d) ----\n",Vertex[v].v);
1119 for(SetCounters(v);IfItCell(v);IncrCurr(v)){
1120 printf(
"%d - ",VertCurr(v));
int Coord
Coordination number.
void AddPart(const int p, double *Pos)
Add a particle to the cell c.
int IfItCouple(const int c)
Tell when the loop is over.
DdLinkedList(double Edge[3], int NPart, double CutOff)
Allocate.
void SigErr(int Condition, const char *s,...)
Handle errors.
void PrintCells()
Print the the particles in the cells.
void MovePart(int p, double *OldPos, double *NewPos)
Move a part.
void Couple(const int c, int *p1, int *p2)
Returns the pointed couple of particle.
int NCell
Number of cells.
int VertCurr(int v)
Current vertex iterator for the vertex v.
void RemPart(int p, double *Pos)
Remove a part from the cell.
int GetCellCoord(int c, int Coord, int *NeiList)
Get the number of the neighbouring cells for the particles close to a wall.
int SetCutOff(double CutOffExt)
Set the CutOff.
DdFixedSize(double EdgeExt[3], int NPart, double CutOff)
Allocate.
void Erase()
Erase the content of the cells.
void SetCounters(int c)
Set the counters to the initial position.
int cCurr
Cell where the current particle sits.
int IfItCell(int c)
End the iteration in the cell.
void Erase()
Erase the pairlist.
The array of particles in every cell.
double BoundCond[27][3]
Boundary condition for the cell consider.
void IncrCurrList(const int c)
Increment the pointers.
void PrintCell(const int c)
Print the content of one cell.
int NSect[3]
Number of cells per direction.
int IfItCouple(const int c)
Stop the loop and set the counter to zero.
DomPart & operator++()
Increase the iterator, deactivated.
int GetCellCh(int c, int *NeiList)
Get the number of the neighbouring cells.
void PrintCell(const int c)
Print the particles in a cell.
void Dist2CurrGhost(double *DistRel)
Retrun the squared current interparticle distance.
~NeiVertex()
Delete the class.
void AddPart(int p, double *Pos)
Add a part to the cell.
void SetCounters(int c)
Set the counters to the initial pointer.
NeiVertex(int NTriaExt, int NvPtExt, int NGridExt, double *EdgeExt)
Alloc NVertices.
int IfItCell(int v)
End of the counters.
void RemPart(const int p, double *Pos)
Remove a particle form the cell c.
int NPart
Total number of particle.
void SwapPart(int p1, double *Pos1, int p2, double *Pos2)
Swap two parts.
int ItCell(int c)
Value of the current particle in the cell c.
DomCell & operator=(const DomCell &Dc)
Return the cell class.
void Print()
Print the entire structure.
void PrintCells()
Print the content of every cell.
void SetCounters()
Set all the counters to zero.
int SetCoorNumb(double *Pos, int p)
Set the coordination umber to the part p.
void PrintCell(const int c)
Print the content of one cell.
void IncrCurr(int c)
Increase the counters.
void IncrCurrList(const int c)
Increment the pointers.
double Pos[3]
xyz Position of the particle
int IfItCell(int c)
End the iteration in the cell.
The previuos and consecutive particle in the cell linked list.
int FindClosest(int p1)
Find the closest neighbour.
int IfItCell(const int c)
Stop the loop and set the counter to zero.
int SetCoorNumb(double *Pos, int p)
Stop the loop and set the counter to zero.
void Dist2Curr(double *DistRel)
Retrun the squared current interparticle distance.
void AddPart(int p, double *Pos)
Add a part to the cell.
double Pos[3]
Vertex postion.
void Erase()
Erase the pairlist.
int p1Curr
Reference particle.
void PrintCell(const int c)
Print the content of a cell.
double CutOff
Cell CutOff.
int ItCell(const int c)
Iterate in the cell.
DdDoubleLoop(double Edge[3], int NPart, double CutOff)
Allocate.
void IncrCurr(int c)
Increase the counters.
void MovePart(const int p, double *OldPos, double *NewPos)
Move a particle form the cell c1 to the cell c2.
void Add(int v, int t, double *Pos)
Add the triangle t at the vertex v.
int IfCurrGhost()
Tell when the curr loop is over.
void NextCurrGhost()
Increase the iterator to the next couple.
void Couple(const int c, int *p1, int *p2)
Returns the pointed couple of particle.
DomCell & operator++()
Increase the iterator, deactivated.
void IncrCurr(const int c)
Increment the current part in the cell.
int pNPart()
part in the class
void IncrCurrList(const int c)
Increment the current iterators in the cell.
void SetCurr(int p)
Gather information of the neighbouring cells.
int IfLoopCurr
1 if the loop is over
void IncrCurr(int v)
Increment the counter.
int * Part
Id of the particle.
void IncrCurr(const int c)
Increment the current part in the cell.
void CopyVert2To1(VERTEX Vert1, VERTEX Vert2)
Copy two vertices.
int pCella(const double Pos[3])
(x,y,z)->n
int Mod10[3]
Module 10 (nx,ny,nz) -> nc.
void PrintCell(const int c)
Print the particles in a cell.
void Reorder()
Reorder and fill the vertices.
int Next
Next particle in the list.
int IfItCell(const int c)
Stop the loop and set the counter to zero.
void NextCurr()
Increase the iterator to the next couple.
void RemPart(const int p, double *Pos)
Remove a particle form the cell c.
int NeiListCurr[27]
Neighbouring list.
void PrintCells()
Print the the particles in the cells.
int NNeiCurr
Number of neighbouring cells.
The array of particles in every cell.
int NTria
Number of triangles connected to the vertex.
int Cell
Which cell it's belonging.
void RemPart(int p, double *Pos)
Remove a part from the cell.
int operator[](int col)
Returns a entry.
void Swap(int v1, int v2)
Swap to vertices.
int nNeiCurr
Current number of neighbours.
void AddPart(const int p, double *Pos)
Add a particle to the cell c.
int IfCurr()
Tell when the curr loop is over.
int TriaCurr(int v)
Current triangle for the vertex v.
void SetCurrGhost(double *Pos)
Gather information of the neighbouring cells.
int ItCell(const int c)
Iterate in the cell.
void SetCounters(int c)
Set the counters to the initial position.
int t[MAX_JOINT_VERTEX]
Triangles/lines connected (fixed size!!! should be enough)
int SwapPart(int p1, double *Pos1, int p2, double *Pos2)
Swap two particles.
void SetCounters(int c)
Set the counters to the initial pointer.
int GetCoorNumb(double *Pos)
Get the coordination number.
int NAllocP
Number of allocated part.
void SwapPart(int p1, double *Pos1, int p2, double *Pos2)
Swap two parts.
void MovePart(int p, double *OldPos, double *NewPos)
Move a part.
DdArray(double EdgeExt[3], int NPart, double CutOff)
Allocate.
For every cube how many particles and which are the first and the last.
void Dist2Curr(double *DistRel)
Retrun the squared current interparticle distance.
int SwapPart(int p1, double *Pos1, int p2, double *Pos2)
Swap two particles.
int IfCurr()
Tell when the curr loop is over.
double InvEdge[3]
Inverse box size.
int p2Curr
Current particle.
void Erase()
Erase the content of the cells.
int pNCell()
Print the number of cells.
void MovePart(const int p, double *OldPos, double *NewPos)
Move a particle form the cell c1 to the cell c2.
int IfItCouple(const int c)
Tell when the loop is over.
void SetCurr(int p)
Gather information of the neighbouring cells.
int Prev
Previous particle in the list.
void NextCurr()
Increase the iterator to the next couple.
double PosCurr[3]
Position of the current particle.
The previuos and consecutive particle in the cell linked list.
int GetVertex(double *Pos)
Correspondent vertes for Pos.
int ItCell(int c)
Value of the current particle in the cell c.
void PrintCells()
Print the content of every cell.
void Couple(const int c, int *p1, int *p2)
Iterates along all couples.
int GetCell(double *Pos, int *NeiList)
Get the number of the neighbouring cells for a ghost particle.