39 const uint blocksCount = vblocks_ini[0]*vblocks_ini[1]*vblocks_ini[2];
46 std::set<vmesh::GlobalID> singleSet;
48 unsigned int counterX, counterY, counterZ;
53 if (
WID > 4 && blocksCount > 8) {
59 creal tolerance = 0.1;
79 const vector<std::array<Real, 3>> V0 = this->
getV0(x+0.5*
dx, y+0.5*dy, z+0.5*dz, popID);
80 const bool singlePeak = ( V0.size() == 1 );
82 for (vector<std::array<Real, 3>>::const_iterator it = V0.begin(); it != V0.end(); it++) {
87 if ( (tolerance * minValue >
88 probePhaseSpace(cell, popID, it->at(0) + counterX*dvxBlock, it->at(1), it->at(2))
89 || counterX > vxblocks_ini ) ) {
95 Real vRadiusSquared = (
Real)counterX*(
Real)counterX*dvxBlock*dvxBlock;
101 if ( (tolerance * minValue >
102 probePhaseSpace(cell, popID, it->at(0), it->at(1) + counterY*dvyBlock, it->at(2))
103 || counterY > vyblocks_ini ) ) {
109 vRadiusSquared =
max(vRadiusSquared, (
Real)counterY*(
Real)counterY*dvyBlock*dvyBlock);
115 if ( (tolerance * minValue >
116 probePhaseSpace(cell, popID, it->at(0), it->at(1), it->at(2) + counterZ*dvzBlock)
117 || counterZ > vzblocks_ini ) ) {
123 vRadiusSquared =
max(vRadiusSquared, (
Real)counterZ*(
Real)counterZ*dvzBlock*dvzBlock);
127 vmesh::LocalID currentMaxSize = LID + 5*counterX*counterY*counterZ;
128 vmesh->setNewSize(currentMaxSize);
129 GIDbuffer =
vmesh->getGrid()->data();
134 for (uint kv=0; kv<vzblocks_ini; ++kv) {
135 for (uint jv=0; jv<vyblocks_ini; ++jv) {
136 for (uint iv=0; iv<vxblocks_ini; ++iv) {
138 vmesh->getBlockCoordinates(GID,V_crds);
141 V_crds[0] += (2*dvxBlock - it->at(0) );
142 V_crds[1] += (2*dvyBlock - it->at(1) );
143 V_crds[2] += (2*dvzBlock - it->at(2) );
144 Real R2 = ((V_crds[0])*(V_crds[0])
145 + (V_crds[1])*(V_crds[1])
146 + (V_crds[2])*(V_crds[2]));
149 if (LID >= currentMaxSize) {
150 currentMaxSize = LID + counterX*counterY*counterZ;
151 vmesh->setNewSize(currentMaxSize);
152 GIDbuffer =
vmesh->getGrid()->data();
157 if (R2 < vRadiusSquared) {
158 GIDbuffer[LID] = GID;
163 if (R2 < vRadiusSquared && singleSet.count(GID)==0) {
164 singleSet.insert(GID);
165 GIDbuffer[LID] = GID;
186 vmesh->setNewSize(LID);
virtual std::vector< std::array< Real, 3 > > getV0(creal x, creal y, creal z, const uint popID) const =0
Return a vector containing the velocity coordinate of the centre of each ion population in the distri...