22 #include "../include/VarData.h" 26 double VolumeInv = (double) (Values)/(Gen->
Edge[0]*Gen->
Edge[1]*Gen->
Edge[2]);
28 double NPartInv = 1./(double)(NPartition*NPartition);
29 double *Density = (
double *)calloc(NPartition*NPartition*NType*Values,
sizeof(
double));
33 for(
int b=0;b<Gen->
NBlock;b++){
34 if(!strncmp(
Block[b].Name,
"PEP",3) )
continue;
35 if(!strcmp(
Block[b].Name,
"WATER") )
continue;
39 Pos[d] =
Pm[p].Pos[d];
41 if(vx < 0 || vx >= Values)
continue;
43 if(vy < 0 || vy >= Values)
continue;
45 if(vz < 0 || vz >= Values)
continue;
46 if(CHAIN_IF_TYPE(
Ch[
Pm[p].CId].Type,CHAIN_ADDED))
48 Density[((vz*NType+t)*NPartition+vy)*NPartition+vx] += 1.;
51 for(
int vx=0;vx<NPartition;vx++){
52 for(
int vy=0;vy<NPartition;vy++){
55 for(
int v=0;v<Values;v++){
56 Weight += Density[((v*NType+0)*NPartition+vy)*NPartition+vx];
57 Media += v*Density[((v*NType+0)*NPartition+vy)*NPartition+vx];
59 int vMedia = Weight > 0 ? (int)(Media/Weight) : Values/2;
60 int vOffset = vMedia - Values/2;
61 for(
int t=0;t<NType;t++){
62 for(
int v=0;v<Values;v++){
63 int vOther = v + vOffset;
65 vOther = Values - vOther;
67 vOther = vOther - Values;
68 DensityAv[v*NType+t] += Density[((vOther*NType+t)*NPartition+vy)*NPartition+vx]*VolumeInv;
77 double **Norma = (
double **)calloc(NLevel,
sizeof(
double));
78 for(
int l=0;l<NLevel;l++)
79 Norma[l] = (
double *)calloc(Values*Values,
sizeof(
double));
80 for(
int b=0;b<Gen->
NBlock;b++){
82 for(
int v=0;v<Values;v++){
86 if( v < 0 || v >= Values)
continue;
88 if( vv < 0 || vv >= Values)
continue;
90 Norma[b][v*Values + vv] += 1.;
95 for(
int v=0;v<Values;v++)
96 for(
int vv=0;vv<Values;vv++)
97 for(
int l=0;l<NLevel;l++){
98 if(Norma[l][v*Values+vv] > Threshold)
99 Plot[l][v*Values+vv] /= Norma[l][v*Values+vv];
101 Plot[l][v*Values+vv] = 0.;
103 for(
int l=0;l<NLevel;l++)
CHAIN * Ch
Information on all chains.
BLOCK * Block
Information for every block.
double Edge[4]
xyzr edges of the simulation box
int BfDefChain()
Definition of the chain.
int CLat2
lateral coordinate
double Pos[3]
xyz Position of the particle
int DensityProfile(int coord, int NSample, int NType, double *dDensity)
Calculate the density profile for the x, y, z, r coordinate.
void Stalk(int NSample, int NLevel, double **Plot, double Threshold)
Following the contour of a stalk.
int EndIdx
End particle position.
int CLat1
lateral coordinate
PART * Pm
Particle information of all particle.
int NBlock
Number of blocks.
int CNorm
Normal coordinate.