22 #include "../include/VarData.h" 26 int *nChain = (
int *)calloc(Vertex,
sizeof(
int));
27 double *dChain= (
double *)calloc(Vertex,
sizeof(
double));
28 double MaxLength = 1.5*sqrt(QUAD(Gen->
Edge[0])+QUAD(Gen->
Edge[1]));
29 for(
int c=0;c<Gen->
NChain;c++){
30 for(
int v=0;v<Vertex;v++)
31 dChain[v] = MaxLength;
33 if(!CHAIN_IF_TYPE(
Ch[c].Type,
NChType))
continue;
34 for(
int cc=0;cc<Gen->
NChain;cc++){
35 if(!CHAIN_IF_TYPE(
Ch[cc].Type,
NChType))
continue;
37 double Shift[3] = {0.,0.,0.};
38 double PosDiff[3] = {0.,0.,0.};
41 Shift[d] = -floor((PosDiff[d])/Gen->
Edge[d]+.5)*Gen->
Edge[d];
46 for(
int v=0;v<Vertex;v++){
49 for(
int vv=Vertex-1;vv>v;vv--){
50 dChain[vv] = dChain[vv-1];
51 nChain[vv] = nChain[vv-1];
61 for(
int v=0;v<Vertex;v++)
62 Triangle[v][c] = nChain[v];
63 Triangle[Vertex][c] = NVertex<Vertex ? NVertex : Vertex;
89 double BlurDist[3]={Gen->
Edge[0]/(double)SubDiv[0],Gen->
Edge[1]/(
double)SubDiv[1],Gen->
Edge[2]/(double)SubDiv[2]};
92 double InvSubDiv = 1./(double)SubDiv[d];
93 v[d] = (int)(Pos[d]/Gen->
Edge[d]*SubDiv[d]);
94 if(v[d] > SubDiv[d]){printf(
"Chain out of range %d>%d\n",v[d],SubDiv[d]);
continue;}
95 if(Pos[d] - v[d]*Gen->
Edge[d]*InvSubDiv < .25*BlurDist[d])
97 else if(Pos[d] - v[d]*Gen->
Edge[d]*InvSubDiv > .75*BlurDist[d])
103 int nPos = (v[0]*SubDiv[1] + v[1])*SubDiv[2]+v[2];
110 return (vx*NEdge + vy)*NEdge+vz;
CHAIN * Ch
Information on all chains.
int Arrange(int **Triangle, int Vertex)
The naerest.
int CalcnPos(double *Pos)
return a univocal index of the chain position
double Edge[4]
xyzr edges of the simulation box
int BfDefChain()
Definition of the chain.
int NChType
Type of chain selected.
int CLat2
lateral coordinate
int NChain
Number of chain.
int NEdge
Number of particles per edge.
double Pos[4]
xyzr Postion of the chain
int OrderPos()
A cell list to be fixed.
int PosVectInt(double *Pos)
Return the integer index with respect to the partition NSquare.
int CLat1
lateral coordinate
int CNorm
Normal coordinate.