ESyS-Particle  2.3.4
SubLattice.hpp
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
12 
13 // -- project includes -
14 
15 #include "Parallel/SubLattice.h"
16 #include "Parallel/MpiInfo.h"
17 #include "Parallel/mpivbuf.h"
18 #include "Parallel/mpisgvbuf.h"
19 #include "Parallel/mpibarrier.h"
20 #include "Parallel/mpia2abuf.h"
24 #include "Model/DampingIGP.h"
25 #include "Model/Damping.h"
26 #include "Model/RotDamping.h"
27 #include "Model/ABCDampingIGP.h"
28 #include "Model/ABCDamping.h"
29 #include "Model/LocalDampingIGP.h"
30 #include "Model/LocalDamping.h"
31 #include "Model/RotLocalDamping.h"
33 #include "Model/FractalFriction.h"
34 #include "Model/AdhesiveFriction.h"
47 #include "Model/MeshData.h"
48 #include "Model/MeshData2D.h"
55 
56 // --- parallel storage includes ---
57 #include "ppa/src/pp_array.h"
58 #include "pis/pi_storage_eb.h"
59 #include "pis/pi_storage_ed.h"
60 #include "pis/pi_storage_ed_t.h"
61 #include "pis/pi_storage_ne.h"
62 #include "pis/pi_storage_ne_t.h"
63 #include "pis/pi_storage_single.h"
64 #include "pis/trimesh_pis.h"
65 #include "pis/trimesh_pis_ne.h"
66 #include "pis/trimesh_pis_eb.h"
67 #include "pis/mesh2d_pis_eb.h"
68 #include "pis/mesh2d_pis_ne.h"
69 
70 // --- field includes ---
81 
82 #include "Model/BodyForceGroup.h"
83 
84 #include <mpi.h>
85 #include <stdlib.h>
86 #include <stdexcept>
87 
88 // -- STL includes --
89 #include <algorithm>
90 #include <stdexcept>
91 #include <boost/limits.hpp>
92 using std::runtime_error;
93 
94 // -- IO includes --
95 #include <iostream>
96 using std::cerr;
97 using std::flush;
98 using std::endl;
100 
101 //----------------------------------------------
102 // TSubLattice functions
103 //----------------------------------------------
104 
112 template <class T>
114  const CLatticeParam &param,
115  int rank,
116  MPI_Comm comm,
117  MPI_Comm worker_comm
118 )
119  : m_ppa(NULL),
120  m_dpis(),
121  m_bpis(),
122  m_singleParticleInteractions(),
123  m_damping(),
124  m_WIG(),
125  m_SIG(),
126  m_mesh(),
127  m_mesh2d(),
128  m_dt(0),
129  m_nrange(0),
130  m_alpha(0),
131  m_last_ns(0),
132  m_temp_conn(),
133  m_rank(0),
134  m_comm(MPI_COMM_NULL),
135  m_tml_comm(MPI_COMM_NULL),
136  m_worker_comm(MPI_COMM_NULL),
137  m_tml_worker_comm(MPI_COMM_NULL),
138  m_dims(3, 0),
139  packtime(0),
140  unpacktime(0),
141  commtime(0.0),
142  forcetime(0.0),
143  m_field_slaves(),
144  m_pTimers(NULL)
145 {
146  // cout << "TSubLattice<T>::TSubLattice at " << rank << endl << flush;
147  // -- MPI stuff --
148  m_rank=rank;
149 
150  // set global communicator
151  m_comm=comm;
153 
154  m_dims = param.processDims();
155 
156  m_worker_comm=worker_comm;
157  // MPI_Comm_size(m_worker_comm,&m_num_workers);
159 
160 
161  // -- set parameters
162  m_alpha=param.alpha();
163  m_nrange=param.nrange();
164  // cout << "dt,nrange,alpha : " << m_dt << " , " << m_nrange << " , " << m_alpha << "\n";
165 
166  commtime=0.0;
167  packtime=0.0;
168  unpacktime=0.0;
169  forcetime=0.0;
170 
171  m_last_ns=-1;
172 }
173 
174 template <class T>
176 {
177  console.Debug() << "TSubLattice<T>::~TSubLattice(): enter\n";
178  console.Debug()
179  << "TSubLattice<T>::~TSubLattice():"
180  << " deleting wall interaction groups...\n";
181  for(
182  typename map<string,AWallInteractionGroup<T>*>::iterator vit=m_WIG.begin();
183  vit!=m_WIG.end();
184  vit++
185  )
186  {
187  delete vit->second;
188  }
189  for(
190  typename map<string,ASphereBodyInteractionGroup<T>*>::iterator vit=m_SIG.begin();
191  vit!=m_SIG.end();
192  vit++
193  )
194  {
195  delete vit->second;
196  }
197  console.Debug()
198  << "TSubLattice<T>::~TSubLattice():"
199  << " deleting particle array...\n";
200  if (m_ppa != NULL) delete m_ppa;
201  console.Debug() << "TSubLattice<T>::~TSubLattice(): exit\n";
202 }
203 
210 template <class T>
211 void TSubLattice<T>::initNeighborTable(const Vec3& min,const Vec3& max)
212 {
213  console.XDebug() << "TSubLattice<T>::initNeighborTable(" << min << "," << max << ")\n";
214  // make size fit range
215  double xsize=max.X()-min.X();
216  xsize=m_nrange*ceil(xsize/m_nrange);
217  double ysize=max.Y()-min.Y();
218  ysize=m_nrange*ceil(ysize/m_nrange);
219  double zsize=max.Z()-min.Z();
220  zsize=m_nrange*ceil(zsize/m_nrange);
221  Vec3 grow=Vec3(xsize,ysize,zsize)-(max-min); // size increase
222  Vec3 nmin=min-0.5*grow; // distribute symmetrically
223  Vec3 nmax=max+0.5*grow;
224  console.XDebug() << "range=" << m_nrange << ", new min,max: " << nmin << ", " << nmax << "\n";
225 
226  // construct particle array
227  TML_Comm *ntcomm=new TML_Comm(m_worker_comm);
228  m_ppa=new ParallelParticleArray<T>(ntcomm,m_dims,nmin,nmax,m_nrange,m_alpha);
229  //m_ppa=new ParallelParticleArray<T>(ntcomm,3,nmin,nmax,m_nrange);
230 
231  // makeFields(); // put here to make sure ppa is initialized before makeFields
232 
233  console.XDebug() << "end TSubLattice<T>::initNeighborTable\n";
234 }
235 
236 template <class T>
238 {
239  T::setDo2dCalculations(do2d);
240 }
241 
242 template <class T>
244 {
245  return m_ppa->getInnerSize();
246 }
247 
255 template <class T>
256 void TSubLattice<T>::initNeighborTable(const Vec3& min,const Vec3& max,const vector<bool>& circ)
257 {
258  console.XDebug() << "TSubLattice<T>::initNeighborTable(" << min << "," << max << ") circ\n";
259  double xsize,ysize,zsize;
260  // if dimension is circular, check if size fits range, otherwise make it fit
261  // x - dim
262  if(circ[0])
263  {
264  xsize=max.X()-min.X();
265  if(fabs(xsize/m_nrange-lrint(xsize/m_nrange))>1e-6)
266  {
267  //console.Critical() << "circular x-dimension doesn't fit range !\n";
268  console.Info() << "Circular x-size incompatible with range, adjusting...\n";
269  m_nrange = xsize/floor(xsize/m_nrange);
270  console.Info() << "New range = " << m_nrange << "\n";
271  }
272  //xsize+=2.0*m_nrange; // padding on the circular ends
273  }
274  else
275  {
276  xsize=max.X()-min.X();
277  xsize=m_nrange*ceil(xsize/m_nrange);
278  }
279  // y - dim
280  if(circ[1])
281  {
282  ysize=max.Y()-min.Y();
283  if(fabs(ysize/m_nrange-lrint(ysize/m_nrange))>1e-6)
284  {
285  console.Critical() << "circular y-dimension doesn't fit range !\n";
286  }
287  ysize+=2.0*m_nrange; // padding on the circular ends
288  }
289  else
290  {
291  ysize=max.Y()-min.Y();
292  ysize=m_nrange*ceil(ysize/m_nrange);
293  }
294  // z - dim
295  if(circ[2])
296  {
297  zsize=max.Z()-min.Z();
298  if(fabs(zsize/m_nrange-lrint(zsize/m_nrange))>1e-6)
299  {
300  console.Critical() << "circular z-dimension doesn't fit range !\n";
301  }
302  zsize+=2.0*m_nrange; // padding on the circular ends
303  }
304  else
305  {
306  zsize=max.Z()-min.Z();
307  zsize=m_nrange*ceil(zsize/m_nrange);
308  }
309  Vec3 grow=Vec3(xsize,ysize,zsize)-(max-min); // size increase
310  Vec3 nmin=min-0.5*grow; // distribute symmetrically
311  Vec3 nmax=max+0.5*grow;
312  console.XDebug() << "range, new min, max: " << m_nrange << " " << nmin << nmax << "\n";
313  // construct particle array
314  TML_Comm *ntcomm=new TML_Comm(m_worker_comm);
315  m_ppa=new ParallelParticleArray<T>(ntcomm,m_dims,circ,nmin,nmax,m_nrange,m_alpha);
316 
317  // makeFields(); // put here to make sure ppa is initialized before makeFields
318 
319  console.XDebug() << "end TSubLattice<T>::initNeighborTable (circ)\n";
320 }
321 
328 template <class T>
330 {
331  console.XDebug() << "TSubLattice<T>::receiveParticles: enter\n";
332 
333  vector<T> recv_buffer;
334  CMPIBarrier barrier(m_comm);
335 
336  m_tml_comm.recv_broadcast_cont_packed(recv_buffer,0);
337  console.XDebug() << "recvd " << recv_buffer.size() << " particles \n";
338  m_ppa->insert(recv_buffer);
339 
340  barrier.wait("TSubLattice<T>::receiveParticles");
341 
342  console.XDebug() << "TSubLattice<T>::receiveParticles: exit\n";
343 }
344 
345 
351 template <class T>
353 {
354  console.XDebug() << "TSubLattice<T>::receiveConnections: enter\n";
355 
356  vector<int> recv_buffer;
357  CMPIBarrier barrier(m_comm);
358 
359  m_tml_comm.recv_broadcast_cont_packed(recv_buffer,0);
360  console.XDebug() << "recvd " << recv_buffer.size() << " connections \n";
361  vector<int>::iterator it;
362  for (it = recv_buffer.begin(); it != recv_buffer.end(); it+=3)
363  {
364  if ( (m_ppa->getParticlePtrByIndex( *(it+1)) == NULL ) ||
365  (m_ppa->getParticlePtrByIndex( *(it+2)) == NULL ) )
366  {
367  continue;
368  }
369  m_temp_conn[*(it)].push_back(*(it+1));
370  m_temp_conn[*(it)].push_back(*(it+2));
371  }
372 
373  barrier.wait("TSubLattice<T>::receiveConnections");
374 
375  console.XDebug() << "TSubLattice<T>::receiveConnections: exit\n";
376 }
377 
378 
382 template <class T>
384 {
385  console.XDebug() << "TSubLattice<T>::addWall: enter\n" ;
386  CVarMPIBuffer param_buffer(m_comm);
387  param_buffer.receiveBroadcast(0);
388 
389  string name=param_buffer.pop_string();
390  Vec3 ipos=param_buffer.pop_vector();
391  Vec3 inorm=param_buffer.pop_vector();
392 
393  m_walls[name]=new CWall(ipos,inorm);
394 
395  console.XDebug() << "TSubLattice<T>::addWall: exit\n" ;
396 }
397 
401 template <class T>
403 {
404  console.XDebug() << "TSubLattice<T>::addSphereBody: enter\n" ;
405  CVarMPIBuffer param_buffer(m_comm);
406  param_buffer.receiveBroadcast(0);
407 
408  string name=param_buffer.pop_string();
409  Vec3 ipos=param_buffer.pop_vector();
410  double radius=param_buffer.pop_double();
411 
412  m_spheres[name]=new CSphereBody(ipos,radius);
413 
414  console.XDebug() << "TSubLattice<T>::addSphereBody: exit\n" ;
415 }
416 
420 template <class T>
422 {
423  console.XDebug() << "TSubLattice<T>::addElasticWIG: enter\n" ;
424  CVarMPIBuffer param_buffer(m_comm);
425 
426  // receive params from master
427  param_buffer.receiveBroadcast(0);
428 
429  CEWallIGP* wigp=extractEWallIGP(&param_buffer);
430 
431  string wallname=wigp->getWallName();
432  map<string,CWall*>::iterator iter=m_walls.find(wallname);
433  if(iter!=m_walls.end()){
434  AWallInteractionGroup<T>* newCEWIG =
436  &m_tml_worker_comm,
437  m_walls[wallname],
438  wigp
439  );
440  newCEWIG->Update(m_ppa);
441  m_WIG.insert(make_pair(wigp->getName(),newCEWIG));
442  } else {
443  std::stringstream msg;
444  msg << "wall name '" << wallname << "' not found in map of walls";
445  throw std::runtime_error(msg.str().c_str());
446  }
447 
448  delete wigp;
449  console.XDebug() << "TSubLattice<T>::addElasticWIG: exit\n" ;
450 }
451 
455 template <class T>
457 {
458  console.XDebug() << "TSubLattice<T>::addESphereBodyIG: enter\n" ;
459  CVarMPIBuffer param_buffer(m_comm);
460 
461  // receive params from master
462  param_buffer.receiveBroadcast(0);
463 
464  CESphereBodyIGP* wigp=extractESphereBodyIGP(&param_buffer);
465 
466  string wallname=wigp->getSphereBodyName();
467  map<string,CSphereBody*>::iterator iter=m_spheres.find(wallname);
468  if(iter!=m_spheres.end()){
471  &m_tml_worker_comm,
472  m_spheres[wallname],
473  wigp
474  );
475  newCEWIG->Update(m_ppa);
476  m_SIG.insert(make_pair(wigp->getName(),newCEWIG));
477  } else {
478  std::stringstream msg;
479  msg << "sphere body name '" << wallname << "' not found in map of sphere bodies";
480  throw std::runtime_error(msg.str().c_str());
481  }
482 
483  delete wigp;
484  console.XDebug() << "TSubLattice<T>::addESphereBodyIG: exit\n" ;
485 }
486 
490 template <class T>
492 {
493  console.XDebug() << "TSubLattice<T>::addTaggedElasticWIG: enter\n" ;
494  CVarMPIBuffer param_buffer(m_comm);
495 
496  // receive params from master
497  param_buffer.receiveBroadcast(0);
498 
499  CEWallIGP* wigp=extractEWallIGP(&param_buffer);
500  int tag=param_buffer.pop_int();
501  int mask=param_buffer.pop_int();
502 
503  string wallname=wigp->getWallName();
504 
505  console.XDebug() << wallname << " tag= " << tag << " mask= " << mask <<"\n" ;
506  map<string,CWall*>::iterator iter=m_walls.find(wallname);
507  if(iter!=m_walls.end()){
508  AWallInteractionGroup<T>* newCTEWIG =
510  &m_tml_worker_comm,
511  m_walls[wallname],
512  wigp,
513  tag,
514  mask
515  );
516  newCTEWIG->Update(m_ppa);
517  m_WIG.insert(make_pair(wigp->getName(),newCTEWIG));
518  } else {
519  std::stringstream msg;
520  msg << "wall name '" << wallname << "' not found in map of walls";
521  throw std::runtime_error(msg.str().c_str());
522  }
523 
524  delete wigp;
525  console.XDebug() << "TSubLattice<T>::addTaggedElasticWIG: exit\n" ;
526 }
527 
528 
532 template <class T>
534 {
535  console.XDebug() << "TSubLattice<T>::addBondedWIG: enter\n" ;
536  CVarMPIBuffer param_buffer(m_comm);
537 
538  // receive params from master
539  param_buffer.receiveBroadcast(0);
540 
541  CBWallIGP* wigp=extractBWallIGP(&param_buffer);
542 
543  string wallname=wigp->getWallName();
544  map<string,CWall*>::iterator iter=m_walls.find(wallname);
545  if(iter!=m_walls.end()){
546  AWallInteractionGroup<T>* newCBWIG=new CBWallInteractionGroup<T>(&m_tml_worker_comm,m_walls[wallname],wigp);
547  newCBWIG->Update(m_ppa);
548  m_WIG.insert(make_pair(wigp->getName(),newCBWIG));
549  } else {
550  console.Error() << "wall name " << wallname << " not found in map of walls\n";
551  }
552 
553  delete wigp;
554  console.XDebug() << "TSubLattice<T>::addBondedWIG: exit\n" ;
555 }
556 
560 template <class T>
562 {
563  console.XDebug() << "TSubLattice<T>::addDirBondedWIG: enter\n" ;
564  CVarMPIBuffer param_buffer(m_comm);
565 
566  // receive params from master
567  param_buffer.receiveBroadcast(0);
568 
569  CSoftBWallIGP* wigp=extractSoftBWallIGP(&param_buffer);
570 
571  string wallname=wigp->getWallName();
572  map<string,CWall*>::iterator iter=m_walls.find(wallname);
573  if(iter!=m_walls.end()){
574  AWallInteractionGroup<T>* newCDWIG=new CSoftBWallInteractionGroup<T>(&m_tml_worker_comm,m_walls[wallname],wigp);
575  newCDWIG->Update(m_ppa);
576  m_WIG.insert(make_pair(wigp->getName(),newCDWIG));
577  } else {
578  console.Error() << "wall name " << wallname << " not found in map of walls\n";
579  }
580 
581  delete wigp;
582  console.XDebug() << "TSubLattice<T>::addDirBondedWIG: exit\n" ;
583 }
584 
588 template <class T>
590 {
591  console.XDebug() << "TSubLattice<T>::getWallPosition: enter\n" ;
592  CVarMPIBuffer param_buffer(m_comm);
593  Vec3 pos;
594 
595  // receive params from master
596  param_buffer.receiveBroadcast(0);
597 
598  std::string wname=param_buffer.pop_string();
599  console.XDebug() << "Wall name: " << wname << "\n";
600 
601  // find wall
602  map<string,CWall*>::iterator iter=m_walls.find(wname);
603  if(iter!=m_walls.end()){
604  pos=(iter->second)->getPos();
605  console.XDebug() << "Wall pos: " << pos << "\n";
606  } else {
607  pos=Vec3(0.0,0.0,0.0);
608  }
609 
610  vector<Vec3> vpos;
611  vpos.push_back(pos);
612  m_tml_comm.send_gather(vpos,0);
613  console.XDebug() << "TSubLattice<T>::getWallPosition: exit\n" ;
614 }
615 
619 template <class T>
621 {
622  console.XDebug() << "TSubLattice<T>::getSphereBodyPosition: enter\n" ;
623  CVarMPIBuffer param_buffer(m_comm);
624  Vec3 pos;
625 
626  // receive params from master
627  param_buffer.receiveBroadcast(0);
628 
629  std::string wname=param_buffer.pop_string();
630  console.XDebug() << "Sphere name: " << wname << "\n";
631 
632  // find sphere
633  map<string,CSphereBody*>::iterator iter=m_spheres.find(wname);
634  if(iter!=m_spheres.end()){
635  pos=(iter->second)->getPos();
636  console.XDebug() << "Sphere pos: " << pos << "\n";
637  } else {
638  pos=Vec3(0.0,0.0,0.0);
639  }
640 
641  vector<Vec3> vpos;
642  vpos.push_back(pos);
643  m_tml_comm.send_gather(vpos,0);
644  console.XDebug() << "TSubLattice<T>::getSphereBodyPosition: exit\n" ;
645 }
646 
650 template <class T>
652 {
653  console.XDebug() << "TSubLattice<T>::getWallForce: enter\n" ;
654  CVarMPIBuffer param_buffer(m_comm);
655  Vec3 force;
656 
657  // receive params from master
658  param_buffer.receiveBroadcast(0);
659 
660  std::string wname=param_buffer.pop_string();
661  console.XDebug() << "Wall name: " << wname << "\n";
662 
663  // find wall
664  map<string,CWall*>::iterator iter=m_walls.find(wname);
665  if(iter!=m_walls.end()){
666  force=(iter->second)->getForce();
667  console.XDebug() << "Wall force: " << force << "\n";
668  } else {
669  force=Vec3(0.0,0.0,0.0);
670  }
671 
672  vector<Vec3> vforce;
673  vforce.push_back(force);
674  m_tml_comm.send_gather(vforce,0);
675  console.XDebug() << "TSubLattice<T>::getWallForce: exit\n" ;
676 }
677 
681 template <class T>
683 {
684  console.XDebug() << "TSubLattice<T>::getSphereBodyForce: enter\n" ;
685  CVarMPIBuffer param_buffer(m_comm);
686  Vec3 force;
687 
688  // receive params from master
689  param_buffer.receiveBroadcast(0);
690 
691  std::string wname=param_buffer.pop_string();
692  console.XDebug() << "Sphere name: " << wname << "\n";
693 
694  // find Sphere
695  map<string,CSphereBody*>::iterator iter=m_spheres.find(wname);
696  if(iter!=m_spheres.end()){
697  force=(iter->second)->getForce();
698  console.XDebug() << "Sphere force: " << force << "\n";
699  } else {
700  force=Vec3(0.0,0.0,0.0);
701  }
702 
703  vector<Vec3> vforce;
704  vforce.push_back(force);
705  m_tml_comm.send_gather(vforce,0);
706  console.XDebug() << "TSubLattice<T>::getSphereBodyForce: exit\n" ;
707 }
708 
712 template <class T>
714 {
715  console.XDebug() << "TSubLattice<T>::addViscWIG: enter\n" ;
716  CVarMPIBuffer param_buffer(m_comm);
717 
718  // receive params from master
719  param_buffer.receiveBroadcast(0);
720 
721  CVWallIGP* wigp=extractVWallIGP(&param_buffer);
722 
723  string wallname=wigp->getWallName();
724  map<string,CWall*>::iterator iter=m_walls.find(wallname);
725  if(iter!=m_walls.end()){
726  AWallInteractionGroup<T>* newCVWIG=new CViscWallIG<T>(&m_tml_worker_comm,m_walls[wallname],wigp);
727  newCVWIG->Update(m_ppa);
728  m_WIG.insert(make_pair(wigp->getName(),newCVWIG));
729  } else {
730  console.Error() << "wall name " << wallname << " not found in map of walls\n";
731  }
732 
733  delete wigp;
734  console.XDebug() << "TSubLattice<T>::addViscWIG: exit\n" ;
735 }
736 
740 template <class T>
742 {
743  console.XDebug() << "TSubLattice<T>::addPairIG()\n";
744  CVarMPIBuffer param_buffer(m_comm,2000);
745 
746  // get params
747  param_buffer.receiveBroadcast(0);
748  string type = param_buffer.pop_string();
749  console.XDebug()<< "PIG type: " << type.c_str() << "\n";
750  string name = param_buffer.pop_string();
751  console.XDebug()<< "PIG name: " << name.c_str() << "\n";
752 
753  doAddPIG(name,type,param_buffer,false);
754 
755  console.XDebug() << "end TSubLattice<T>::addPairIG()\n";
756 }
757 
761 template <class T>
763 {
764  console.XDebug() << "TSubLattice<T>::addTaggedPairIG()\n";
765  CVarMPIBuffer param_buffer(m_comm,2000);
766 
767  // get params
768  param_buffer.receiveBroadcast(0);
769  string type = param_buffer.pop_string();
770  console.XDebug()<< "PIG type: " << type.c_str() << "\n";
771  string name = param_buffer.pop_string();
772  console.XDebug()<< "PIG name: " << name.c_str() << "\n";
773 
774  doAddPIG(name,type,param_buffer,true);
775 
776  console.XDebug() << "end TSubLattice<T>::addTaggedPairIG()\n";
777 }
778 
786 template <class T>
787 bool TSubLattice<T>::doAddPIG(const string& name,const string& type,CVarMPIBuffer& param_buffer, bool tagged)
788 {
789  bool res=false;
791 
792  if(type=="Elastic") {
793  CElasticIGP eigp;
794  eigp.m_k=param_buffer.pop_double();
795  eigp.m_scaling=static_cast<bool>(param_buffer.pop_int());
796  if(tagged){
797  int tag1=param_buffer.pop_int();
798  int mask1=param_buffer.pop_int();
799  int tag2=param_buffer.pop_int();
800  int mask2=param_buffer.pop_int();
801  console.XDebug() << "tag1, mask1, tag2, mask2 "
802  << tag1 << " , " << mask1 << " , "
803  << tag2 << " , " << mask2 << "\n";
804  new_pis=new ParallelInteractionStorage_NE_T<T,CElasticInteraction>(m_ppa,eigp,tag1,mask1,tag2,mask2);
805  }else{
807  }
808  res=true;
809  } else if (type=="Friction") {
810  CFrictionIGP figp;
811  figp.k=param_buffer.pop_double();
812  figp.mu=param_buffer.pop_double();
813  figp.k_s=param_buffer.pop_double();
814  figp.dt=param_buffer.pop_double();
815  figp.m_scaling=static_cast<bool>(param_buffer.pop_int());
816  console.XDebug() << "k,mu,k_s,dt: " << figp.k << " , " << figp.mu << " , "
817  << figp.k_s << " , " << figp.dt << "\n";
819  res=true;
820  } else if (type=="AdhesiveFriction") {
822  figp.k=param_buffer.pop_double();
823  figp.mu=param_buffer.pop_double();
824  figp.k_s=param_buffer.pop_double();
825  figp.dt=param_buffer.pop_double();
826  figp.r_cut=param_buffer.pop_double();
827  console.XDebug()
828  << "k,mu,k_s,dt,r_cut: " << figp.k << " , " << figp.mu << " , "
829  << figp.k_s << " , " << figp.dt << " " << figp.r_cut << "\n";
831  res=true;
832  } else if (type=="FractalFriction") {
833  FractalFrictionIGP figp;
834  figp.k=param_buffer.pop_double();
835  figp.mu_0=param_buffer.pop_double();
836  figp.k_s=param_buffer.pop_double();
837  figp.dt=param_buffer.pop_double();
838  console.XDebug() << "k,mu_0,k_s,dt: " << figp.k << " , " << figp.mu_0 << " , "
839  << figp.k_s << " , " << figp.dt << "\n";
840  figp.x0=param_buffer.pop_double();
841  figp.y0=param_buffer.pop_double();
842  figp.dx=param_buffer.pop_double();
843  figp.dy=param_buffer.pop_double();
844  figp.nx=param_buffer.pop_int();
845  figp.ny=param_buffer.pop_int();
846  console.XDebug()
847  <<"x0,y0,dx,dy,nx,ny: "
848  << figp.x0 << " , " << figp.y0 << " , "
849  << figp.dx << " , " << figp.dy << " ,"
850  << figp.nx << " , " << figp.ny << "\n";
851  figp.mu = boost::shared_ptr<double>(new double[figp.nx*figp.ny]);
852 
853  for(int i=0;i<figp.nx*figp.ny;i++)
854  {
855  (figp.mu.get())[i]=param_buffer.pop_double();
856  // console.XDebug() << i << " , " << figp.mu[i] << "\n";
857  }
858  new_pis = new ParallelInteractionStorage_ED<T,CFractalFriction>(m_ppa,figp);
859  res=true;
860  } else if(type=="VWFriction") {
861  VWFrictionIGP figp;
862 
863  figp.k=param_buffer.pop_double();
864  figp.mu=param_buffer.pop_double();
865  figp.k_s=param_buffer.pop_double();
866  figp.dt=param_buffer.pop_double();
867  figp.m_alpha=param_buffer.pop_double();
868  console.XDebug()
869  << "k,mu,k_s,dt,alpha: " << figp.k << " , " << figp.mu << " , "
870  << figp.k_s << " , " << figp.dt << "\n";
871  new_pis=new ParallelInteractionStorage_ED<T,CVWFriction>(m_ppa,figp);
872  res=true;
873  } else if(type=="RotElastic"){
874  CRotElasticIGP reigp;
875  reigp.m_kr=param_buffer.pop_double();
877  res=true;
878  } else if (type=="RotFriction"){
879  CRotFrictionIGP rfigp;
880  rfigp.k=param_buffer.pop_double();
881  rfigp.mu_s=param_buffer.pop_double();
882  rfigp.mu_d=param_buffer.pop_double();
883  rfigp.k_s=param_buffer.pop_double();
884  rfigp.dt=param_buffer.pop_double();
885  rfigp.scaling=static_cast<bool>(param_buffer.pop_int());
886  rfigp.meanR_scaling=static_cast<bool>(param_buffer.pop_int());
887  console.XDebug()
888  << "k,mu_s,mu_d,k_s,dt,scaling: " << rfigp.k << " , "
889  << rfigp.mu_s << " , " << rfigp.mu_d << " , "
890  << rfigp.k_s << " , " << rfigp.dt << " , " << rfigp.scaling << "\n";
891  if(tagged){
892  int tag1=param_buffer.pop_int();
893  int mask1=param_buffer.pop_int();
894  int tag2=param_buffer.pop_int();
895  int mask2=param_buffer.pop_int();
896  console.XDebug() << "tag1, mask1, tag2, mask2 "
897  << tag1 << " , " << mask1 << " , "
898  << tag2 << " , " << mask2 << "\n";
899  new_pis=new ParallelInteractionStorage_ED_T<CRotParticle,CRotFrictionInteraction>(m_ppa,rfigp,tag1,mask1,tag2,mask2);
900  } else {
902  }
903  res=true;
904  } else if (type == "RotThermElastic") {
905  CRotThermElasticIGP eigp;
906  eigp.m_kr = param_buffer.pop_double();
907  eigp.diffusivity = param_buffer.pop_double();
908  console.XDebug()
909  << "k=" << eigp.m_kr << " , "
910  << "diffusivity=" << eigp.diffusivity << "\n";
911 
912  new_pis =
916  >(
917  m_ppa,
918  eigp
919  );
920  res=true;
921  } else if (type == "RotThermFriction") {
922  CRotThermFrictionIGP rfigp;
923  rfigp.k=param_buffer.pop_double();
924  rfigp.mu_s=param_buffer.pop_double();
925  rfigp.mu_d=param_buffer.pop_double();
926  rfigp.k_s=param_buffer.pop_double();
927  rfigp.diffusivity=param_buffer.pop_double();
928  rfigp.dt=param_buffer.pop_double();
929  console.XDebug()
930  << "k=" << rfigp.k << " , "
931  << "mu_d=" << rfigp.mu_d << " , "
932  << "mu_s=" << rfigp.mu_s << " , "
933  << "k_s=" << rfigp.k_s << " , "
934  << "diffusivity=" << rfigp.diffusivity << " , "
935  << "dt=" << rfigp.dt << "\n";
936 
937  new_pis =
941  >(
942  m_ppa,
943  rfigp
944  );
945  res=true;
946  } else if(type=="HertzianElastic") {
947  CHertzianElasticIGP heigp;
948  heigp.m_E=param_buffer.pop_double();
949  heigp.m_nu=param_buffer.pop_double();
950  if(tagged){
951  int tag1=param_buffer.pop_int();
952  int mask1=param_buffer.pop_int();
953  int tag2=param_buffer.pop_int();
954  int mask2=param_buffer.pop_int();
955  new_pis=new ParallelInteractionStorage_NE_T<T,CHertzianElasticInteraction>(m_ppa,heigp,tag1,mask1,tag2,mask2);
956  }else{
958  }
959  res=true;
960  } else if(type=="HertzianViscoElasticFriction") {
962  hvefigp.m_A=param_buffer.pop_double();
963  hvefigp.m_E=param_buffer.pop_double();
964  hvefigp.m_nu=param_buffer.pop_double();
965  hvefigp.mu=param_buffer.pop_double();
966  hvefigp.k_s=param_buffer.pop_double();
967  hvefigp.dt=param_buffer.pop_double();
968  if(tagged){
969  int tag1=param_buffer.pop_int();
970  int mask1=param_buffer.pop_int();
971  int tag2=param_buffer.pop_int();
972  int mask2=param_buffer.pop_int();
973  new_pis=new ParallelInteractionStorage_NE_T<T,CHertzianViscoElasticFrictionInteraction>(m_ppa,hvefigp,tag1,mask1,tag2,mask2);
974  }else{
976  }
977  res=true;
978  } else if(type=="HertzianViscoElastic") {
980  hveigp.m_A=param_buffer.pop_double();
981  hveigp.m_E=param_buffer.pop_double();
982  hveigp.m_nu=param_buffer.pop_double();
983  if(tagged){
984  int tag1=param_buffer.pop_int();
985  int mask1=param_buffer.pop_int();
986  int tag2=param_buffer.pop_int();
987  int mask2=param_buffer.pop_int();
988  new_pis=new ParallelInteractionStorage_NE_T<T,CHertzianViscoElasticInteraction>(m_ppa,hveigp,tag1,mask1,tag2,mask2);
989  }else{
991  }
992  res=true;
993  } else if(type=="HertzMindlin") {
994  CHertzMindlinIGP hmigp;
995  hmigp.m_E=param_buffer.pop_double();
996  hmigp.m_nu=param_buffer.pop_double();
997  hmigp.mu=param_buffer.pop_double();
998  hmigp.dt=param_buffer.pop_double();
999  if(tagged){
1000  int tag1=param_buffer.pop_int();
1001  int mask1=param_buffer.pop_int();
1002  int tag2=param_buffer.pop_int();
1003  int mask2=param_buffer.pop_int();
1004  new_pis=new ParallelInteractionStorage_NE_T<T,CHertzMindlinInteraction>(m_ppa,hmigp,tag1,mask1,tag2,mask2);
1005  }else{
1007  }
1008  res=true;
1009  } else if(type=="HertzMindlinVisco") {
1010  CHertzMindlinViscoIGP hmvigp;
1011  hmvigp.m_E=param_buffer.pop_double();
1012  hmvigp.m_nu=param_buffer.pop_double();
1013  hmvigp.mu=param_buffer.pop_double();
1014  hmvigp.m_COR=param_buffer.pop_double();
1015  hmvigp.dt=param_buffer.pop_double();
1016  if(tagged){
1017  int tag1=param_buffer.pop_int();
1018  int mask1=param_buffer.pop_int();
1019  int tag2=param_buffer.pop_int();
1020  int mask2=param_buffer.pop_int();
1021  new_pis=new ParallelInteractionStorage_NE_T<T,CHertzMindlinViscoInteraction>(m_ppa,hmvigp,tag1,mask1,tag2,mask2);
1022  }else{
1024  }
1025  res=true;
1026  } else if(type=="LinearDashpot") {
1027  CLinearDashpotIGP heigp;
1028  heigp.m_damp=param_buffer.pop_double();
1029  heigp.m_cutoff=param_buffer.pop_double();
1030  if(tagged){
1031  int tag1=param_buffer.pop_int();
1032  int mask1=param_buffer.pop_int();
1033  int tag2=param_buffer.pop_int();
1034  int mask2=param_buffer.pop_int();
1035  new_pis=new ParallelInteractionStorage_NE_T<T,CLinearDashpotInteraction>(m_ppa,heigp,tag1,mask1,tag2,mask2);
1036  }else{
1038  }
1039  res=true;
1040  } else {
1041  cerr << "Unknown interaction group name "
1042  << type
1043  << " in TSubLattice<T>::addPairIG()" << endl;
1044  }
1045 
1046  // add InteractionGroup to map
1047  if(res) m_dpis.insert(make_pair(name,new_pis));
1048 
1049  return res;
1050 }
1051 
1052 
1056 template <class T>
1058 {
1059  console.XDebug() << "TSubLattice<T>::addTriMesh()\n";
1060 
1061  // MPI buffer
1062  CVarMPIBuffer param_buffer(m_comm);
1063  // data buffers
1064  vector<MeshNodeData> node_recv_buffer;
1065  vector<MeshTriData> tri_recv_buffer;
1066 
1067  // receive params
1068  param_buffer.receiveBroadcast(0);
1069 
1070  // extract name
1071  string name = param_buffer.pop_string();
1072  console.XDebug()<< "TriMesh name: " << name.c_str() << "\n";
1073 
1074  // receive nodes
1075  m_tml_comm.recv_broadcast_cont_packed(node_recv_buffer,0);
1076  console.XDebug() << "recvd " << node_recv_buffer.size() << " nodes \n";
1077 
1078  // receive triangles
1079  m_tml_comm.recv_broadcast_cont_packed(tri_recv_buffer,0);
1080  console.XDebug() << "recvd " << tri_recv_buffer.size() << " triangles \n";
1081 
1082  // load mesh into new TriMesh
1083  TriMesh* new_tm=new TriMesh();
1084  new_tm->LoadMesh(node_recv_buffer,tri_recv_buffer);
1085 
1086  m_mesh.insert(make_pair(name,new_tm));
1087 
1088  console.XDebug() << "end TSubLattice<T>::addTriMesh()\n";
1089 }
1090 
1094 template <class T>
1096 {
1097  console.XDebug() << "TSubLattice<T>::addTriMeshIG()\n";
1098 
1099  // MPI buffer
1100  CVarMPIBuffer param_buffer(m_comm);
1101 
1102  // receive params
1103  param_buffer.receiveBroadcast(0);
1104 
1105  // extract name & type
1106  string type = param_buffer.pop_string();
1107  console.XDebug()<< "TriMeshIG type: " << type.c_str() << "\n";
1108  string name = param_buffer.pop_string();
1109  console.XDebug()<< "TriMeshIG name: " << name.c_str() << "\n";
1110  string meshname = param_buffer.pop_string();
1111  console.XDebug()<< "TriMeshIG mesh name: " << meshname.c_str() << "\n";
1112 
1113  // get pointer to mesh
1114  TriMesh* tmp=NULL;
1115  if (m_mesh.find(meshname) != m_mesh.end())
1116  {
1117  tmp = m_mesh[meshname];
1118  }
1119  if(tmp==NULL){
1120  throw runtime_error("unknown mesh name in TSubLattice<T>::addTriMeshIG:" + meshname);
1121  }
1122  // switch on type,extract params & construc new TriMeshIG
1123  if(type=="Elastic")
1124  {
1125  AParallelInteractionStorage* new_pis;
1126  ETriMeshIP tmi;
1127  tmi.k=param_buffer.pop_double();
1128  new_pis = new TriMesh_PIS_NE<T,ETriMeshInteraction>(tmp,m_ppa,tmi);
1129  m_dpis.insert(make_pair(name,new_pis));
1130  } else { // unknown type-> throw
1131  throw runtime_error("unknown type in TSubLattice<T>::addTriMeshIG:" + type);
1132  }
1133 
1134 
1135  console.XDebug() << "end TSubLattice<T>::addTriMeshIG()\n";
1136 }
1137 
1141 template <class T>
1143 {
1144  console.XDebug() << "TSubLattice<T>::addBondedTriMeshIG()\n";
1145 
1146  // MPI buffer
1147  CVarMPIBuffer param_buffer(m_comm);
1148 
1149  // receive params
1150  BTriMeshIP param;
1151  param_buffer.receiveBroadcast(0);
1152 
1153  // extract name.meshname & params
1154  string name = param_buffer.pop_string();
1155  console.XDebug()<< "BTriMeshIG name: " << name.c_str() << "\n";
1156  string meshname = param_buffer.pop_string();
1157  console.XDebug()<< "BTriMeshIG mesh name: " << meshname.c_str() << "\n";
1158  param.k = param_buffer.pop_double();
1159  console.XDebug()<< "BTriMeshIG k : " << param.k << "\n";
1160  param.brk = param_buffer.pop_double();
1161  console.XDebug()<< "BTriMeshIG r_break: " << param.brk << "\n";
1162  string buildtype = param_buffer.pop_string();
1163  console.XDebug()<< "BTriMeshIG build type: " << buildtype.c_str() << "\n";
1164 
1165  // get pointer to mesh
1166  TriMesh* tmp=NULL;
1167  if (m_mesh.find(meshname) != m_mesh.end())
1168  {
1169  tmp = m_mesh[meshname];
1170  }
1171  if(tmp==NULL){
1172  throw runtime_error("unknown mesh name in TSubLattice<T>::addTriMeshIG:" + meshname);
1173  }
1174 
1175  // setup new interaction storage
1177  // switch on buildtype, extract buildparam & build
1178  if(buildtype=="BuildByTag"){
1179  int tag=param_buffer.pop_int();
1180  int mask=param_buffer.pop_int();
1181  new_pis->buildFromPPATagged(tag,mask);
1182  m_bpis.insert(make_pair(name,new_pis));
1183  } else if(buildtype=="BuildByGap"){
1184  double max_gap=param_buffer.pop_double();
1185  new_pis->buildFromPPAByGap(max_gap);
1186  m_bpis.insert(make_pair(name,new_pis));
1187  } else { // unknown type-> throw
1188  throw runtime_error("unknown build type in TSubLattice<T>::addBondedTriMeshIG:" + buildtype);
1189  }
1190 
1191  console.XDebug() << "end TSubLattice<T>::addBondedTriMeshIG()\n";
1192 }
1193 
1197 template <class T>
1199 {
1200  console.XDebug() << "TSubLattice<T>::addMesh2D()\n";
1201 
1202  // MPI buffer
1203  CVarMPIBuffer param_buffer(m_comm);
1204  // data buffers
1205  vector<MeshNodeData2D> node_recv_buffer;
1206  vector<MeshEdgeData2D> edge_recv_buffer;
1207 
1208  // receive params
1209  param_buffer.receiveBroadcast(0);
1210 
1211  // extract name
1212  string name = param_buffer.pop_string();
1213  console.XDebug()<< "Mesh2D name: " << name.c_str() << "\n";
1214 
1215  // receive nodes
1216  m_tml_comm.recv_broadcast_cont_packed(node_recv_buffer,0);
1217  console.XDebug() << "recvd " << node_recv_buffer.size() << " nodes \n";
1218 
1219  // receive edges
1220  m_tml_comm.recv_broadcast_cont_packed(edge_recv_buffer,0);
1221  console.XDebug() << "recvd " << edge_recv_buffer.size() << " edges \n";
1222 
1223  // load mesh into new 2D Mesh
1224  Mesh2D* new_tm=new Mesh2D();
1225  new_tm->LoadMesh(node_recv_buffer,edge_recv_buffer);
1226 
1227  m_mesh2d.insert(make_pair(name,new_tm));
1228 
1229  console.XDebug() << "end TSubLattice<T>::addMesh2D()\n";
1230 }
1231 
1236 template <class T>
1238 {
1239 console.XDebug() << "TSubLattice<T>::addMesh2DIG()\n";
1240 
1241  // MPI buffer
1242  CVarMPIBuffer param_buffer(m_comm);
1243 
1244  // receive params
1245  param_buffer.receiveBroadcast(0);
1246 
1247  // extract name & type
1248  string type = param_buffer.pop_string();
1249  console.XDebug()<< "Mesh2DIG type: " << type.c_str() << "\n";
1250  string name = param_buffer.pop_string();
1251  console.XDebug()<< "Mesh2DIG name: " << name.c_str() << "\n";
1252  string meshname = param_buffer.pop_string();
1253  console.XDebug()<< "Mesh2DIG mesh name: " << meshname.c_str() << "\n";
1254 
1255  // get pointer to mesh
1256  Mesh2D* tmp=NULL;
1257  if (m_mesh2d.find(meshname) != m_mesh2d.end())
1258  {
1259  tmp = m_mesh2d[meshname];
1260  }
1261  if(tmp==NULL){
1262  throw runtime_error("unknown mesh name in TSubLattice<T>::addMesh2DIG:" + meshname);
1263  }
1264  // switch on type,extract params & construc new Mesh2DIG
1265  if(type=="Elastic")
1266  {
1267  AParallelInteractionStorage* new_pis;
1268  ETriMeshIP tmi;
1269  tmi.k=param_buffer.pop_double();
1270  new_pis = new Mesh2D_PIS_NE<T,EMesh2DInteraction>(tmp,m_ppa,tmi);
1271  m_dpis.insert(make_pair(name,new_pis));
1272  } else { // unknown type-> throw
1273  throw runtime_error("unknown type in TSubLattice<T>::addMesh2DIG:" + type);
1274  }
1275 
1276 
1277  console.XDebug() << "end TSubLattice<T>::addTriMeshIG()\n";
1278 }
1279 
1284 template <class T>
1286 {
1287  console.XDebug() << "TSubLattice<T>::addBondedMesh2DIG()\n";
1288 
1289  // MPI buffer
1290  CVarMPIBuffer param_buffer(m_comm);
1291 
1292  // receive params
1293  BMesh2DIP param;
1294  param_buffer.receiveBroadcast(0);
1295 
1296  // extract name.meshname & params
1297  string name = param_buffer.pop_string();
1298  console.XDebug() << "BMesh2DIG name: " << name.c_str() << "\n";
1299  string meshname = param_buffer.pop_string();
1300  console.XDebug() << "BMesh2DIG mesh name: " << meshname.c_str() << "\n";
1301  param.k = param_buffer.pop_double();
1302  console.XDebug() << "BMesh2DIG k : " << param.k << "\n";
1303  param.brk = param_buffer.pop_double();
1304  console.XDebug() << "BMesh2DIG r_break: " << param.brk << "\n";
1305  string buildtype = param_buffer.pop_string();
1306  console.XDebug() << "BMesh2DIG build type: " << buildtype.c_str() << "\n";
1307 
1308  // get pointer to mesh
1309  Mesh2D* tmp=NULL;
1310  if (m_mesh2d.find(meshname) != m_mesh2d.end())
1311  {
1312  tmp = m_mesh2d[meshname];
1313  }
1314  if(tmp==NULL){
1315  throw runtime_error("unknown mesh name in TSubLattice<T>::addBondedMesh2DIG:" + meshname);
1316  }
1317 
1318  // setup new interaction storage
1320  // switch on buildtype, extract buildparam & build
1321  if(buildtype=="BuildByTag"){
1322  int tag=param_buffer.pop_int();
1323  int mask=param_buffer.pop_int();
1324  new_pis->buildFromPPATagged(tag,mask);
1325  m_bpis.insert(make_pair(name,new_pis));
1326  } else if(buildtype=="BuildByGap"){
1327  double max_gap=param_buffer.pop_double();
1328  new_pis->buildFromPPAByGap(max_gap);
1329  m_bpis.insert(make_pair(name,new_pis));
1330  } else { // unknown type-> throw
1331  throw runtime_error("unknown build type in TSubLattice<T>::addBondedMesh2DIG:" + buildtype);
1332  }
1333 
1334  console.XDebug() << "end TSubLattice<T>::addBonded2DMeshIG()\n";
1335 }
1336 
1337 
1343 template <class T>
1345 {
1346  console.XDebug() << "TSubLattice<T>::addSingleIG()\n";
1347  CVarMPIBuffer param_buffer(m_comm);
1348 
1349  // get params
1350  param_buffer.receiveBroadcast(0);
1351 
1352  string type = param_buffer.pop_string();
1353  console.XDebug()<< "SIG type: " << type.c_str() << "\n";
1354 
1355  // setup InteractionGroup
1356  if(type=="Gravity"){
1358 
1359  // add to map
1360  m_singleParticleInteractions.insert(
1361  std::pair<string,AInteractionGroup<T>*>(
1362  prms.Name(),
1363  new esys::lsm::BodyForceGroup<T>(prms, *m_ppa)
1364  )
1365  );
1366  }
1367  else if (type=="Buoyancy"){
1369 
1370  // add to map
1371  m_singleParticleInteractions.insert(
1372  std::pair<string,AInteractionGroup<T>*>(
1373  prms.Name(),
1374  new esys::lsm::BuoyancyForceGroup<T>(prms, *m_ppa)
1375  )
1376  );
1377  }
1378  else {
1379  throw std::runtime_error(
1380  std::string("Trying to setup SIG of unknown type: ")
1381  +
1382  type
1383  );
1384  }
1385 
1386  console.XDebug() << "end TSubLattice<T>::addSingleIG()\n";
1387 }
1388 
1389 
1393 template <class T>
1395 {
1396  console.XDebug() << "TSubLattice<T>::addDamping()\n";
1397  CVarMPIBuffer param_buffer(m_comm);
1398  // get params
1399  param_buffer.receiveBroadcast(0);
1400 
1401  string type = param_buffer.pop_string();
1402  console.XDebug()<< "Damping type: " << type.c_str() << "\n";
1403 
1404  // setup InteractionGroup
1405  doAddDamping(type,param_buffer);
1406 
1407  console.XDebug() << "end TSubLattice<T>::addDamping()\n";
1408 }
1409 
1416 template <class T>
1417 bool TSubLattice<T>::doAddDamping(const string& type,CVarMPIBuffer& param_buffer)
1418 {
1420  string damping_name;
1421  bool res;
1422 
1423  if(type=="Damping")
1424  {
1425  CDampingIGP *params=extractDampingIGP(&param_buffer);
1426  DG=new ParallelInteractionStorage_Single<T,CDamping<T> >(m_ppa,*params);
1427  damping_name="Damping";
1428  res=true;
1429  } else if (type=="ABCDamping"){
1430  ABCDampingIGP *params=extractABCDampingIGP(&param_buffer);
1431  DG=new ParallelInteractionStorage_Single<T,ABCDamping<T> >(m_ppa,*params);
1432  damping_name=params->getName();
1433  res=true;
1434  } else if (type=="LocalDamping"){
1435  CLocalDampingIGP *params=extractLocalDampingIGP(&param_buffer);
1437  damping_name=params->getName();
1438  res=true;
1439  }else {
1440  std::stringstream msg;
1441  msg << "Trying to setup Damping of unknown type: " << type;
1442  console.Error() << msg.str() << "\n";
1443  throw std::runtime_error(msg.str());
1444  res=false;
1445  }
1446 
1447  // add to map
1448  if(res) {
1449  m_damping.insert(make_pair(damping_name,DG));
1450  m_damping[damping_name]->update();
1451  }
1452  return res;
1453 }
1454 
1459 template <class T>
1461 {
1462  console.XDebug() << "TSubLattice<T>::addBondedIG()\n";
1463  CVarMPIBuffer param_buffer(m_comm);
1464 
1465  // get params
1466  CBondedIGP param;
1467  param_buffer.receiveBroadcast(0);
1468  param.tag=param_buffer.pop_int();
1469  string name = param_buffer.pop_string();
1470  param.k=param_buffer.pop_double();
1471  param.rbreak=param_buffer.pop_double();
1472  param.m_scaling=static_cast<bool>(param_buffer.pop_int());
1473 
1474  console.XDebug()
1475  << "Got BondedIG parameters: " << param.tag
1476  << " " << name.c_str() << " "
1477  << param.k << " " << param.rbreak << "\n";
1478  // setup InteractionGroup
1481 
1482  // set unbreakable if rbeak<0
1483  if(param.rbreak<0){
1484  B_PIS->setUnbreakable(true);
1485  console.XDebug() << "set bpis unbreakable\"n";
1486  }
1487 
1488  vector<int> vi(2,-1);
1489  for(size_t i=0;i<m_temp_conn[param.tag].size();i+=2)
1490  {
1491  vi[0] = (m_temp_conn[param.tag][i]);
1492  vi[1] = (m_temp_conn[param.tag][i+1]);
1493  B_PIS->tryInsert(vi);
1494  }
1495 
1496  // add InteractionGroup to map
1497  m_bpis.insert(make_pair(name,B_PIS));
1498 
1499  console.XDebug() << "end TSubLattice<T>::addBondedIG()\n";
1500 }
1501 
1506 template <class T>
1508 {
1509  console.XDebug() << "TSubLattice<T>::addCappedBondedIG()\n";
1510  CVarMPIBuffer param_buffer(m_comm);
1511 
1512  // get params
1513  param_buffer.receiveBroadcast(0);
1514  int tag=param_buffer.pop_int();
1515  string name = param_buffer.pop_string();
1516  double k=param_buffer.pop_double();
1517  double rbreak=param_buffer.pop_double();
1518  double maxforce=param_buffer.pop_double();
1519 
1520  console.XDebug()
1521  << "Got CappedBondedIG parameters: " << tag
1522  << " " << name.c_str() << " "
1523  << k << " " << rbreak << " " << maxforce << "\n";
1524  // setup InteractionGroup
1525  CCappedBondedIGP param;
1526  param.k=k;
1527  param.rbreak=rbreak;
1528  param.tag = tag;
1529  param.m_force_limit=maxforce;
1532 
1533  // set unbreakable if rbeak<0
1534  if(rbreak<0){
1535  B_PIS->setUnbreakable(true);
1536  console.XDebug() << "set bpis unbreakable\"n";
1537  }
1538  // recv broadcast connection data
1539  /*console.XDebug()
1540  << "rank=" << m_tml_comm.rank()
1541  << "TSubLattice<T>::addCappedBondedIG(): receiving conn_data.\n";
1542 
1543  vector<int> conn_data;
1544  m_tml_comm.recv_broadcast_cont(conn_data,0);
1545  console.XDebug()
1546  << "rank=" << m_tml_comm.rank()
1547  << "TSubLattice<T>::addBondedIG(): conn_data.size()="
1548  << conn_data.size() << "\n";
1549  */
1550  vector<int> vi(2,-1);
1551  for(size_t i=0;i<m_temp_conn[tag].size();i+=2)
1552  {
1553  vi[0] = (m_temp_conn[tag][i]);
1554  vi[1] = (m_temp_conn[tag][i+1]);
1555  B_PIS->tryInsert(vi);
1556  }
1557 
1558  // add InteractionGroup to map
1559  m_bpis.insert(make_pair(name,B_PIS));
1560 
1561  console.XDebug() << "end TSubLattice<T>::addCappedBondedIG()\n";
1562 }
1563 
1564 template <class T>
1566 {
1567  console.Error() << "TSubLattice<T>::addRotBondedIG() => trying to add rotational bonded IG to nonrotational model\n";
1568 }
1569 
1570 template <class T>
1572 {
1573  console.Error() << "TSubLattice<T>::addRotThermBondedIG() => trying to add rotational thermal bonded IG to nonrotational model\n";
1574 }
1575 
1580 template <class T>
1582 {
1583  console.XDebug() << "TSubLattice<T>::addShortBondedIG()\n";
1584  CVarMPIBuffer param_buffer(m_comm);
1585 
1586  // get params
1587  param_buffer.receiveBroadcast(0);
1588  int tag=param_buffer.pop_int();
1589  string name = param_buffer.pop_string();
1590  double k=param_buffer.pop_double();
1591  double rbreak=param_buffer.pop_double();
1592 
1593  console.XDebug()
1594  << "Got ShortBondedIG parameters: " << tag
1595  << " " << name.c_str() << " "
1596  << k << " " << rbreak << "\n";
1597  // setup InteractionGroup
1598  CBondedIGP param;
1599  param.k=k;
1600  param.rbreak=rbreak;
1601  param.tag = tag;
1604 
1605  // recv broadcast connection data
1606  /*console.XDebug()
1607  << "rank=" << m_tml_comm.rank()
1608  << "TSubLattice<T>::addShortBondedIG(): receiving conn_data.\n";
1609 
1610  vector<int> conn_data;
1611  m_tml_comm.recv_broadcast_cont(conn_data,0);
1612  console.XDebug()
1613  << "rank=" << m_tml_comm.rank()
1614  << "TSubLattice<T>::addShortBondedIG(): conn_data.size()="
1615  << conn_data.size() << "\n";*/
1616 
1617  vector<int> vi(2,-1);
1618  for(size_t i=0;i<m_temp_conn[param.tag].size();i+=2)
1619  {
1620  vi[0] = (m_temp_conn[param.tag][i]);
1621  vi[1] = (m_temp_conn[param.tag][i+1]);
1622  B_PIS->tryInsert(vi);
1623  }
1624 
1625  // add InteractionGroup to map
1626  m_bpis.insert(make_pair(name,B_PIS));
1627 
1628  console.XDebug() << "end TSubLattice<T>::addShortBondedIG()\n";
1629 }
1630 
1636 template <class T>
1638 {
1639  console.XDebug() << "TSubLattice<T>::addExIG()\n";
1640  CVarMPIBuffer pbuffer(m_comm);
1641 
1642  // get params
1643  pbuffer.receiveBroadcast(0);
1644  string s1 = pbuffer.pop_string();
1645  string s2 = pbuffer.pop_string();
1646 
1647  //console.XDebug()<< s1.c_str() << " " << s2.c_str() << "\n";
1648  // for first (excluding) IG, look in bonded _and_ in dynamic
1649  map<string,AParallelInteractionStorage*>::iterator excluding_ig=m_bpis.find(s1);
1650  if(excluding_ig==m_bpis.end()){
1651  excluding_ig=m_dpis.find(s2);
1652  }
1653  map<string,AParallelInteractionStorage*>::iterator dynamic_ig=m_dpis.find(s2);
1654  if((excluding_ig!=m_dpis.end())&&(dynamic_ig!=m_dpis.end()))
1655  {
1656  // map iterators point to [key,value] pairs, therefore it->second
1657  // is the pointer to the PIS here
1658  dynamic_ig->second->addExIG(excluding_ig->second);
1659  }
1660  else
1661  {
1662  console.Error() << "TSubLattice<T>::setExIG() - nonexisting interaction group \n";
1663  }
1664 
1665  console.XDebug() << "end TSubLattice<T>::addExIG()\n";
1666 }
1667 
1673 template <class T>
1675 {
1676  console.XDebug() << "TSubLattice<T>::removeIG()\n";
1677  CVarMPIBuffer pbuffer(m_comm);
1678  bool found=false;
1679 
1680  // get params
1681  pbuffer.receiveBroadcast(0);
1682  string igname = pbuffer.pop_string();
1683  // look for name in map of non-bondend particle pair interactions
1684  map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.find(igname);
1685  // if found, remove interaction
1686  if(iter!=m_dpis.end()){
1687  found=true;
1688  delete m_dpis[igname];
1689  m_dpis.erase(iter);
1690  } else {
1691  // if not found, look in unbonded wall interactions
1692  typename map<string,AWallInteractionGroup<T>*>::iterator it2=m_WIG.find(igname);
1693  if(it2!=m_WIG.end()){
1694  found=true;
1695  delete m_WIG[igname];
1696  m_WIG.erase(it2);
1697  }
1698  }
1699 
1700  if(!found) {
1701  console.Error() << "TSubLattice<T>::removeIG() - nonexisting interaction group - ignore removal\n";
1702  }
1703 }
1704 
1705 
1709 template <class T>
1711 {
1712  console.XDebug() << "TSubLattice<T>::exchangePos() \n" ;
1713 
1714  m_ppa->exchange(&T::getExchangeValues,&T::setExchangeValues);
1715 
1716  console.XDebug() << "end TSubLattice<T>::exchangePos()\n" ;
1717 }
1718 
1722 template <class T>
1724 {
1725  console.XDebug() << "TSubLattice<T>::zeroForces()\n";
1726 
1727  // particles
1728  m_ppa->forAllParticles(&T::zeroForce);
1729  // trimeshes
1730  for(map<string,TriMesh*>::iterator iter=m_mesh.begin();
1731  iter!=m_mesh.end();
1732  iter++){
1733  (iter->second)->zeroForces();
1734  }
1735 
1736  // 2d meshes
1737  for(map<string,Mesh2D*>::iterator iter=m_mesh2d.begin();
1738  iter!=m_mesh2d.end();
1739  iter++){
1740  (iter->second)->zeroForces();
1741  }
1742  // walls
1743  for(typename map<string,CWall*>::iterator iter=m_walls.begin();
1744  iter!=m_walls.end();
1745  iter++)
1746  {
1747  (iter->second)->zeroForce();
1748  }
1749  // sphere bodies
1750  for(typename map<string,CSphereBody*>::iterator iter=m_spheres.begin();
1751  iter!=m_spheres.end();
1752  iter++)
1753  {
1754  (iter->second)->zeroForce();
1755  }
1756  console.XDebug() << "end TSubLattice<T>::zeroForces() \n";
1757 }
1758 
1765 template <class T>
1767 {
1768  console.XDebug() << "TSubLattice<T>::calcForces() \n";
1769 
1770  // the walls
1771  for(typename map<string,AWallInteractionGroup<T>*>::iterator it=m_WIG.begin();it!=m_WIG.end();it++)
1772  {
1773  (it->second)->calcForces();
1774  }
1775  // the sphere bodies
1776  for(typename map<string,ASphereBodyInteractionGroup<T>*>::iterator it=m_SIG.begin();it!=m_SIG.end();it++)
1777  {
1778  (it->second)->calcForces();
1779  }
1780  // single particle IGs
1781  for(
1782  typename NameIGroupMap::iterator siter=this->m_singleParticleInteractions.begin();
1783  siter != m_singleParticleInteractions.end();
1784  siter++
1785  )
1786  {
1787  (siter->second)->calcForces();
1788  }
1789  // dynamically created IGs
1790  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();iter!=m_dpis.end();iter++)
1791  {
1792  (iter->second)->calcForces();
1793  }
1794  // bonded IGs
1795  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_bpis.begin();iter!=m_bpis.end();iter++)
1796  {
1797  (iter->second)->calcForces();
1798  }
1799  // last, but not least - damping
1800  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_damping.begin();iter!=m_damping.end();iter++)
1801  {
1802  (iter->second)->calcForces();
1803  }
1804 
1805  console.XDebug() << "end TSubLattice<T>::calcForces() \n";
1806 }
1807 
1814 template <class T>
1816 {
1817  m_dt = dt;
1818  console.XDebug() << "TSubLattice<T>::setTimeStepSize() \n";
1819 
1820  // the walls
1821  for(typename map<string,AWallInteractionGroup<T>*>::iterator it=m_WIG.begin();it!=m_WIG.end();it++)
1822  {
1823  (it->second)->setTimeStepSize(dt);
1824  }
1825  // the sphere bodies
1826  for(typename map<string,ASphereBodyInteractionGroup<T>*>::iterator it=m_SIG.begin();it!=m_SIG.end();it++)
1827  {
1828  (it->second)->setTimeStepSize(dt);
1829  }
1830  // single particle IGs
1831  for(
1832  typename NameIGroupMap::iterator siter=this->m_singleParticleInteractions.begin();
1833  siter != m_singleParticleInteractions.end();
1834  siter++
1835  )
1836  {
1837  (siter->second)->setTimeStepSize(dt);
1838  }
1839  // dynamically created IGs
1840  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();iter!=m_dpis.end();iter++)
1841  {
1842  (iter->second)->setTimeStepSize(dt);
1843  }
1844  // bonded IGs
1845  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_bpis.begin();iter!=m_bpis.end();iter++)
1846  {
1847  (iter->second)->setTimeStepSize(dt);
1848  }
1849  // last, but not least - damping
1850  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_damping.begin();iter!=m_damping.end();iter++)
1851  {
1852  (iter->second)->setTimeStepSize(dt);
1853  }
1854 
1855  console.XDebug() << "end TSubLattice<T>::setTimeStepSize() \n";
1856 }
1857 
1863 template <class T>
1865 {
1866  console.XDebug() << "TSubLattice<T>::integrate \n";
1867  m_ppa->forAllParticles(&T::integrate,dt);
1868  m_ppa->forAllParticles(&T::rescale) ;
1869  console.XDebug() << "end TSubLattice<T>::integrate \n";
1870 }
1871 
1875 template <class T>
1877 {
1878  zeroForces();
1879  calcForces();
1880  integrate(m_dt);
1881 
1882  if (this->getParticleType() == "RotTherm")
1883  {
1884  this->oneStepTherm();
1885  }
1886 }
1887 
1891 template <class T>
1893 {
1894  zeroHeat(); // ???? combine?
1895  calcHeatFrict();
1896  calcHeatTrans();
1897  integrateTherm(m_dt);
1898  thermExpansion() ;
1899 }
1900 
1906 template <class T>
1908 {
1909  console.XDebug() << "TSubLattice<T>::integrateTherm \n";
1910  m_ppa->forAllParticles(&T::integrateTherm,dt);
1911 // m_ppa->forAllParticles(&T::rescale) ;
1912  console.XDebug() << "end TSubLattice<T>::integrateTherm \n";
1913 }
1914 
1915 template <class T>
1917 {
1918  console.XDebug() << "TSubLattice<T>::thermExpansion() \n";
1919  m_ppa->forAllParticles(&T::thermExpansion);
1920 // m_ppa->forAllParticles(&T::rescale) ;
1921  console.XDebug() << "end TSubLattice<T>::thermExpansion() \n";
1922 }
1923 
1927 template <class T>
1929 {
1930  console.XDebug() << "TSubLattice<T>::zeroHeat()\n";
1931 
1932  // particles
1933  m_ppa->forAllParticles(&T::zeroHeat);
1934 
1935 /*
1936 // walls
1937  for(typename vector<AWallInteractionGroup<T>*>::iterator iter=m_WIG.begin();iter!=m_WIG.end();iter++)
1938  {
1939  (*iter)->zeroForce();
1940  }
1941 */
1942  console.XDebug() << "end TSubLattice<T>::zeroHeat() \n";
1943 }
1944 
1951 template <class T>
1953 {
1954  console.XDebug() << "TSubLattice<T>::calcHeatFrict() \n";
1955 
1956  // dynamically created IGs
1957  for(
1958  typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
1959  iter!=m_dpis.end();
1960  iter++
1961  )
1962  {
1963  (iter->second)->calcHeatFrict();
1964  }
1965 
1966  console.XDebug() << "end TSubLattice<T>::calcHeatFrict() \n";
1967 }
1968 
1969 template <class T>
1971 {
1972  console.XDebug() << "TSubLattice<T>::calcHeatTrans() \n";
1973 
1974 
1975  // dynamically created IGs
1976  for(
1977  typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
1978  iter!=m_dpis.end();
1979  iter++
1980  )
1981  {
1982  (iter->second)->calcHeatTrans();
1983  }
1984  // bonded IGs
1985  for(
1986  typename map<string,AParallelInteractionStorage*>::iterator iter=m_bpis.begin();
1987  iter!=m_bpis.end();
1988  iter++
1989  )
1990  {
1991  (iter->second)->calcHeatTrans();
1992  }
1993 
1994  console.XDebug() << "end TSubLattice<T>::calcHeatTrans() \n";
1995 }
1996 
2000 template <class T>
2002 {
2003  m_ppa->rebuild();
2004 }
2005 
2009 template <class T>
2011 {
2012  CMPIBarrier barrier(m_worker_comm);
2013  m_pTimers->start("RebuildInteractions");
2014  m_pTimers->resume("NeighbourSearch");
2015  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_bpis.begin();
2016  iter!=m_bpis.end();
2017  iter++)
2018  {
2019  console.Debug() << "exchg & rebuild BPIS " << iter->first << " at node " << m_rank << "\n";
2020  (iter->second)->exchange();
2021  (iter->second)->rebuild();
2022  }
2023 
2024  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
2025  iter!=m_dpis.end();
2026  iter++)
2027  {
2028  console.Debug() << "exchg & rebuild DPIS " << iter->first << " at node " << m_rank << "\n";
2029  (iter->second)->exchange();
2030  m_pTimers->pause("RebuildInteractions");
2031  m_pTimers->pause("NeighbourSearch");
2032  barrier.wait("dpis::exchange");
2033  m_pTimers->resume("RebuildInteractions");
2034  m_pTimers->resume("NeighbourSearch");
2035  (iter->second)->rebuild();
2036  }
2037  resetDisplacements();
2038  m_pTimers->stop("RebuildInteractions");
2039 }
2040 
2044 template <class T>
2046 {
2047  console.Debug() << "CSubLattice<T>::searchNeighbors()\n";
2048  CMPIBarrier barrier(getWorkerComm());
2049  m_pTimers->start("NeighbourSearch");
2050  m_pTimers->start("RebuildParticleArray");
2051  rebuildParticleArray();
2052  m_pTimers->stop("RebuildParticleArray");
2053  m_pTimers->pause("NeighbourSearch");
2054  barrier.wait("PPA rebuild");
2055  rebuildInteractions();
2056  m_pTimers->stop("NeighbourSearch");
2057  console.Debug() << "end CSubLattice<T>::searchNeighbors()\n";
2058 }
2059 
2065 template <class T>
2067 {
2068  console.Debug() << "updateInteractions() \n";
2069  console.Debug() << "m_ppa->getTimeStamp() " << m_ppa->getTimeStamp() << " m_last_ns " << m_last_ns << "\n";
2070  bool need_update=false;
2071 
2072  m_pTimers->start("UpdateBondedInteractions");
2073  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_bpis.begin();
2074  iter!=m_bpis.end();
2075  iter++)
2076  {
2077  bool n=(iter->second)->update();
2078  need_update=need_update || n;
2079  }
2080  m_pTimers->stop("UpdateBondedInteractions");
2081  if((m_ppa->getTimeStamp() > m_last_ns) || need_update)
2082  {
2083  m_pTimers->start("UpdateDynamicInteractions");
2084  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
2085  iter!=m_dpis.end();
2086  iter++)
2087  {
2088  bool n=(iter->second)->update();
2089  need_update=need_update || n;
2090  }
2091  m_pTimers->stop("UpdateDynamicInteractions");
2092  for(typename map<string,AWallInteractionGroup<T>*>::iterator it=m_WIG.begin();
2093  it!=m_WIG.end();
2094  it++)
2095  {
2096  (it->second)->Update(m_ppa);
2097  }
2098  for(typename map<string,ASphereBodyInteractionGroup<T>*>::iterator it=m_SIG.begin();
2099  it!=m_SIG.end();
2100  it++)
2101  {
2102  (it->second)->Update(m_ppa);
2103  }
2104  for(typename map<string,AParallelInteractionStorage*>::iterator iter=m_damping.begin();
2105  iter!=m_damping.end();
2106  iter++){
2107  (iter->second)->update();
2108  }
2109  m_last_ns=m_ppa->getTimeStamp();
2110  }
2111 
2112  console.Debug() << "end TSubLattice<T>::updateInteractions()\n";
2113 }
2114 
2119 template <class T>
2121 {
2122  console.Debug() << "TSubLattice<T>::checkNeighbors()\n";
2123  CMPISGBufferLeaf buffer(m_comm,0,8);
2124  double mdsqr=0; // squared max. displacement
2125  double alpha=0.5*m_alpha;
2126  double srsqr=alpha*alpha; // squared search range
2127  vector<Vec3> displ; // displacements
2128  int res; // result 0/1
2129 
2130  // --- particles ---
2131  // get displacement data
2132  m_ppa->forAllParticlesGet(displ,&T::getDisplacement);
2133 
2134  // find maximum particle displacement
2135  vector<Vec3>::iterator it=displ.begin();
2136  while((it!=displ.end())&&(mdsqr<srsqr))
2137  {
2138  double sqdisp=(*it)*(*it);
2139  mdsqr = ((mdsqr < sqdisp) ? sqdisp : mdsqr);
2140  it++;
2141  //console.XDebug() << "sq. disp: " << sqdisp << "\n";
2142  }
2143  console.XDebug() << "max squared displacement " << mdsqr << "alpha^2 = " << srsqr << "\n";
2144  if (mdsqr>srsqr){
2145  res=1;
2146  } else {
2147  res=0;
2148  }
2149 
2150  // --- mesh ---
2151  // only needed if res==0
2152  if(res==0){
2153  for(map<string,TriMesh*>::iterator iter=m_mesh.begin();
2154  iter!=m_mesh.end();
2155  iter++){
2156  //std::cerr << "check mesh " << iter->first << std::endl;
2157  if(iter->second->hasMovedBy(alpha)){
2158  res=1;
2159  }
2160  }
2161  }
2162  buffer.append(res);
2163  buffer.send();
2164  console.Debug() << "end TSubLattice<T>::checkNeighbors()\n";
2165 }
2166 
2167 
2171 template <class T>
2173 {
2174  console.Debug() << "slave " << m_rank << " resetDisplacements()\n";
2175  m_ppa->forAllParticles(&T::resetDisplacement);
2176  for(map<string,TriMesh*>::iterator iter=m_mesh.begin();
2177  iter!=m_mesh.end();
2178  iter++){
2179  iter->second->resetCurrentDisplacement();
2180  }
2181  console.Debug() << "slave " << m_rank << " end resetDisplacements()\n";
2182 }
2183 
2188 template <class T>
2190 {
2191  console.Debug() << "TSubLattice<T>::moveParticleTo()\n";
2192  CVarMPIBuffer buffer(m_comm);
2193 
2194  buffer.receiveBroadcast(0); // get data from master
2195  int tag=buffer.pop_int();
2196  Vec3 mv=buffer.pop_vector();
2197  m_ppa->forParticleTag(tag,(void (T::*)(Vec3))(&T::moveToRel),mv);
2198  console.Debug() << "end TSubLattice<T>::moveParticleTo()\n";
2199 }
2200 
2205 template <class T>
2207 {
2208  console.Debug() << "TSubLattice<T>::moveTaggedParticlesBy()\n";
2209  CVarMPIBuffer buffer(m_comm);
2210 
2211  buffer.receiveBroadcast(0); // get data from master
2212  const int tag = buffer.pop_int();
2213  const Vec3 dx = buffer.pop_vector();
2214  m_ppa->forParticleTag(tag, (void (T::*)(Vec3))(&T::moveBy),dx);
2215  console.Debug() << "end TSubLattice<T>::moveTaggedParticlesBy()\n";
2216 }
2217 
2218 
2219 template <class T>
2220 void TSubLattice<T>::moveSingleParticleTo(int particleId, const Vec3 &posn)
2221 {
2222  m_ppa->forParticle(particleId, (void (T::*)(Vec3))(&T::moveTo), posn);
2223 }
2224 
2229 template <class T>
2231 {
2232  console.Debug() << "TSubLattice<T>::moveSingleNode()\n";
2233  CVarMPIBuffer buffer(m_comm);
2234 
2235  buffer.receiveBroadcast(0); // get data from master
2236  string name=string(buffer.pop_string());
2237  int id=buffer.pop_int();
2238  Vec3 disp=buffer.pop_vector();
2239 
2240  console.XDebug() << "name :" << name << " id : " << id << " disp " << disp << "\n";
2241 
2242  map<string,TriMesh*>::iterator tm=m_mesh.find(name);
2243  if (tm!=m_mesh.end()){
2244  (tm->second)->moveNode(id,disp);
2245  } else {
2246  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(name);
2247  if(m2d!=m_mesh2d.end()){
2248  (m2d->second)->moveNode(id,disp);
2249  }
2250  }
2251  console.Debug() << "end TSubLattice<T>::moveSingleNode()\n";
2252 }
2253 
2258 template <class T>
2260 {
2261  console.Error() << "TSubLattice<T>::moveTaggedNodes() NOT IMPLEMENTED\n";
2262  throw
2263  std::runtime_error(
2264  "TSubLattice<T>::moveTaggedNodes() NOT IMPLEMENTED\n"
2265  );
2266 #if 0
2267  CVarMPIBuffer buffer(m_comm);
2268 
2269  buffer.receiveBroadcast(0); // get data from master
2270  string name=string(buffer.pop_string());
2271  int tag=buffer.pop_int();
2272  Vec3 disp=buffer.pop_vector();
2273 #endif
2274 }
2275 
2282 template <class T>
2283 void TSubLattice<T>::translateMeshBy(const std::string &meshName, const Vec3 &translation)
2284 {
2285  map<string,TriMesh*>::iterator tm=m_mesh.find(meshName);
2286  if (tm != m_mesh.end()){
2287  (tm->second)->translateBy(translation);
2288  }
2289  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(meshName);
2290  if(m2d!=m_mesh2d.end()){
2291  (m2d->second)->translateBy(translation);
2292  }
2293 }
2294 
2295 template <class T>
2296 std::pair<double, int> TSubLattice<T>::findParticleNearestTo(const Vec3 &pt)
2297 {
2298  console.Debug() << "TSubLattice<T>::findParticleNearestTo: enter\n";
2299  const T *pClosest = NULL;
2300  double minDistSqrd = std::numeric_limits<double>::max();
2301 
2302  typename ParticleArray::ParticleIterator it =
2303  m_ppa->getInnerParticleIterator();
2304  while (it.hasNext())
2305  {
2306  const T &p = it.next();
2307  const double distSqrd = (pt - p.getPos()).norm2();
2308  if (distSqrd < minDistSqrd)
2309  {
2310  minDistSqrd = distSqrd;
2311  pClosest = &p;
2312  }
2313  }
2314  console.Debug() << "TSubLattice<T>::findParticleNearestTo: exit\n";
2315  return
2316  (
2317  (pClosest != NULL)
2318  ?
2319  std::make_pair(sqrt(minDistSqrd), pClosest->getID())
2320  :
2321  std::make_pair(std::numeric_limits<double>::max(), -1)
2322  );
2323 }
2324 
2328 template <class T>
2329 std::pair<int, Vec3> TSubLattice<T>::getParticlePosn(int particleId)
2330 {
2331  const T *particle = NULL;
2332  typename ParticleArray::ParticleIterator it =
2333  m_ppa->getInnerParticleIterator();
2334  while (it.hasNext())
2335  {
2336  const T &p = it.next();
2337  if (p.getID() == particleId)
2338  {
2339  particle = &p;
2340  }
2341  }
2342  if (particle != NULL)
2343  {
2344  return std::make_pair(particleId, particle->getPos());
2345  }
2346  return std::make_pair(-1,Vec3::ZERO);
2347 }
2348 
2352 template <class T>
2353 void TSubLattice<T>::getParticleData(const IdVector &particleIdVector)
2354 {
2355  console.Debug()
2356  << "TSubLattice<T>::getParticleData: enter\n";
2357  typedef std::set<int> IdSet;
2358  typedef std::vector<T> ParticleVector;
2359 
2360  ParticleVector particleVector;
2361  typename ParticleArray::ParticleIterator it =
2362  m_ppa->getInnerParticleIterator();
2363  if (particleIdVector.size() > 0)
2364  {
2365  IdSet idSet(particleIdVector.begin(), particleIdVector.end());
2366  console.Debug()
2367  << "TSubLattice<T>::getParticleData: iterating over particles\n";
2368  while (it.hasNext())
2369  {
2370  const T &p = it.next();
2371  if (idSet.find(p.getID()) != idSet.end())
2372  {
2373  particleVector.push_back(p);
2374  }
2375  }
2376  }
2377  else
2378  {
2379  m_ppa->getAllInnerParticles(particleVector);
2380  }
2381  console.Debug()
2382  << "TSubLattice<T>::getParticleData:"
2383  << " sending particle data of size " << particleVector.size() << "\n";
2384  m_tml_comm.send_gather_packed(particleVector, 0);
2385  console.Debug()
2386  << "TSubLattice<T>::getParticleData: exit\n";
2387 }
2388 
2392 template <class T>
2394 {
2395  console.Debug() << "TSubLattice<T>::tagParticleNearestTo()\n";
2396  CVarMPIBuffer buffer(m_comm);
2397 
2398  buffer.receiveBroadcast(0); // get data from master
2399  int tag=buffer.pop_int();
2400  int mask=buffer.pop_int();
2401  Vec3 pos=buffer.pop_vector();
2402 
2403  // warning - this is ugly
2404  T* part_ptr=m_ppa->getParticlePtrByPosition(pos);
2405  if(part_ptr!=NULL){
2406  int old_tag=part_ptr->getTag();
2407  int new_tag=(old_tag & (~mask)) | (tag & mask);
2408  part_ptr->setTag(new_tag);
2409 
2410  cout << "pos, realpos: " << pos << " " << part_ptr->getPos() << " old tag, new tag " << old_tag << " " << part_ptr->getTag() << endl;
2411  }
2412  console.Debug() << "end TSubLattice<T>::tagParticleNearestTo()\n";
2413 }
2414 
2419 template <class T>
2421 {
2422  console.Debug() << "TSubLattice<T>::setParticleNonDynamic()\n";
2423  CVarMPIBuffer buffer(m_comm);
2424 
2425  buffer.receiveBroadcast(0); // get data from master
2426  int tag=buffer.pop_int();
2427  m_ppa->forParticleTag(tag,(void (T::*)())(&T::setNonDynamic));
2428  console.Debug() << "end TSubLattice<T>::setParticleNonDynamic()\n";
2429 }
2430 
2435 template <class T>
2437 {
2438  console.Debug() << "TSubLattice<T>::setParticleNonRot()\n";
2439  CVarMPIBuffer buffer(m_comm);
2440 
2441  buffer.receiveBroadcast(0); // get data from master
2442  int tag=buffer.pop_int();
2443  m_ppa->forParticleTag(tag,(void (T::*)())(&T::setNonDynamicRot));
2444  console.Debug() << "end TSubLattice<T>::setParticleNonRot()\n";
2445 }
2446 
2451 template <class T>
2453 {
2454  console.Debug() << "TSubLattice<T>::setParticleNonTrans()\n";
2455  CVarMPIBuffer buffer(m_comm);
2456 
2457  buffer.receiveBroadcast(0); // get data from master
2458  int tag=buffer.pop_int();
2459  m_ppa->forParticleTag(tag,(void (T::*)())(&T::setNonDynamicLinear));
2460  console.Debug() << "end TSubLattice<T>::setParticleNonTrans()\n";
2461 }
2462 
2466 template <class T>
2468 {
2469  console.Debug() << "TSubLattice<T>::setTaggedParticleVel()\n";
2470  CVarMPIBuffer buffer(m_comm);
2471 
2472  buffer.receiveBroadcast(0); // get data from master
2473  int tag=buffer.pop_int();
2474  Vec3 v=buffer.pop_vector();
2475  m_ppa->forParticleTag(tag,(void (T::*)(Vec3))(&T::setVel),v);
2476  console.XDebug() << "end TSubLattice<T>::setTaggedParticleVel()\n";
2477 }
2478 
2482 template <class T>
2484 {
2485  console.XDebug() << "TSubLattice<T>::moveWallBy()\n";
2486  CVarMPIBuffer buffer(m_comm);
2487 
2488  buffer.receiveBroadcast(0); // get data from master
2489  string wname=buffer.pop_string();
2490  Vec3 mv=buffer.pop_vector();
2491  typename map<string,CWall*>::iterator iter=m_walls.find(wname);
2492  if(iter!=m_walls.end())
2493  {
2494  (iter->second)->moveBy(mv);
2495  }
2496 }
2497 
2501 template <class T>
2503 {
2504  console.XDebug() << "TSubLattice<T>::moveSphereBodyBy()\n";
2505  CVarMPIBuffer buffer(m_comm);
2506 
2507  buffer.receiveBroadcast(0); // get data from master
2508  string wname=buffer.pop_string();
2509  Vec3 mv=buffer.pop_vector();
2510  typename map<string,CSphereBody*>::iterator iter=m_spheres.find(wname);
2511  if(iter!=m_spheres.end())
2512  {
2513  (iter->second)->moveBy(mv);
2514  }
2515 }
2516 
2520 template <class T>
2522 {
2523  console.XDebug() << "TSubLattice<T>::setWallNormal()\n";
2524  CVarMPIBuffer buffer(m_comm);
2525 
2526  buffer.receiveBroadcast(0); // get data from master
2527  string wname=buffer.pop_string();
2528  Vec3 wn=buffer.pop_vector();
2529  typename map<string,CWall*>::iterator iter=m_walls.find(wname);
2530  if(iter!=m_walls.end())
2531  {
2532  (iter->second)->setNormal(wn);
2533  }
2534 }
2535 
2539 template <class T>
2541 {
2542  console.XDebug() << "TSubLattice<T>::applyForceToWall()\n";
2543  CVarMPIBuffer buffer(m_comm);
2544 
2545  buffer.receiveBroadcast(0); // get data from master
2546  string wname=buffer.pop_string();
2547  Vec3 f=buffer.pop_vector();
2548  typename map<string,AWallInteractionGroup<T>*>::iterator iter=m_WIG.find(wname);
2549  if(iter!=m_WIG.end())
2550  {
2551  (iter->second)->applyForce(f);
2552  }
2553 }
2554 
2559 template <class T>
2561 {
2562  console.XDebug() << "TSubLattice<T>::setVelocityOfWall()\n";
2563  CVarMPIBuffer buffer(m_comm);
2564 
2565  buffer.receiveBroadcast(0); // get data from master
2566  string wname=buffer.pop_string();
2567  Vec3 v=buffer.pop_vector();
2568  typename map<string,AWallInteractionGroup<T>*>::iterator iter=m_WIG.find(wname);
2569  if(iter!=m_WIG.end())
2570  {
2571  (iter->second)->setVelocity(v);
2572  }
2573 }
2574 
2578 template <class T>
2580 {
2581  console.Debug() << "TSubLattice<T>::setParticleVelocity()\n";
2582  CVarMPIBuffer buffer(m_comm);
2583 
2584  buffer.receiveBroadcast(0); // get data from master
2585  int id=buffer.pop_int();
2586  Vec3 mv=buffer.pop_vector();
2587  m_ppa->forParticle(id,(void (T::*)(Vec3))(&T::setVel),mv);
2588  console.XDebug() << "end TSubLattice<T>::setParticleVelocity()\n";
2589 }
2590 
2594 template <class T>
2596 {
2597  console.Debug() << "TSubLattice<T>::setParticleDensity()\n";
2598  CVarMPIBuffer buffer(m_comm);
2599 
2600  buffer.receiveBroadcast(0); // get data from master
2601  int tag=buffer.pop_int();
2602  int mask=buffer.pop_int();
2603  double rho=buffer.pop_double();
2604  m_ppa->forParticleTagMask(tag,mask,(void (T::*)(double))(&T::setDensity),rho);
2605  console.XDebug() << "end TSubLattice<T>::setParticleVelocity()\n";
2606 }
2607 
2608 
2612 template <class T>
2614 {
2615  console.Debug() << "TSubLattice<T>::sendDataToMaster()\n";
2616  vector<Vec3> positions;
2617  vector<double> radii;
2618  vector<int> ids;
2619 
2620  m_ppa->forAllParticlesGet(positions,(Vec3 (T::*)() const)(&T::getPos));
2621  m_ppa->forAllParticlesGet(radii,(double (T::*)() const)(&T::getRad));
2622  m_ppa->forAllParticlesGet(ids,(int (T::*)() const)(&T::getID));
2623 
2624  m_tml_comm.send_gather(positions,0);
2625  m_tml_comm.send_gather(radii,0);
2626  m_tml_comm.send_gather(ids,0);
2627 
2628  console.Debug() << "end TSubLattice<T>::sendDataToMaster()\n";
2629 }
2630 
2634 template <class T>
2636 {
2637  console.Debug()<<"TSubLattice<T>::countParticles()\n";
2638  CMPIVarSGBufferLeaf buffer(m_comm,0);
2639  //-- pack particles into buffer
2640  buffer.append(m_ppa->size());
2641  // send
2642  buffer.send();
2643 }
2644 
2648 template <class T>
2650 {
2651  cout<< "My Rank : " << m_rank << "\n" ;
2652  if(m_ppa!=NULL)
2653  {
2654  cout << *m_ppa << endl;
2655  }
2656 }
2657 
2658 template <class T>
2660 {
2661  cout << "Data: my rank : " << m_rank << "particles : \n" ;
2662  m_ppa->forAllParticles((void (T::*)())(&T::print));
2663 }
2664 
2665 template <class T>
2667 {
2668  console.Debug() << "time spent calculating force : " << forcetime << " sec\n";
2669  console.Debug() << "time spent communicating : " << commtime << " sec\n";
2670  console.Debug() << "time spent packing : " << packtime << " sec\n";
2671  console.Debug() << "time spent unpacking : " << unpacktime << " sec\n";
2672 }
2673 
2674 //-------------- FIELD FUNCTIONS ----------------
2675 
2676 
2677 
2681 template <class T>
2683 {
2684  // cout << "TSubLattice<T>::addScalarParticleField\n";
2685  string fieldname;
2686  int id,is_tagged;
2687 
2688  m_tml_comm.recv_broadcast_cont(fieldname,0);
2689  //cout << "recvd. fieldname: " << fieldname << "\n";
2690  m_tml_comm.recv_broadcast(id,0);
2691  //cout << "recvd. id: " << id << "\n";
2692  m_tml_comm.recv_broadcast(is_tagged,0);
2693  //cout << "recvd. is_tagged: " << is_tagged << "\n";
2694 
2695  typename T::ScalarFieldFunction rdf=T::getScalarFieldFunction(fieldname);
2696  ScalarParticleFieldSlave<T> *new_spfs;
2697  if(is_tagged==0)
2698  {
2699  new_spfs=new ScalarParticleFieldSlave<T>(&m_tml_comm,m_ppa,rdf);
2700  }
2701  else
2702  {
2703  int tag,mask;
2704  m_tml_comm.recv_broadcast(tag,0);
2705  console.XDebug() << "recvd. tag: " << tag << "\n";
2706  m_tml_comm.recv_broadcast(mask,0);
2707  console.XDebug() << "recvd. mask: " << mask << "\n";
2708  new_spfs=new ScalarParticleFieldSlaveTagged<T>(&m_tml_comm,m_ppa,rdf,tag,mask);
2709  }
2710  m_field_slaves.insert(make_pair(id,new_spfs));
2711 }
2712 
2716 template <class T>
2718 {
2719  console.XDebug() << "TSubLattice<T>::addVectorParticleField\n";
2720  string fieldname;
2721  int id,is_tagged;
2722 
2723  m_tml_comm.recv_broadcast_cont(fieldname,0);
2724  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
2725  m_tml_comm.recv_broadcast(id,0);
2726  console.XDebug() << "recvd. id: " << id << "\n";
2727  m_tml_comm.recv_broadcast(is_tagged,0);
2728  console.XDebug() << "recvd. is_tagged: " << is_tagged << "\n";
2729 
2730  typename T::VectorFieldFunction rdf=T::getVectorFieldFunction(fieldname);
2731  VectorParticleFieldSlave<T> *new_vpfs;
2732  if(is_tagged==0)
2733  {
2734  new_vpfs=new VectorParticleFieldSlave<T>(&m_tml_comm,m_ppa,rdf);
2735  }
2736  else
2737  {
2738  int tag,mask;
2739  m_tml_comm.recv_broadcast(tag,0);
2740  console.XDebug() << "recvd. tag: " << tag << "\n";
2741  m_tml_comm.recv_broadcast(mask,0);
2742  console.XDebug() << "recvd. mask: " << mask << "\n";
2743  new_vpfs=new VectorParticleFieldSlaveTagged<T>(&m_tml_comm,m_ppa,rdf,tag,mask);
2744  }
2745  m_field_slaves.insert(make_pair(id,new_vpfs));
2746 
2747  console.Debug() << "end TSubLattice<T>::addVectorParticleField\n";
2748 }
2749 
2750 
2754 template <class T>
2756 {
2757  console.XDebug() << "TSubLattice<T>::addScalarInteractionField\n";
2758  string fieldname;
2759  string igname;
2760  string igtype;
2761  int id,is_tagged,tag,mask,is_checked;
2762 
2763  m_tml_comm.recv_broadcast_cont(fieldname,0);
2764  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
2765  m_tml_comm.recv_broadcast(id,0);
2766  console.XDebug() << "recvd. id: " << id << "\n";
2767  m_tml_comm.recv_broadcast_cont(igname,0);
2768  console.XDebug() << "recvd. interaction group name: " << igname << "\n";
2769  m_tml_comm.recv_broadcast_cont(igtype,0);
2770  console.XDebug() << "recvd. interaction group name: " << igtype << "\n";
2771  m_tml_comm.recv_broadcast(is_tagged,0);
2772  console.XDebug() << "recvd. is_tagged: " << is_tagged << "\n";
2773 
2774  // get interaction group
2775  map<string,AParallelInteractionStorage*>::iterator it=m_dpis.find(igname);
2776  if(is_tagged==1)
2777  {
2778  m_tml_comm.recv_broadcast(tag,0);
2779  m_tml_comm.recv_broadcast(mask,0);
2780  }
2781  m_tml_comm.recv_broadcast(is_checked,0);
2782  console.XDebug() << "recvd. is_checked: " << is_checked << "\n";
2783 
2784  if(it!=m_dpis.end())
2785  {
2786  console.XDebug() << "found interaction group in dynamic\n";
2787  AFieldSlave* new_sifs;
2788  new_sifs=(it->second)->generateNewScalarFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2789  m_field_slaves.insert(make_pair(id,new_sifs));
2790  }
2791  else
2792  {
2793  it=m_bpis.find(igname);
2794  if(it!=m_bpis.end()){
2795  console.XDebug() << "found interaction group in bonded\n";
2796  AFieldSlave* new_sifs;
2797  new_sifs=(it->second)->generateNewScalarFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2798  m_field_slaves.insert(make_pair(id,new_sifs));
2799  }
2800  else // not in dynamic or bonded -> try damping
2801  {
2802  //typename map<string,CDampingGroup<T>*>::iterator it2=m_damping.find(igname);
2803  it=m_damping.find(igname);
2804  if(it!=m_damping.end()) // found it in damping
2805  {
2806  AFieldSlave* new_sifs;
2807  new_sifs=(it->second)->generateNewScalarFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2808  m_field_slaves.insert(make_pair(id,new_sifs));
2809  }
2810  else // still not found -> unknown name -> error
2811  {
2812  cerr << "ERROR : unknown interaction group name in addScalarInteractionField " << endl;
2813  }
2814  }
2815  }
2816 
2817  console.XDebug() << "end TSubLattice<T>::addScalarInteractionField\n";
2818 }
2819 
2823 template <class T>
2825 {
2826  console.Debug() << "TSubLattice<T>::addVectorInteractionField\n";
2827  string fieldname;
2828  string igname;
2829  string igtype;
2830  int id,is_tagged,tag,mask,is_checked;
2831 
2832  m_tml_comm.recv_broadcast_cont(fieldname,0);
2833  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
2834  m_tml_comm.recv_broadcast(id,0);
2835  console.XDebug() << "recvd. id: " << id << "\n";
2836  m_tml_comm.recv_broadcast_cont(igname,0);
2837  console.XDebug() << "recvd. interaction group name: " << igname << "\n";
2838  m_tml_comm.recv_broadcast_cont(igtype,0);
2839  console.XDebug() << "recvd. interaction group type: " << igtype << "\n";
2840  m_tml_comm.recv_broadcast(is_tagged,0);
2841  console.XDebug() << "recvd. is_tagged: " << is_tagged << "\n";
2842 
2843  // get interaction group
2844  map<string,AParallelInteractionStorage*>::iterator it=m_dpis.find(igname);
2845  if(is_tagged==1)
2846  {
2847  m_tml_comm.recv_broadcast(tag,0);
2848  m_tml_comm.recv_broadcast(mask,0);
2849  }
2850  m_tml_comm.recv_broadcast(is_checked,0);
2851  console.XDebug() << "recvd. is_checked: " << is_checked << "\n";
2852 
2853  if(it!=m_dpis.end())
2854  {
2855  console.XDebug() << "found interaction group in dynamic\n";
2856  AFieldSlave* new_sifs;
2857  new_sifs=(it->second)->generateNewVectorFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2858  if(new_sifs!=NULL){
2859  m_field_slaves.insert(make_pair(id,new_sifs));
2860  } else {
2861  console.Error()<<"ERROR: could not generate Field Slave for field " << fieldname << "\n";
2862  }
2863  }
2864  else
2865  {
2866  it=m_bpis.find(igname);
2867  if(it!=m_bpis.end()){
2868  console.XDebug() << "found interaction group in bonded\n";
2869  AFieldSlave* new_sifs;
2870  new_sifs=(it->second)->generateNewVectorFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2871  m_field_slaves.insert(make_pair(id,new_sifs));
2872  }
2873  else // not in dynamic or bonded -> try damping
2874  {
2875  //typename map<string,CDampingGroup<T>*>::iterator it2=m_damping.find(igname);
2876  it=m_damping.find(igname);
2877  if(it!=m_damping.end()) // found it in damping
2878  {
2879  AFieldSlave* new_sifs;
2880  new_sifs=(it->second)->generateNewVectorFieldSlave(&m_tml_comm,fieldname,is_checked,is_tagged,tag,mask);
2881  m_field_slaves.insert(make_pair(id,new_sifs));
2882  }
2883  else // still not found -> unknown name -> error
2884  {
2885  cerr << "ERROR : unknown interaction group name in addScalarInteractionField " << endl;
2886  }
2887  }
2888  }
2889 
2890  console.Debug() << "end TSubLattice<T>::addVectorInteractionField\n";
2891 }
2892 
2896 template <class T>
2898 {
2899  console.XDebug() << "TSubLattice<T>::addScalarHistoryInteractionField\n";
2900  string fieldname;
2901  string igname;
2902  string igtype;
2903  int id,is_tagged,tag,mask,is_checked;
2904 
2905  m_tml_comm.recv_broadcast_cont(fieldname,0);
2906  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
2907  m_tml_comm.recv_broadcast(id,0);
2908  console.XDebug() << "recvd. id: " << id << "\n";
2909  m_tml_comm.recv_broadcast_cont(igname,0);
2910  console.XDebug() << "recvd. interaction group name: " << igname << "\n";
2911  m_tml_comm.recv_broadcast_cont(igtype,0);
2912  console.XDebug() << "recvd. interaction group name: " << igtype << "\n";
2913  m_tml_comm.recv_broadcast(is_tagged,0);
2914  console.XDebug() << "recvd. is_tagged: " << is_tagged << "\n";
2915 
2916  if(is_tagged==1)
2917  {
2918  m_tml_comm.recv_broadcast(tag,0);
2919  m_tml_comm.recv_broadcast(mask,0);
2920  }
2921  m_tml_comm.recv_broadcast(is_checked,0);
2922  console.XDebug() << "recvd. is_checked: " << is_checked << "\n";
2923 
2924  // get interaction group
2925  map<string,AParallelInteractionStorage*>::iterator it=m_bpis.find(igname);
2926  if(it!=m_bpis.end()){
2927  console.XDebug() << "found interaction group in bonded\n";
2928  AFieldSlave* new_sifs;
2929  new_sifs=(it->second)->generateNewScalarHistoryFieldSlave(&m_tml_comm,fieldname,is_tagged,tag,mask);
2930  if(new_sifs!=NULL){
2931  m_field_slaves.insert(make_pair(id,new_sifs));
2932  }
2933  } else { // not in dynamic or bonded -> throw error
2934  cerr << "ERROR : unknown interaction group name in addScalarHistoryInteractionField " << endl;
2935  }
2936 
2937  console.XDebug() << "end TSubLattice<T>::addScalarHistoryInteractionField\n";
2938 }
2939 
2940 
2945 template <class T>
2947 {
2948  console.Debug() << "TSubLattice<T>::addVectorTriangleField()\n";
2949  string fieldname;
2950  string meshname;
2951  int id;
2952 
2953  // receive params
2954  m_tml_comm.recv_broadcast_cont(fieldname,0);
2955  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
2956  m_tml_comm.recv_broadcast_cont(meshname,0);
2957  console.XDebug() << "recvd. meshname: " << meshname << "\n";
2958  m_tml_comm.recv_broadcast(id,0);
2959  console.XDebug() << "recvd. id: " << id << "\n";
2960 
2961  map<string,TriMesh*>::iterator tm=m_mesh.find(meshname);
2962  // if meshname is in trimesh map
2963  if (tm!=m_mesh.end()){
2964  // get reader function
2966  // check it
2967  if(rdf==NULL){
2968  console.Critical() << "NULL rdf !!!\n";
2969  }
2970  VectorTriangleFieldSlave* new_vfs=new VectorTriangleFieldSlave(&m_tml_comm,tm->second,rdf);
2971  m_field_slaves.insert(make_pair(id,new_vfs));
2972  } else {
2973  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(meshname);
2974  if(m2d!=m_mesh2d.end()){
2976  // check it
2977  if(rdf==NULL){
2978  console.Critical() << "NULL rdf !!!\n";
2979  }
2980  VectorEdge2DFieldSlave* new_efs= new VectorEdge2DFieldSlave(&m_tml_comm,m2d->second,rdf);
2981  m_field_slaves.insert(make_pair(id,new_efs));
2982  }
2983  }
2984  console.Debug() << "end TSubLattice<T>::addVectorTriangleField()\n";
2985 }
2986 
2990 template <class T>
2992 {
2993  console.Debug() << "TSubLattice<T>::addScalarTriangleField()\n";
2994  string fieldname;
2995  string meshname;
2996  int id;
2997 
2998  // receive params
2999  m_tml_comm.recv_broadcast_cont(fieldname,0);
3000  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
3001  m_tml_comm.recv_broadcast_cont(meshname,0);
3002  console.XDebug() << "recvd. meshname: " << meshname << "\n";
3003  m_tml_comm.recv_broadcast(id,0);
3004  console.XDebug() << "recvd. id: " << id << "\n";
3005 
3006  // get reader function
3008  // check it
3009  if(rdf==NULL){
3010  console.Critical() << "NULL rdf !!!\n";
3011  }
3012  ScalarTriangleFieldSlave* new_vtfs=new ScalarTriangleFieldSlave(&m_tml_comm,m_mesh[meshname],rdf);
3013  m_field_slaves.insert(make_pair(id,new_vtfs));
3014  console.Debug() << "end TSubLattice<T>::addScalarTriangleField()\n";
3015 }
3016 
3020 template <class T>
3022 {
3023  console.XDebug() << "begin TSubLattice<T>::addVectorWallField()\n";
3024  string fieldname;
3025  string tmp_wallname;
3026  vector<string> wallnames;
3027  int nwall;
3028  int id;
3029 
3030  // receive params
3031  m_tml_comm.recv_broadcast_cont(fieldname,0);
3032  console.XDebug() << "recvd. fieldname: " << fieldname << "\n";
3033  m_tml_comm.recv_broadcast(nwall,0);
3034  console.XDebug() << "recvd. nwall: " << nwall << "\n";
3035  for(int i=0;i<nwall;i++){
3036  m_tml_comm.recv_broadcast_cont(tmp_wallname,0);
3037  wallnames.push_back(tmp_wallname);
3038  console.XDebug() << "recvd. wallname: " << tmp_wallname << "\n";
3039  tmp_wallname.clear();
3040  }
3041  m_tml_comm.recv_broadcast(id,0);
3042  console.XDebug() << "recvd. id: " << id << "\n";
3043 
3044  // check validity of 1st wall name
3045  map<string,CWall*>::iterator cwalliter=m_walls.find(*(wallnames.begin()));
3046  if(cwalliter==m_walls.end()){ // 1st wall name invalid -> exit
3047  std::stringstream msg;
3048  msg
3049  << "ERROR in addVectorWallField: wallname '"
3050  << *(wallnames.begin()) << " 'invalid. Valid wall names: ";
3051  for (map<string,CWall*>::const_iterator it = m_walls.begin(); it != m_walls.end(); it++)
3052  {
3053  msg << "'" << it->first << "' ";
3054  }
3055  console.Error() << msg.str() << "\n";
3056  throw std::runtime_error(msg.str());
3057  } else { // first wall valid -> try to get slave
3058  // get summation flag from wall
3059  int sumflag=(cwalliter->second)->getFieldSummationFlag(fieldname);
3060  // if process 1, send summation flag back to master
3061  if(m_tml_comm.rank()==1){
3062  m_tml_comm.send(sumflag,0);
3063  }
3064  m_tml_comm.barrier();
3065 
3066  //field slave
3067  AWallFieldSlave* new_fs=(cwalliter->second)->generateVectorFieldSlave(&m_tml_comm,fieldname);
3068 
3069  // try to insert other walls
3070  vector<string>::iterator niter=wallnames.begin();
3071  if(niter!=wallnames.end()) niter++ ; // jump past 1st wall - already got it
3072  while(niter!=wallnames.end()){
3073  string wname=*niter;
3074  map<string,CWall*>::iterator iter=m_walls.find(wname);
3075  if(iter==m_walls.end()){ // wall name invalid -> exit
3076  std::stringstream msg;
3077  msg
3078  << "ERROR in addVectorWallField: wallname '"
3079  << wname << " 'invalid";
3080  for (map<string,CWall*>::const_iterator it = m_walls.begin(); it != m_walls.end(); it++)
3081  {
3082  msg << "'" << it->first << "' ";
3083  }
3084 
3085  console.Error() << msg.str() << "\n";
3086  throw std::runtime_error(msg.str());
3087  } else {
3088  new_fs->addWall(iter->second);
3089  }
3090  niter++;
3091  }
3092  if(new_fs!=NULL){
3093  m_field_slaves.insert(make_pair(id,new_fs));
3094  } else {
3095  console.Error() << "ERROR in addVectorWallField: got NULL Slave\n";
3096  }
3097  }
3098 
3099  console.XDebug() << "end TSubLattice<T>::addVectorWallField()\n";
3100 }
3101 
3105 template <class T>
3107 {
3108  console.Debug() << "TSubLattice<T>::sendFieldData()\n";
3109  // receive id's of field to send
3110  int id;
3111  m_tml_comm.recv_broadcast(id,0);
3112  console.Debug() << "received field id " << id << " for data collection\n" ;
3113  if(m_field_slaves[id] != NULL)
3114  {
3115  m_field_slaves[id]->sendData();
3116  }
3117  else
3118  { // can not happen
3119  cerr << "NULL pointer in m_field_slaves!" << endl;
3120  }
3121  // call the sending function of the field
3122  console.Debug() << "end TSubLattice<T>::sendFieldData()\n";
3123 }
3124 
3125 
3126 // ---- Checkpointing ----------
3130 template <class T>
3131 void TSubLattice<T>::saveSnapShotData(std::ostream &oStream)
3132 {
3133  // get precision of output stream and set it to 9 significant digits
3134  std::streamsize oldprec=oStream.precision(9);
3135 
3136  //
3137  // Save particle check-point data
3138  //
3139  ParticleArray &particleArray = dynamic_cast<ParticleArray &>(*m_ppa);
3141  particleIt(particleArray.getInnerParticleIterator());
3142 
3143  const std::string delim = "\n";
3144 
3145  oStream << particleIt.getNumRemaining() << delim;
3146  while (particleIt.hasNext()) {
3147  particleIt.next().saveSnapShotData(oStream);
3148  oStream << delim;
3149  }
3150 
3151  //
3152  // Save Bonded interaction check-point data.
3153  //
3154  typedef std::map<string,AParallelInteractionStorage*> NameBondedInteractionsMap;
3155  typename NameBondedInteractionsMap::iterator it;
3156  oStream << m_bpis.size() << delim;
3157  for (it = m_bpis.begin(); it != m_bpis.end(); it++) {
3158  it->second->saveSnapShotData(oStream);
3159  oStream << delim;
3160  }
3161 
3162  // dump trimeshdata (if exists)
3163  oStream << "TMIG " << m_mesh.size() << delim;
3164  for(typename map<string,TriMesh*>::iterator tm_iter=m_mesh.begin();
3165  tm_iter!=m_mesh.end();
3166  tm_iter++){
3167  oStream << tm_iter->first << delim;
3168  tm_iter->second->writeCheckPoint(oStream,delim);
3169  }
3170 
3171  // restore output stream to old precision
3172  oStream.precision(oldprec);
3173 }
3174 
3178 template <class T>
3179 void TSubLattice<T>::saveCheckPointData(std::ostream &oStream)
3180 {
3181  const std::string delim = "\n";
3182  //
3183  // Save particle check-point data
3184  //
3185  m_ppa->saveCheckPointData(oStream);
3186 
3187  //
3188  // Save Bonded interaction check-point data.
3189  //
3190  typedef std::map<string,AParallelInteractionStorage*> NameBondedInteractionsMap;
3191  typename NameBondedInteractionsMap::iterator it;
3192  oStream << m_bpis.size() << delim;
3193  for (it = m_bpis.begin(); it != m_bpis.end(); it++) {
3194  it->second->saveCheckPointData(oStream);
3195  oStream << delim;
3196  }
3197 
3198  //
3199  // Save Non-bonded interaction check-point data
3200  //
3201  int count_save=0;
3202  for(std::map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
3203  iter!=m_dpis.end();
3204  iter++){
3205  if(iter->second->willSave()) count_save++;
3206  }
3207  oStream << count_save << delim;
3208  for(std::map<string,AParallelInteractionStorage*>::iterator iter=m_dpis.begin();
3209  iter!=m_dpis.end();
3210  iter++){
3211  if(iter->second->willSave()) {
3212  iter->second->saveCheckPointData(oStream);
3213  oStream << delim;
3214  }
3215  }
3216 
3217  // Save walls (name, pos, normal)
3218  oStream << "Walls " << m_walls.size() << delim;
3219  for(map<string,CWall*>::iterator w_iter=m_walls.begin();
3220  w_iter!=m_walls.end();
3221  w_iter++){
3222  oStream << w_iter->first << delim;
3223  w_iter->second->writeCheckPoint(oStream,delim);
3224  }
3225 
3226  // Save sphere bodies (name, pos, radius)
3227  oStream << "Spheres " << m_spheres.size() << delim;
3228  for(map<string,CSphereBody*>::iterator w_iter=m_spheres.begin();
3229  w_iter!=m_spheres.end();
3230  w_iter++){
3231  oStream << w_iter->first << delim;
3232  w_iter->second->writeCheckPoint(oStream,delim);
3233  }
3234 
3235  // dump trimeshdata (if exists)
3236  oStream << "TriMesh " << m_mesh.size() << delim;
3237  for(typename map<string,TriMesh*>::iterator tm_iter=m_mesh.begin();
3238  tm_iter!=m_mesh.end();
3239  tm_iter++){
3240  oStream << tm_iter->first << delim;
3241  tm_iter->second->writeCheckPoint(oStream,delim);
3242  }
3243  // dump 2D mesh data (if exists)
3244  oStream << "Mesh2D " << m_mesh2d.size() << delim;
3245  for(typename map<string,Mesh2D*>::iterator tm_iter=m_mesh2d.begin();
3246  tm_iter!=m_mesh2d.end();
3247  tm_iter++){
3248  oStream << tm_iter->first << delim;
3249  tm_iter->second->writeCheckPoint(oStream,delim);
3250  }
3251 }
3252 
3253 template <class T>
3254 void TSubLattice<T>::loadCheckPointData(std::istream &iStream)
3255 {
3256  // get particles
3257  m_ppa->loadCheckPointData(iStream);
3258 
3259  // rebuild neighbor table
3260  CMPIBarrier barrier(getWorkerComm());
3261  m_ppa->rebuild();
3262  barrier.wait("PPA rebuild");
3263 
3264  //-- get bonds --
3265  // get nr. of bonded interaction group in the checkpoint file
3266  unsigned int nr_bonded_ig;
3267  iStream >> nr_bonded_ig;
3268 
3269  // compare with existing bonded particle interaction storage (bpis)
3270  // barf if not equal
3271  if(nr_bonded_ig!=m_bpis.size()){
3272  std::cerr << "number of bonded interaction groups differ between snapshot and script!" << std::endl;
3273  } else { // numbers fit -> read data
3274  for (map<string,AParallelInteractionStorage*>::iterator it = m_bpis.begin();
3275  it != m_bpis.end();
3276  it++) { // for all interaction groups
3277  it->second->loadCheckPointData(iStream);
3278  }
3279  }
3280  //-- get nonbonded interactions --
3281  // get nr. of non-bonded interaction group in the checkpoint file
3282  unsigned int nr_nonbonded_ig;
3283  iStream >> nr_nonbonded_ig;
3284 
3285  // compare with existing non-bonded (dynamic) particle interaction storage (dpis)
3286  // barf if not equal
3287  if(nr_nonbonded_ig!=m_dpis.size()){
3288  std::cerr << "number of dynamic interaction groups differ between snapshot and script!" << std::endl;
3289  } else { // numbers fit -> read data
3290  for (map<string,AParallelInteractionStorage*>::iterator it = m_dpis.begin();
3291  it != m_dpis.end();
3292  it++) { // for all interaction groups
3293  it->second->loadCheckPointData(iStream);
3294  }
3295  }
3296  //--- load walls ---
3297  string token;
3298  iStream >> token;
3299  if(token!="Walls") { // found wrong token -> barf
3300  std::cerr << "expected Walls , got " << token << std::endl;
3301  }
3302  // nr. of walls
3303  int nwalls;
3304  iStream >> nwalls;
3305  // read wall names & data
3306  string wname;
3307  for(int i=0;i<nwalls;i++){
3308  CWall* new_wall = new CWall();
3309  iStream >> wname;
3310  new_wall->loadCheckPoint(iStream);
3311  m_walls[wname]=new_wall;
3312  }
3313 
3314  iStream >> token;
3315  if(token!="Spheres") { // found wrong token -> barf
3316  std::cerr << "expected Spheres , got " << token << std::endl;
3317  }
3318 
3319  // nr. of sphere bodies
3320  int nspheres;
3321  iStream >> nspheres;
3322  // read sphere body names & data
3323  string sname;
3324  for(int i=0;i<nspheres;i++){
3325  CSphereBody* new_sphere = new CSphereBody();
3326  iStream >> sname;
3327  new_sphere->loadCheckPoint(iStream);
3328  m_spheres[sname]=new_sphere;
3329  }
3330  // --- load meshes --
3331  int nmesh;
3332  string mname;
3333  // Trimesh (3D)
3334  iStream >> token;
3335  if(token!="TriMesh") { // found wrong token -> barf
3336  std::cerr << "expected TriMesh , got " << token << std::endl;
3337  }
3338  // nr. of meshes
3339  iStream >> nmesh;
3340  // read wall names & data
3341  for(int i=0;i<nmesh;i++){
3342  TriMesh* new_tm=new TriMesh();
3343  iStream >> mname;
3344  new_tm->loadCheckPoint(iStream);
3345  m_mesh.insert(make_pair(mname,new_tm));
3346  }
3347  // Mesh2D
3348  iStream >> token;
3349  if(token!="Mesh2D") { // found wrong token -> barf
3350  std::cerr << "expected Mesh2D , got " << token << std::endl;
3351  }
3352  // nr. of meshes
3353  iStream >> nmesh;
3354  // read wall names & data
3355  for(int i=0;i<nmesh;i++){
3356  Mesh2D* new_m2d=new Mesh2D();
3357  iStream >> mname;
3358  new_m2d->loadCheckPoint(iStream);
3359  m_mesh2d.insert(make_pair(mname,new_m2d));
3360  }
3361 }
3362 
3363 // -- mesh data exchange functions --
3364 
3368 template <class T>
3370 {
3371  console.XDebug() << "TSubLattice<T>::getMeshNodeRef()\n";
3372  vector<int> ref_vec;
3373 
3374  // MPI buffer
3375  CVarMPIBuffer param_buffer(m_comm);
3376  // receive mesh name
3377  param_buffer.receiveBroadcast(0);
3378  string meshname=param_buffer.pop_string();
3379  console.XDebug() << "Mesh name: " << meshname << "\n";
3380 
3381  // find mesh & collect node ids into array
3382  map<string,TriMesh*>::iterator tm=m_mesh.find(meshname);
3383  if (tm!=m_mesh.end()){
3384  for(TriMesh::corner_iterator iter=(tm->second)->corners_begin();
3385  iter!=(tm->second)->corners_end();
3386  iter++){
3387  ref_vec.push_back(iter->getID());
3388  }
3389  } else {
3390  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(meshname);
3391  if(m2d!=m_mesh2d.end()){
3392  for(Mesh2D::corner_iterator iter=(m2d->second)->corners_begin();
3393  iter!=(m2d->second)->corners_end();
3394  iter++){
3395  ref_vec.push_back(iter->getID());
3396  }
3397  } else {
3398  console.Critical() << "ERROR - WRONG MESH NAME IN getMeshNodeRef() !! \n";
3399  }
3400  }
3401  // send back to master
3402  m_tml_comm.send_gather(ref_vec,0);
3403 
3404  console.XDebug() << "end TSubLattice<T>::getMeshNodeRef()\n";
3405 }
3406 
3410 template <class T>
3412 {
3413  console.XDebug() << "TSubLattice<T>::getMeshFaceRef()\n";
3414  vector<int> ref_vec;
3415 
3416  // MPI buffer
3417  CVarMPIBuffer param_buffer(m_comm);
3418  // receive mesh name
3419  param_buffer.receiveBroadcast(0);
3420  string meshname=param_buffer.pop_string();
3421  console.XDebug() << "Mesh name: " << meshname << "\n";
3422 
3423  // find mesh & collect node ids into array
3424  map<string,TriMesh*>::iterator tm=m_mesh.find(meshname);
3425  if (tm!=m_mesh.end()){
3426  for(TriMesh::triangle_iterator iter=(tm->second)->triangles_begin();
3427  iter!=(tm->second)->triangles_end();
3428  iter++){
3429  ref_vec.push_back(iter->getID());
3430  }
3431  } else {
3432  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(meshname);
3433  if(m2d!=m_mesh2d.end()){
3434  for(Mesh2D::edge_iterator iter=(m2d->second)->edges_begin();
3435  iter!=(m2d->second)->edges_end();
3436  iter++){
3437  ref_vec.push_back(iter->getID());
3438  }
3439  } else {
3440  console.Critical() << "ERROR - WRONG MESH NAME IN getMeshNodeRef() !! \n";
3441  }
3442  }
3443  // send back to master
3444  m_tml_comm.send_gather(ref_vec,0);
3445 
3446  console.XDebug() << "end TSubLattice<T>::getMeshNodeRef()\n";
3447 }
3448 
3452 template <class T>
3454 {
3455  console.XDebug() << "TSubLattice<T>::getMesh2DStress()\n";
3456  // receive mesh name
3457  // MPI buffer
3458  CVarMPIBuffer param_buffer(m_comm);
3459  param_buffer.receiveBroadcast(0);
3460  string meshname=param_buffer.pop_string();
3461  console.XDebug() << "Mesh name: " << meshname << "\n";
3462 
3463  // find mesh & collect data
3464  map<string,Mesh2D*>::iterator m2d=m_mesh2d.find(meshname);
3465  if(m2d!=m_mesh2d.end()){
3466  vector<pair<int,Vec3> > data_vec;
3467  // get data
3468  data_vec=(m2d->second)->forAllEdgesGetIndexed(&Edge2D::getForceDensity);
3469 
3470  // send data to master
3471  m_tml_comm.send_gather(data_vec,0);
3472  } else {
3473  console.Critical() << "ERROR - WRONG MESH NAME IN getMesh2DStress() !! \n";
3474  }
3475 
3476  console.XDebug() << "end TSubLattice<T>::getMesh2DStress()\n";
3477 }
3478 
3482 template <class T>
3484 {
3485  console.XDebug() << "TSubLattice<T>::getTriMeshStress(): enter\n";
3486  // receive mesh name
3487  // MPI buffers
3488  CVarMPIBuffer param_buffer(m_comm);
3489  param_buffer.receiveBroadcast(0);
3490  const std::string meshName = param_buffer.pop_string();
3491  console.XDebug() << "Mesh name: " << meshName << "\n";
3492 
3493  // find mesh & collect data
3494  map<string,TriMesh*>::iterator m=m_mesh.find(meshName);
3495  if(m != m_mesh.end()){
3496  vector<pair<int,Vec3> > data_vec;
3497  // get data
3498  data_vec=(m->second)->forAllTrianglesGetIndexed(&Triangle::getForce);
3499 
3500  // send data to master
3501  m_tml_comm.send_gather(data_vec,0);
3502  } else {
3503  std::stringstream msg;
3504  msg << "Invalid mesh name: " << meshName << ". No such triangular mesh.";
3505  throw std::runtime_error(msg.str().c_str());
3506  }
3507 
3508  console.XDebug() << "TSubLattice<T>::getTriMeshStress(): exit\n";
3509 }
TSubLattice::doAddDamping
virtual bool doAddDamping(const string &, CVarMPIBuffer &)
Definition: SubLattice.hpp:1417
CWall
base class for all walls
Definition: Wall.h:40
Triangle::getVectorFieldFunction
static VectorFieldFunction getVectorFieldFunction(const string &)
Definition: Triangle.cpp:276
CCappedBondedIGP
Interaction parameters for bonded interaction with a force limit.
Definition: CappedBondedInteraction.h:41
ABCDampingIGP.h
TSubLattice::addDirBondedWIG
virtual void addDirBondedWIG()
Definition: SubLattice.hpp:561
RotFricInteraction.h
TSubLattice::tagParticleNearestTo
virtual void tagParticleNearestTo()
Definition: SubLattice.hpp:2393
FractalFrictionIGP::k_s
double k_s
Definition: FractalFriction.h:37
TSubLattice::addScalarTriangleField
virtual void addScalarTriangleField()
Definition: SubLattice.hpp:2991
TSubLattice::addVectorWallField
virtual void addVectorWallField()
Definition: SubLattice.hpp:3021
BTriMeshInteraction.h
TSubLattice::getWallPos
virtual void getWallPos()
Definition: SubLattice.hpp:589
CVarMPIBuffer::pop_int
virtual int pop_int()
Definition: mpivbuf.cpp:196
Edge2D::getForceDensity
Vec3 getForceDensity() const
Definition: Edge2D.h:70
HertzianViscoElasticFrictionInteraction.h
pi_storage_ed.h
TSubLattice::moveParticleTo
virtual void moveParticleTo()
Definition: SubLattice.hpp:2189
Console::Info
Console & Info()
set verbose level of next message to "inf"
VWFrictionIGP::m_alpha
double m_alpha
Definition: VWFrictionInteraction.h:25
HertzianViscoElasticInteraction.h
CViscWallIG
Class for a group of viscous and elastic interactions between particles and a wall.
Definition: ViscWallIG.h:60
Mesh2D::corner_iterator
vector< Corner2D >::iterator corner_iterator
Definition: Mesh2D.h:58
CLinearDashpotIGP
Interaction group parameters for Linear Dashpot interactions.
Definition: LinearDashpotInteraction.h:25
extractEWallIGP
CEWallIGP * extractEWallIGP(AMPIBuffer *)
Definition: EWallInteractionGroup.cpp:53
ParallelParticleArray::ParticleIterator
Definition: pp_array.h:144
VectorEdge2DFieldSlave.h
TSubLattice::findParticleNearestTo
std::pair< double, int > findParticleNearestTo(const Vec3 &pt)
Definition: SubLattice.hpp:2296
TSubLattice::TSubLattice
TSubLattice(const esys::lsm::CLatticeParam &prm, int rank, MPI_Comm comm, MPI_Comm worker_comm)
Definition: SubLattice.hpp:113
CLinearDashpotIGP::m_damp
double m_damp
Definition: LinearDashpotInteraction.h:27
TSubLattice::addScalarInteractionField
virtual void addScalarInteractionField()
Definition: SubLattice.hpp:2755
CRotFrictionIGP
Interaction parameters for frictional interaction between rotational particles.
Definition: RotFricInteraction.h:38
TriMesh_PIS_NE
Class for parallel storage of interactions between a triangle mesh and particles which doesn't requir...
Definition: trimesh_pis_ne.h:31
CHertzianViscoElasticIGP
Interaction group parameters for Hertzian viscoelastic interactions.
Definition: HertzianViscoElasticInteraction.h:25
esys::lsm::BuoyancyIGP
Definition: BodyForceGroup.h:68
TSubLattice::printTimes
virtual void printTimes()
Definition: SubLattice.hpp:2666
pi_storage_ne_t.h
CRotThermElasticIGP
Definition: RotThermElasticInteraction.h:24
TSubLattice::moveSingleParticleTo
virtual void moveSingleParticleTo(int particleId, const Vec3 &posn)
Definition: SubLattice.hpp:2220
CHertzMindlinViscoIGP::m_E
double m_E
Definition: HertzMindlinViscoInteraction.h:48
CVarMPIBuffer
MPI send/recv buffer with automagically adjusted size.
Definition: mpivbuf.h:35
ScalarInteractionFieldSlaveTagged.h
CRotFrictionIGP::k
double k
Definition: RotFricInteraction.h:72
esys::lsm::BodyForceIGP
Definition: BodyForceGroup.h:27
TSubLattice::addSingleIG
virtual void addSingleIG()
Definition: SubLattice.hpp:1344
CRotThermFrictionIGP::k_s
double k_s
Definition: RotThermFricInteraction.h:51
trimesh_pis.h
ETriMeshIP
Definition: ETriMeshIP.h:18
TML_Comm::setComm
void setComm(MPI_Comm)
Definition: comm.cpp:43
CHertzianViscoElasticIGP::m_nu
double m_nu
Definition: HertzianViscoElasticInteraction.h:29
TSubLattice::setParticleNonTrans
virtual void setParticleNonTrans()
Definition: SubLattice.hpp:2452
TSubLattice::getNumParticles
virtual int getNumParticles()
Definition: SubLattice.hpp:243
esys::lsm::CLatticeParam::alpha
double alpha() const
Definition: LatticeParam.h:43
CFrictionIGP
Interaction parameters for frictional interaction.
Definition: FrictionInteraction.h:28
CAdhesiveFrictionIGP::r_cut
double r_cut
Definition: AdhesiveFriction.h:35
Console::Debug
Console & Debug()
set verbose level of next message to "dbg"
mesh2d_pis_eb.h
mpibarrier.h
esys::lsm::BodyForceIGP::extract
static BodyForceIGP extract(CVarMPIBuffer *pBuffer)
Definition: BodyForceGroup.cpp:52
TSubLattice::m_tml_comm
TML_Comm m_tml_comm
Definition: SubLattice.h:108
CRotThermElasticIGP::diffusivity
double diffusivity
Definition: RotThermElasticInteraction.h:36
CLinearDashpotIGP::m_cutoff
double m_cutoff
Definition: LinearDashpotInteraction.h:28
CRotFrictionIGP::mu_s
double mu_s
Definition: RotFricInteraction.h:74
VectorTriangleFieldSlave
Slave part for saving a vector field defined on the triangles in a given TriMesh.
Definition: VectorTriangleFieldSlave.h:36
ScalarParticleFieldSlaveTagged
class for slave part of scalar field defined on tagged particles
Definition: ScalarParticleFieldSlaveTagged.h:33
TSubLattice::commtime
double commtime
Definition: SubLattice.h:121
pi_storage_eb.h
TSubLattice::resetDisplacements
void resetDisplacements()
Definition: SubLattice.hpp:2172
CRotThermFrictionIGP::mu_s
double mu_s
Definition: RotThermFricInteraction.h:50
FrictionInteraction.h
CBWallInteractionGroup
Class for a group of bonded,elastic interactions between particles and a wall.
Definition: BWallInteractionGroup.h:69
MeshData.h
LocalDampingIGP.h
TSubLattice::addShortBondedIG
virtual void addShortBondedIG()
Definition: SubLattice.hpp:1581
TSubLattice::getWallForce
virtual void getWallForce()
Definition: SubLattice.hpp:651
VectorParticleFieldSlaveTagged.h
Damping.h
BTriMeshIP::k
double k
Definition: BTriMeshIP.h:21
HertzianElasticInteraction.h
CEWallInteractionGroup
Class for a group of unbonded,elastic interactions between particles and a wall.
Definition: EWallInteractionGroup.h:56
Console::Error
Console & Error()
set verbose level of next message to "err"
CHertzianElasticIGP::m_E
double m_E
Definition: HertzianElasticInteraction.h:27
VectorTriangleFieldSlave.h
TSubLattice::m_alpha
double m_alpha
Definition: SubLattice.h:98
TSubLattice::setParticleDensity
virtual void setParticleDensity()
Definition: SubLattice.hpp:2595
RotLocalDamping.h
CRotFrictionIGP::mu_d
double mu_d
Definition: RotFricInteraction.h:73
TSubLattice::m_last_ns
int m_last_ns
Definition: SubLattice.h:100
TSubLattice::doAddPIG
virtual bool doAddPIG(const string &, const string &, CVarMPIBuffer &, bool tagged=false)
Definition: SubLattice.hpp:787
TSubLattice::getMeshNodeRef
virtual void getMeshNodeRef()
Definition: SubLattice.hpp:3369
CMPIVarSGBufferLeaf::append
virtual void append(int)
Definition: mpisgvbuf.cpp:319
Mesh2D
Definition: Mesh2D.h:47
TSubLattice::integrate
void integrate(double)
Definition: SubLattice.hpp:1864
VectorEdge2DFieldSlave
Slave part for saving a vector field defined on the edges in a given Mesh2D.
Definition: VectorEdge2DFieldSlave.h:35
CFrictionIGP::dt
double dt
Definition: FrictionInteraction.h:41
TSubLattice::setParticleNonRot
virtual void setParticleNonRot()
Definition: SubLattice.hpp:2436
pp_array.h
TriMesh_PIS_EB
Class for parallel storage of interactions between a triangle mesh and particles which does require e...
Definition: trimesh_pis_eb.h:30
RotThermElasticInteraction.h
extractBWallIGP
CBWallIGP * extractBWallIGP(AMPIBuffer *B)
Definition: BWallInteractionGroup.cpp:56
CRotThermFrictionIGP::diffusivity
double diffusivity
Definition: RotThermFricInteraction.h:53
BondedInteraction.h
EMesh2DInteraction.h
TSubLattice::m_comm
MPI_Comm m_comm
Definition: SubLattice.h:107
Mesh2D::LoadMesh
void LoadMesh(const vector< MeshNodeData2D > &, const vector< MeshEdgeData2D > &)
Definition: Mesh2D.cpp:35
TSubLattice::applyForceToWall
virtual void applyForceToWall()
Definition: SubLattice.hpp:2540
Mesh2D_PIS_NE
Class for parallel storage of interactions between a 2D mesh and particles which doesn't require exch...
Definition: mesh2d_pis_ne.h:30
BMesh2DInteraction.h
CHertzianElasticIGP::m_nu
double m_nu
Definition: HertzianElasticInteraction.h:28
ParallelInteractionStorage_ED_T
Definition: pi_storage_ed_t.h:31
AWallFieldSlave::addWall
void addWall(CWall *)
Definition: WallFieldSlave.cpp:31
TaggedEWallInteractionGroup.h
CAdhesiveFrictionIGP::k_s
double k_s
Definition: AdhesiveFriction.h:33
pi_storage_single.h
TriMesh::loadCheckPoint
virtual void loadCheckPoint(istream &)
Definition: TriMesh.cpp:285
pi_storage_ne.h
TriMesh_PIS_EB::buildFromPPAByGap
void buildFromPPAByGap(double)
Definition: trimesh_pis_eb.hpp:306
TSubLattice::addTriMesh
virtual void addTriMesh()
Definition: SubLattice.hpp:1057
TSubLattice::packtime
double packtime
Definition: SubLattice.h:119
CESphereBodyIGP::getSphereBodyName
std::string getSphereBodyName() const
Definition: ESphereBodyInteractionGroup.h:40
CVarMPIBuffer::receiveBroadcast
virtual void receiveBroadcast(int)
Definition: mpivbuf.cpp:262
CBWallIGP
Interaction group parameters for CBWallInteractionGroups.
Definition: BWallInteractionGroup.h:39
TSubLattice::setVelocityOfWall
virtual void setVelocityOfWall()
Definition: SubLattice.hpp:2560
CheckedScalarInteractionFieldSlave.h
AWallInteractionGroup
Abstract Base class for a group of interactions between particles and a wall.
Definition: WallIG.h:31
LocalDamping.h
CHertzianViscoElasticFrictionIGP::m_A
double m_A
Definition: HertzianViscoElasticFrictionInteraction.h:49
TSubLattice::sendDataToMaster
virtual void sendDataToMaster()
Definition: SubLattice.hpp:2613
CHertzMindlinViscoIGP::m_nu
double m_nu
Definition: HertzMindlinViscoInteraction.h:49
Edge2D::getVectorFieldFunction
static VectorFieldFunction getVectorFieldFunction(const string &)
Definition: Edge2D.cpp:101
CEWallIGP
Interaction group parameters for CEWallInteractionGroups.
Definition: brokenEWallInteractionGroup.h:33
TSubLattice::exchangePos
virtual void exchangePos()
Definition: SubLattice.hpp:1710
Triangle::ScalarFieldFunction
double(Triangle::* ScalarFieldFunction)() const
Definition: Triangle.h:51
TriMesh::LoadMesh
void LoadMesh(const vector< MeshNodeData > &, const vector< MeshTriData > &)
Definition: TriMesh.cpp:31
HertzMindlinViscoInteraction.h
AParallelInteractionStorage
abstract base class for parallel interaction storage array
Definition: pi_storage.h:45
CMPIBarrier
A convenience class encapsulating an MPI barrier. Includes timing of the wait and a debug message ( v...
Definition: mpibarrier.h:31
CHertzianViscoElasticFrictionIGP::dt
double dt
Definition: HertzianViscoElasticFrictionInteraction.h:54
CMPISGBufferLeaf::append
virtual void append(int)
Definition: mpisgbuf.cpp:239
CMPIVarSGBufferLeaf
class for variable size scatter/gather buffer, leaf component
Definition: mpisgvbuf.h:69
FractalFrictionIGP::mu_0
double mu_0
Definition: FractalFriction.h:36
CElasticIGP
Interaction group parameters for CElasticInteractionGroups.
Definition: ElasticInteraction.h:25
TSubLattice::addMesh2D
virtual void addMesh2D()
Definition: SubLattice.hpp:1198
TSubLattice::addElasticWIG
virtual void addElasticWIG()
Definition: SubLattice.hpp:421
TSubLattice::setTimeStepSize
virtual void setTimeStepSize(double dt)
Definition: SubLattice.hpp:1815
CHertzMindlinViscoIGP
Interaction group parameters for Hertz-Mindlin interactions.
Definition: HertzMindlinViscoInteraction.h:28
TSubLattice::checkNeighbors
virtual void checkNeighbors()
Definition: SubLattice.hpp:2120
AInteractionGroup
Abstract base class for a group of interactions.
Definition: InteractionGroup.h:35
MeshData2D.h
ParallelInteractionStorage_EB
parallel storage array with exchange for bonded/breakable interactions
Definition: pi_storage_eb.h:30
CSoftBWallIGP
Interaction group parameters for CSoftBWallInteractionGroups.
Definition: SoftBWallInteractionGroup.h:32
TSubLattice::addBondedMesh2DIG
virtual void addBondedMesh2DIG()
Definition: SubLattice.hpp:1285
Triangle::getScalarFieldFunction
static ScalarFieldFunction getScalarFieldFunction(const string &)
Definition: Triangle.cpp:296
CRotThermFrictionIGP
Definition: RotThermFricInteraction.h:35
Vec3::X
VEC3_INLINE double & X()
Definition: vec3.h:119
FractalFrictionIGP::x0
double x0
Definition: FractalFriction.h:40
TSubLattice::addBondedTriMeshIG
virtual void addBondedTriMeshIG()
Definition: SubLattice.hpp:1142
extractSoftBWallIGP
CSoftBWallIGP * extractSoftBWallIGP(AMPIBuffer *B)
Definition: SoftBWallInteractionGroup.cpp:64
CFrictionIGP::mu
double mu
Definition: FrictionInteraction.h:39
TSubLattice::addVectorParticleField
virtual void addVectorParticleField()
Definition: SubLattice.hpp:2717
CHertzianViscoElasticFrictionIGP::m_E
double m_E
Definition: HertzianViscoElasticFrictionInteraction.h:50
ParallelParticleArray::ParticleIterator::next
Particle & next()
Definition: pp_array.hpp:669
CHertzianViscoElasticFrictionIGP::mu
double mu
Definition: HertzianViscoElasticFrictionInteraction.h:52
TSubLattice::addESphereBodyIG
virtual void addESphereBodyIG()
Definition: SubLattice.hpp:456
TSubLattice::thermExpansion
void thermExpansion()
Definition: SubLattice.hpp:1916
TSubLattice::setTaggedParticleVel
virtual void setTaggedParticleVel()
Definition: SubLattice.hpp:2467
VectorParticleFieldSlaveTagged
class for slave part of scalar field defined on the particles
Definition: VectorParticleFieldSlaveTagged.h:33
ScalarTriangleFieldSlave.h
TSubLattice::addPairIG
virtual void addPairIG()
Definition: SubLattice.hpp:741
VectorParticleFieldSlave
class for slave part of scalar field defined on the particles
Definition: VectorParticleFieldSlave.h:32
ParallelParticleArray
parrallel particle storage array with neighborsearch and variable exchange
Definition: pp_array.h:75
CRotFrictionIGP::scaling
bool scaling
Definition: RotFricInteraction.h:77
TSubLattice::zeroHeat
void zeroHeat()
Definition: SubLattice.hpp:1928
FractalFrictionIGP::y0
double y0
Definition: FractalFriction.h:40
TSubLattice::addCappedBondedIG
virtual void addCappedBondedIG()
Definition: SubLattice.hpp:1507
RotThermFricInteraction.h
CRotElasticIGP::m_kr
double m_kr
Definition: RotElasticInteraction.h:31
Console::XDebug
Console & XDebug()
set verbose level of next message to "xdg"
ShortBondedInteraction.h
TSubLattice::rebuildParticleArray
virtual void rebuildParticleArray()
Definition: SubLattice.hpp:2001
CVarMPIBuffer::pop_double
virtual double pop_double()
Definition: mpivbuf.cpp:210
ABCDamping.h
Vec3::Z
VEC3_INLINE double & Z()
Definition: vec3.h:121
AFieldSlave
Abstract base class for slave part of field.
Definition: FieldSlave.h:23
CFrictionIGP::k
double k
Definition: FrictionInteraction.h:38
ASphereBodyInteractionGroup
Abstract Base class for a group of interactions between particles and a sphere body.
Definition: SphereBodyIG.h:31
VWFrictionInteraction.h
TSubLattice::searchNeighbors
virtual void searchNeighbors()
Definition: SubLattice.hpp:2045
ParallelParticleArray::ParticleIterator::getNumRemaining
int getNumRemaining() const
Definition: pp_array.hpp:678
esys::lsm::BodyForceGroup
Definition: BodyForceGroup.h:100
CRotFrictionIGP::meanR_scaling
bool meanR_scaling
Definition: RotFricInteraction.h:79
NULL
#define NULL
Definition: t_list.h:17
CElasticIGP::m_k
double m_k
Definition: ElasticInteraction.h:28
extractVWallIGP
CVWallIGP * extractVWallIGP(AMPIBuffer *B)
Definition: ViscWallIG.cpp:54
TSubLattice::countParticles
virtual void countParticles()
Definition: SubLattice.hpp:2635
TSubLattice::m_worker_comm
MPI_Comm m_worker_comm
MPI communicator between workers (excl. master)
Definition: SubLattice.h:109
TSubLattice::addScalarHistoryInteractionField
virtual void addScalarHistoryInteractionField()
Definition: SubLattice.hpp:2897
Console::Critical
Console & Critical()
set verbose level of next message to "crt"
Definition: console.cpp:141
trimesh_pis_ne.h
TSubLattice::getTriMeshForce
virtual void getTriMeshForce()
Definition: SubLattice.hpp:3483
mpivbuf.h
CHertzMindlinIGP::dt
double dt
Definition: HertzMindlinInteraction.h:50
TSubLattice::unpacktime
double unpacktime
Definition: SubLattice.h:120
FractalFriction.h
CHertzianViscoElasticIGP::m_A
double m_A
Definition: HertzianViscoElasticInteraction.h:27
CRotThermFrictionInteraction
Definition: RotThermFricInteraction.h:70
BMesh2DIP
Definition: BMesh2DIP.h:17
CCappedBondedIGP::m_force_limit
double m_force_limit
Definition: CappedBondedInteraction.h:44
FractalFrictionIGP::dy
double dy
origin and grid spacing of the array
Definition: FractalFriction.h:40
FractalFrictionIGP::k
double k
Definition: FractalFriction.h:35
CFrictionIGP::k_s
double k_s
Definition: FrictionInteraction.h:40
TSubLattice::addMesh2DIG
virtual void addMesh2DIG()
Definition: SubLattice.hpp:1237
TSubLattice::moveWallBy
virtual void moveWallBy()
Definition: SubLattice.hpp:2483
CSphereBody
base class for spherical non-inertial bodies (similar to simple walls)
Definition: SphereBody.h:40
esys::lsm::CLatticeParam::nrange
double nrange() const
Definition: LatticeParam.h:42
TSubLattice::receiveParticles
virtual void receiveParticles()
Definition: SubLattice.hpp:329
TSubLattice::addTaggedPairIG
virtual void addTaggedPairIG()
Definition: SubLattice.hpp:762
TSubLattice::rebuildInteractions
virtual void rebuildInteractions()
Definition: SubLattice.hpp:2010
CRotThermParticle
Definition: RotThermParticle.h:55
RotElasticInteraction.h
CRotThermElasticIGP::m_kr
double m_kr
Definition: RotThermElasticInteraction.h:35
CappedBondedInteraction.h
ParallelInteractionStorage_NE
parallel storage array without exchange for dynamically created interactions (elastic)
Definition: pi_storage_ne.h:29
pi_storage_ed_t.h
ESphereBodyInteractionGroup.h
TSubLattice::oneStepTherm
virtual void oneStepTherm()
Definition: SubLattice.hpp:1892
Vec3::Y
VEC3_INLINE double & Y()
Definition: vec3.h:120
ParallelParticleArray::ParticleIterator::hasNext
bool hasNext() const
Definition: pp_array.hpp:663
TSubLattice::getMesh2DStress
virtual void getMesh2DStress()
Definition: SubLattice.hpp:3453
TSubLattice::calcHeatFrict
void calcHeatFrict()
Definition: SubLattice.hpp:1952
TSubLattice::integrateTherm
void integrateTherm(double dt)
Definition: SubLattice.hpp:1907
Mesh2D::loadCheckPoint
virtual void loadCheckPoint(istream &)
Definition: Mesh2D.cpp:230
TSubLattice::sendFieldData
virtual void sendFieldData()
Definition: SubLattice.hpp:3106
TSubLattice::do2dCalculations
virtual void do2dCalculations(bool do2d)
Definition: SubLattice.hpp:237
TSubLattice::initNeighborTable
virtual void initNeighborTable(const Vec3 &, const Vec3 &)
Definition: SubLattice.hpp:211
CHertzianViscoElasticFrictionIGP::m_nu
double m_nu
Definition: HertzianViscoElasticFrictionInteraction.h:51
CMPISGBufferLeaf::send
virtual void send()
Definition: mpisgbuf.cpp:221
FractalFrictionIGP::ny
int ny
array size
Definition: FractalFriction.h:41
esys::lsm::CLatticeParam::processDims
const ProcessDims & processDims() const
Definition: LatticeParam.h:44
TSubLattice::saveCheckPointData
virtual void saveCheckPointData(std::ostream &oStream)
Definition: SubLattice.hpp:3179
TSubLattice::setWallNormal
virtual void setWallNormal()
Definition: SubLattice.hpp:2521
CESphereBodyIGP
Interaction group parameters for CESphereBodyInteractionGroups.
Definition: ESphereBodyInteractionGroup.h:33
CHertzianViscoElasticFrictionIGP
Interaction group parameters for Hertzian viscoelastic interactions with friction.
Definition: HertzianViscoElasticFrictionInteraction.h:28
CWall::loadCheckPoint
virtual void loadCheckPoint(istream &)
Definition: Wall.cpp:128
TSubLattice::getSphereBodyPos
virtual void getSphereBodyPos()
Definition: SubLattice.hpp:620
TSubLattice::calcHeatTrans
void calcHeatTrans()
Definition: SubLattice.hpp:1970
TSubLattice::getParticlePosn
std::pair< int, Vec3 > getParticlePosn(int particleId)
Definition: SubLattice.hpp:2329
CAdhesiveFrictionIGP::k
double k
Definition: AdhesiveFriction.h:31
TriMesh::triangle_iterator
vector< Triangle >::iterator triangle_iterator
Definition: TriMesh.h:64
CRotThermFrictionIGP::k
double k
Definition: RotThermFricInteraction.h:48
mesh2d_pis_ne.h
TriMesh::corner_iterator
vector< Corner >::iterator corner_iterator
Definition: TriMesh.h:66
CAdhesiveFrictionIGP::dt
double dt
Definition: AdhesiveFriction.h:34
TSubLattice::m_dims
esys::lsm::CLatticeParam::ProcessDims m_dims
Definition: SubLattice.h:116
Vec3
Definition: vec3.h:47
Mesh2D_PIS_EB
Class for parallel storage of interactions between a 2D mesh and particles which does require exchang...
Definition: mesh2d_pis_eb.h:27
TSubLattice::getMeshFaceRef
virtual void getMeshFaceRef()
Definition: SubLattice.hpp:3411
AMPIBuffer::pop_vector
virtual Vec3 pop_vector()
Definition: mpibuf.cpp:26
CHertzianElasticIGP
Interaction group parameters for Hertzian elastic interactions.
Definition: HertzianElasticInteraction.h:25
esys::lsm::BuoyancyIGP::extract
static BuoyancyIGP extract(CVarMPIBuffer *pBuffer)
Definition: BodyForceGroup.cpp:92
esys::lsm::bpu::iter
boost::python::object iter(const boost::python::object &pyOb)
Definition: Util.h:25
DampingIGP.h
BTriMeshIP::brk
double brk
Definition: BTriMeshIP.h:22
TSubLattice::translateMeshBy
virtual void translateMeshBy(const std::string &meshName, const Vec3 &translation)
Definition: SubLattice.hpp:2283
CRotElasticIGP
Interaction group parameters for CRotElasticInteractionGroups.
Definition: RotElasticInteraction.h:25
TSubLattice::addTriMeshIG
virtual void addTriMeshIG()
Definition: SubLattice.hpp:1095
TSubLattice::forcetime
double forcetime
Definition: SubLattice.h:122
TML_Comm
abstract base class for communicator
Definition: comm.h:47
CRotThermFrictionIGP::dt
double dt
Definition: RotThermFricInteraction.h:52
ScalarParticleFieldSlave
class for slave part of scalar field defined on the particles
Definition: ScalarParticleFieldSlave.h:32
ParallelInteractionStorage_E::tryInsert
virtual void tryInsert(const I &)
TSubLattice::addSphereBody
virtual void addSphereBody()
Definition: SubLattice.hpp:402
SubLattice.h
TSubLattice::addRotThermBondedIG
virtual void addRotThermBondedIG()
Definition: SubLattice.hpp:1571
TSubLattice::calcForces
void calcForces()
Definition: SubLattice.hpp:1766
ScalarTriangleFieldSlave
Slave part for saving a scalar field defined on the triangles in a given TriMesh.
Definition: ScalarTriangleFieldSlave.h:36
BMesh2DIP::brk
double brk
Definition: BMesh2DIP.h:20
TSubLattice::addVectorTriangleField
virtual void addVectorTriangleField()
Definition: SubLattice.hpp:2946
CBondedIGP::m_scaling
bool m_scaling
Definition: BondedInteraction.h:54
CEWallIGP::getWallName
std::string getWallName() const
Definition: brokenEWallInteractionGroup.h:40
CAdhesiveFrictionIGP
Interaction parameters for adhesive frictional interaction.
Definition: AdhesiveFriction.h:22
TSubLattice::addDamping
virtual void addDamping()
Definition: SubLattice.hpp:1394
FractalFrictionIGP::dx
double dx
Definition: FractalFriction.h:40
AInteractionGroup::Update
virtual void Update(ParallelParticleArray< T > *)=0
Triangle::getForce
Vec3 getForce() const
Definition: Triangle.h:91
extractABCDampingIGP
ABCDampingIGP * extractABCDampingIGP(AMPIBuffer *B)
Definition: ABCDampingIGP.cpp:49
Vec3::ZERO
static const Vec3 ZERO
Definition: vec3.h:52
TSubLattice::receiveConnections
virtual void receiveConnections()
Definition: SubLattice.hpp:352
CMPISGBufferLeaf
Buffer for MPI scatter/gather, leaf component.
Definition: mpisgbuf.h:125
TSubLattice::addRotBondedIG
virtual void addRotBondedIG()
Definition: SubLattice.hpp:1565
CFrictionIGP::m_scaling
bool m_scaling
Definition: FrictionInteraction.h:42
RotDamping.h
CBondedIGP::tag
int tag
Definition: BondedInteraction.h:53
extractDampingIGP
CDampingIGP * extractDampingIGP(AMPIBuffer *B)
Definition: DampingIGP.cpp:64
TSubLattice::updateInteractions
virtual void updateInteractions()
Definition: SubLattice.hpp:2066
ParallelParticleArray::getInnerParticleIterator
ParticleIterator getInnerParticleIterator()
Definition: pp_array.hpp:684
TSubLattice::addWall
virtual void addWall()
Definition: SubLattice.hpp:383
Edge2D::VectorFieldFunction
Vec3(Edge2D::* VectorFieldFunction)() const
Definition: Edge2D.h:41
Mesh2D_PIS_EB::buildFromPPATagged
void buildFromPPATagged(int, int)
Definition: mesh2d_pis_eb.hpp:357
ScalarParticleFieldSlaveTagged.h
CHertzMindlinIGP
Interaction group parameters for Hertz-Mindlin interactions.
Definition: HertzMindlinInteraction.h:28
MpiInfo.h
CBondedIGP::k
double k
Spring constant.
Definition: BondedInteraction.h:51
TSubLattice::removeIG
virtual void removeIG()
Definition: SubLattice.hpp:1674
trimesh_pis_eb.h
ASubLattice::IdVector
std::vector< int > IdVector
Definition: ASubLattice.h:48
CRotFrictionIGP::k_s
double k_s
Definition: RotFricInteraction.h:75
FractalFrictionIGP
Interaction parameters for frictional interaction with a fractal distribution of the coefficient of f...
Definition: FractalFriction.h:26
AdhesiveFriction.h
CLocalDampingIGP
Interaction group parameters for CLocalDampingGroup.
Definition: LocalDampingIGP.h:28
TSubLattice::m_nrange
double m_nrange
Definition: SubLattice.h:96
ETriMeshInteraction.h
BodyForceGroup.h
AWallFieldSlave
Abstract base class for slave part of field defined on a Wall.
Definition: WallFieldSlave.h:34
TSubLattice::setParticleNonDynamic
virtual void setParticleNonDynamic()
Definition: SubLattice.hpp:2420
CHertzMindlinViscoIGP::mu
double mu
Definition: HertzMindlinViscoInteraction.h:50
TSubLattice::getParticleData
virtual void getParticleData(const IdVector &particleIdVector)
Definition: SubLattice.hpp:2353
TSubLattice::addTaggedElasticWIG
virtual void addTaggedElasticWIG()
Definition: SubLattice.hpp:491
extractLocalDampingIGP
CLocalDampingIGP * extractLocalDampingIGP(AMPIBuffer *B)
Definition: LocalDampingIGP.cpp:57
FractalFrictionIGP::dt
double dt
Definition: FractalFriction.h:38
CHertzianViscoElasticFrictionIGP::k_s
double k_s
Definition: HertzianViscoElasticFrictionInteraction.h:53
LinearDashpotInteraction.h
RotThermBondedInteraction.h
TSubLattice::saveSnapShotData
virtual void saveSnapShotData(std::ostream &oStream)
Definition: SubLattice.hpp:3131
Mesh2D::edge_iterator
vector< Edge2D >::iterator edge_iterator
Definition: Mesh2D.h:57
TSubLattice::m_rank
int m_rank
rank in m_comm
Definition: SubLattice.h:106
TSubLattice::addVectorInteractionField
virtual void addVectorInteractionField()
Definition: SubLattice.hpp:2824
CHertzMindlinIGP::m_E
double m_E
Definition: HertzMindlinInteraction.h:47
TSubLattice::moveTaggedNodes
virtual void moveTaggedNodes()
Definition: SubLattice.hpp:2259
ETriMeshIP::k
double k
Definition: ETriMeshIP.h:66
ParticleVector
std::vector< SimpleParticle > ParticleVector
Definition: SimpleNTable3D.h:22
TSubLattice::moveSingleNode
virtual void moveSingleNode()
Definition: SubLattice.hpp:2230
TSubLattice::addViscWIG
virtual void addViscWIG()
Definition: SubLattice.hpp:713
TSubLattice::moveSphereBodyBy
virtual void moveSphereBodyBy()
Definition: SubLattice.hpp:2502
CBondedIGP::rbreak
double rbreak
Breaking strain.
Definition: BondedInteraction.h:52
CRotThermElasticInteraction
Definition: RotThermElasticInteraction.h:62
TSubLattice::m_tml_worker_comm
TML_Comm m_tml_worker_comm
TML version of the communicator between workers (excl. master)
Definition: SubLattice.h:110
Triangle::VectorFieldFunction
Vec3(Triangle::* VectorFieldFunction)() const
Definition: Triangle.h:50
TSubLattice::setExIG
virtual void setExIG()
Definition: SubLattice.hpp:1637
BTriMeshIP
Definition: BTriMeshIP.h:19
CAdhesiveFrictionIGP::mu
double mu
Definition: AdhesiveFriction.h:32
TSubLattice::printData
virtual void printData()
Definition: SubLattice.hpp:2659
TSubLattice::addBondedIG
virtual void addBondedIG()
Definition: SubLattice.hpp:1460
FractalFrictionIGP::nx
int nx
Definition: FractalFriction.h:41
esys::lsm::BuoyancyForceGroup
Definition: BodyForceGroup.h:144
ParallelInteractionStorage_EB::setUnbreakable
void setUnbreakable(bool)
Definition: pi_storage_eb.hpp:168
esys::lsm::CLatticeParam
Definition: LatticeParam.h:30
ParallelInteractionStorage_NE_T
Definition: pi_storage_ne_t.h:31
CheckedScalarInteractionFieldSlaveTagged.h
ABCDampingIGP
Definition: ABCDampingIGP.h:24
CHertzMindlinViscoIGP::m_COR
double m_COR
Definition: HertzMindlinViscoInteraction.h:51
TSubLattice::moveTaggedParticlesBy
virtual void moveTaggedParticlesBy()
Definition: SubLattice.hpp:2206
CVWallIGP
Interaction group parameters for CBWallInteractionGroups.
Definition: ViscWallIG.h:33
HertzMindlinInteraction.h
ParallelInteractionStorage_Single
parallel storage array without exchange for dynamically created single particle interactions (i....
Definition: pi_storage_single.h:27
CTaggedEWallInteractionGroup
Class for a group of unbonded,elastic interactions between particles and a wall using only particles ...
Definition: TaggedEWallInteractionGroup.h:32
FractalFrictionIGP::mu
boost::shared_ptr< double > mu
pointer to the array of friction coeff.
Definition: FractalFriction.h:39
CSphereBody::loadCheckPoint
virtual void loadCheckPoint(istream &)
Definition: SphereBody.cpp:60
TSubLattice::addScalarParticleField
virtual void addScalarParticleField()
Definition: SubLattice.hpp:2682
console
Console console
Definition: console.cpp:25
VWFrictionIGP
Interaction parameters for velocity weakening frictional interaction.
Definition: VWFrictionInteraction.h:23
TriMesh
class for a triangle mesh
Definition: TriMesh.h:51
CElasticIGP::m_scaling
bool m_scaling
Definition: ElasticInteraction.h:29
CDampingIGP
Interaction group parameters for CDampingGroup.
Definition: DampingIGP.h:28
TSubLattice::oneStep
virtual void oneStep()
Definition: SubLattice.hpp:1876
TSubLattice::setParticleVelocity
virtual void setParticleVelocity()
Definition: SubLattice.hpp:2579
TSubLattice::loadCheckPointData
virtual void loadCheckPointData(std::istream &iStream)
Definition: SubLattice.hpp:3254
CHertzMindlinIGP::m_nu
double m_nu
Definition: HertzMindlinInteraction.h:48
CRotThermFrictionIGP::mu_d
double mu_d
Definition: RotThermFricInteraction.h:49
CBondedIGP
Interaction parameters for bonded interaction.
Definition: BondedInteraction.h:40
CHertzianViscoElasticIGP::m_E
double m_E
Definition: HertzianViscoElasticInteraction.h:28
AIGParam::getName
const std::string & getName() const
Definition: IGParam.h:42
CESphereBodyInteractionGroup
Class for a group of unbonded,elastic interactions between particles and a sphere body.
Definition: ESphereBodyInteractionGroup.h:56
TSubLattice::~TSubLattice
virtual ~TSubLattice()
Definition: SubLattice.hpp:175
TriMesh_PIS_EB::buildFromPPATagged
void buildFromPPATagged(int, int)
Definition: trimesh_pis_eb.hpp:261
mpisgvbuf.h
Mesh2D_PIS_EB::buildFromPPAByGap
void buildFromPPAByGap(double)
Definition: mesh2d_pis_eb.hpp:405
TSubLattice::addBondedWIG
virtual void addBondedWIG()
Definition: SubLattice.hpp:533
CVarMPIBuffer::pop_string
virtual std::string pop_string()
Definition: mpivbuf.cpp:233
TSubLattice::getSphereBodyForce
virtual void getSphereBodyForce()
Definition: SubLattice.hpp:682
CRotFrictionIGP::dt
double dt
Definition: RotFricInteraction.h:76
CMPIBarrier::wait
void wait(const char *)
Definition: mpibarrier.cpp:32
extractESphereBodyIGP
CESphereBodyIGP * extractESphereBodyIGP(AMPIBuffer *B)
Definition: ESphereBodyInteractionGroup.cpp:52
CMPIVarSGBufferLeaf::send
virtual void send()
Definition: mpisgvbuf.cpp:287
CHertzMindlinViscoIGP::dt
double dt
Definition: HertzMindlinViscoInteraction.h:52
ParallelInteractionStorage_ED
parallel storage array with exchange for dynamically created interactions (friction etc....
Definition: pi_storage_ed.h:31
mpia2abuf.h
CHertzMindlinIGP::mu
double mu
Definition: HertzMindlinInteraction.h:49
TSubLattice::printStruct
virtual void printStruct()
Definition: SubLattice.hpp:2649
BMesh2DIP::k
double k
Definition: BMesh2DIP.h:19
CSoftBWallInteractionGroup
Class for a group of bonded, elastic interactions with per-direction spring constants between particl...
Definition: SoftBWallInteractionGroup.h:59
TSubLattice::zeroForces
void zeroForces()
Definition: SubLattice.hpp:1723
AIGParam::Name
const std::string & Name() const
Definition: IGParam.h:44