353{
354
355 int latticeR[4] = { 0,0,0,0 };
356 latticeR[0] = p->getCuboid();
357 _sg.
getCuboidGeometry().get(latticeR[0]).getLatticeR(&(latticeR[1]),&p->getPos()[0]);
358
359 int mat = _sg.
get(latticeR);
360 for (_matIter = _materials.begin(); _matIter != _materials.end(); _matIter++) {
361 if (mat == *_matIter) {
362
363 Vector<T,3> normal { computeDiscreteNormal(latticeR) };
364 Vector<T,3> P1 { p->getPos() };
365 Vector<T,3> R { _sg.
getPhysR({latticeR[0], latticeR[1], latticeR[2], latticeR[3]}) };
366
367 std::vector<T> P1New { p->getPos() };
368 std::vector<T> vNew { p->getVel() };
369
370 for (int iD=0; iD<3; iD++) {
371 if (normal[iD]*(R[iD] - P1[iD]) > 0) {
372 P1New[iD] = 2.*R[iD] - P1[iD];
373 vNew[iD] = -vNew[iD];
374 }
375 }
376 p->setPos(P1New);
377 p->setVel(vNew);
378
379 return;
380 }
381 }
382}
int get(int iCglob, LatticeR< D > latticeR) const
Read only access to the material numbers, error handling: returns 0 if data is not available.
std::vector< T > getPhysR(int iCglob, LatticeR< D > latticeR) const
Transforms a lattice to physical position (SI unites)
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.