ug4
domain_impl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_DISC__DOMAIN_IMPL__
34 #define __H__UG__LIB_DISC__DOMAIN_IMPL__
35 
36 #include "domain.h"
37 #include "common/serialization.h"
39 
40 #ifdef UG_PARALLEL
43  #include "common/util/archivar.h"
44  #include "common/util/factory.h"
45  #include <boost/archive/text_oarchive.hpp>
46  #include <boost/archive/text_iarchive.hpp>
47 #endif
48 
49 #ifdef UG_PARALLEL
51 #endif
52 
53 
54 namespace ug{
55 
57 // IDomain
59 
60 template <typename TGrid, typename TSubsetHandler>
62  :
63  m_spGrid(new TGrid(GRIDOPT_NONE)), // Note: actual options are set by the derived class (dimension dependent).
64  m_spSH(new TSubsetHandler(*m_spGrid)),
65  m_isAdaptive(isAdaptive),
66  m_adaptionIsActive(false)
67 {
68  #ifdef UG_PARALLEL
69  // the grid has to be prepared for parallelism
70  m_spGrid->set_parallel(true);
71  #endif
72 
73 // register function for grid adaption
75  message_hub()->register_class_callback(this,
77 
79  message_hub()->register_class_callback(this,
81 
83  message_hub()->register_class_callback(this,
85 }
86 
88 template <typename TGrid, typename TSubsetHandler>
90 {
91 }
92 
93 
94 template <typename TGrid, typename TSubsetHandler>
96 update_subset_infos(int rootProc)
97 {
98  PROFILE_FUNC();
99 
100  TSubsetHandler& sh = *m_spSH;
101  for(int i = 0; i < sh.num_subsets(); ++i){
102  int dim = -1;
103  if(sh.contains_volumes(i))
104  dim = 3;
105  else if(sh.contains_faces(i))
106  dim = 2;
107  else if(sh.contains_edges(i))
108  dim = 1;
109  else if(sh.contains_vertices(i))
110  dim = 0;
111 
112  sh.subset_info(i).set_property("dim", dim);
113  }
114 
115  // do not communicate if geom is created on all procs
116  if (rootProc == -2) return;
117 
118 #ifdef UG_PARALLEL
119  pcl::ProcessCommunicator procCom;
120 
121 // prepare the subset-info package, send it to all procs and extract the info again.
122  BinaryBuffer buf;
123  if(pcl::ProcRank() == rootProc){
124  Serialize(buf, sh.num_subsets());
125  for(int i = 0; i < sh.num_subsets(); ++i){
126  Serialize(buf, sh.subset_info(i).name);
127  Serialize(buf, sh.subset_info(i).get_property("dim").to_int());
128  }
129  }
130 
131  procCom.broadcast(buf, rootProc);
132 
133  if(pcl::ProcRank() != rootProc){
134  int numSubsets;
135  Deserialize(buf, numSubsets);
136  if(numSubsets > 0)
137  sh.subset_required(numSubsets - 1);
138 
139  for(int i = 0; i < numSubsets; ++i){
140  Deserialize(buf, sh.subset_info(i).name);
141  int dim;
142  Deserialize(buf, dim);
143  sh.subset_info(i).set_property("dim", dim);
144  }
145  }
146 
147 //todo: distribute projectors from rootProc to all other processors.
148 //note: first check whether source-proc has a ProjectionHandler. If so,
149 // create a local projection handler first and perform serialization
150 // afterwards.
151  set_refinement_projector(
152  broadcast_refinement_projector(
153  rootProc, procCom, geometry3d(), m_refinementProjector));
154 
155 #endif
156 
157 }
158 
159 
160 template <typename TGrid, typename TSubsetHandler>
161 inline
164 {
165  if(msg.adaption_begins())
166  m_adaptionIsActive = true;
167 
168  else if(m_adaptionIsActive){
169  //if(msg.adaptive()){
170  if(msg.adaption_ends())
171  {
172  update_domain_info();
173  m_adaptionIsActive = false;
174  }
175  //}
176  }
177 
178  else{
179  UG_THROW("Before any grid-adaption may be performed, the domain "
180  "has to be informed that grid-adaption shall begin. "
181  "You may use IRefiner::grid_adaption_begins() or schedule "
182  "an appropriate message to the associated grids message-hub.");
183  }
184 }
185 
186 template <typename TGrid, typename TSubsetHandler>
187 inline
190 {
191  if(msg.msg() == GMCT_CREATION_STOPS){
192  if(msg.proc_id() != -1)
193  update_subset_infos(msg.proc_id());
194  update_domain_info();
195  }
196 }
197 
198 template <typename TGrid, typename TSubsetHandler>
199 inline
202 {
203 // this is already handled in grid_creation_callback
204  /*if(msg.msg() == GMDT_DISTRIBUTION_STOPS){
205  update_domain_info();
206  }*/
207 }
208 
209 
210 template <typename TGrid, typename TSubsetHandler>
213 {
214  PROFILE_FUNC();
215 
216  TGrid& mg = *m_spGrid;
217  TSubsetHandler& sh = *m_spSH;
218 
219  GridBaseObjectId locElemType;
220  if(mg.template num<Volume>() > 0)
221  locElemType = VOLUME;
222  else if(mg.template num<Face>() > 0)
223  locElemType = FACE;
224  else if(mg.template num<Edge>() > 0)
225  locElemType = EDGE;
226  else
227  locElemType = VERTEX;
228 
229  GridBaseObjectId elemType;
230  #ifdef UG_PARALLEL
232 
233  // all processes should have the same number of grid levels
234  int numLevLocal = m_spGrid->num_levels();
235  int numLevGlobal;
236  commWorld.allreduce(&numLevLocal, &numLevGlobal, 1, PCL_DT_INT, PCL_RO_MAX);
237 
238  if(numLevGlobal > 0){
239  m_spGrid->level_required(numLevGlobal-1);
240  m_spSH->level_required(numLevGlobal-1);
241  }
242 
243  // communicate the element type of highest dimension present in the global grid.
244  elemType = (GridBaseObjectId) commWorld.allreduce((int)locElemType, PCL_RO_MAX);
245  #else
246  elemType = locElemType;
247  #endif
248 
249 // the number of levels of the multi-grid is now equal on all processes
250  typedef DomainInfo::int_t int_t;
251 
252  std::vector<int_t> subsetDims;
253  subsetDims.reserve(sh.num_subsets());
254  for(int i = 0; i < sh.num_subsets(); ++i)
255  subsetDims.push_back(sh.subset_info(i).get_property("dim").to_int());
256 
257  std::vector<int_t> numLocalGhosts;
258  #ifdef UG_PARALLEL
259  switch(elemType){
260  case VOLUME:
261  count_ghosts<Volume>(numLocalGhosts);
262  break;
263  case FACE:
264  count_ghosts<Face>(numLocalGhosts);
265  break;
266  case EDGE:
267  count_ghosts<Edge>(numLocalGhosts);
268  break;
269  case VERTEX:
270  count_ghosts<Vertex>(numLocalGhosts);
271  break;
272  default:
273  UG_THROW("Unknown base object type");
274  break;
275  }
276  #else
277  numLocalGhosts.resize(mg.num_levels(), 0);
278  #endif
279 
280  int_t numLocalSurfElems = 0;
281  std::vector<int_t> numLocalElems;
282  numLocalElems.reserve(mg.num_levels());
283 
284  switch(elemType){
285  case VOLUME:
286  for(size_t i = 0; i < mg.num_levels(); ++i)
287  numLocalElems.push_back(mg.template num<Volume>(i) - numLocalGhosts[i]);
288  numLocalSurfElems = count_local_unique_surface_elements<Volume>();
289  break;
290  case FACE:
291  for(size_t i = 0; i < mg.num_levels(); ++i)
292  numLocalElems.push_back(mg.template num<Face>(i) - numLocalGhosts[i]);
293  numLocalSurfElems = count_local_unique_surface_elements<Face>();
294  break;
295  case EDGE:
296  for(size_t i = 0; i < mg.num_levels(); ++i)
297  numLocalElems.push_back(mg.template num<Edge>(i) - numLocalGhosts[i]);
298  numLocalSurfElems = count_local_unique_surface_elements<Edge>();
299  break;
300  case VERTEX:
301  for(size_t i = 0; i < mg.num_levels(); ++i)
302  numLocalElems.push_back(mg.template num<Vertex>(i) - numLocalGhosts[i]);
303  numLocalSurfElems = count_local_unique_surface_elements<Vertex>();
304  break;
305  default:
306  UG_THROW("Unknown base object type");
307  break;
308  }
309 
310 
311 
312  std::vector<int_t> numGlobalElems, minNumLocalElems, maxNumLocalElems;
313  int_t numGlobalSurfElems = 0;
314  #ifdef UG_PARALLEL
315  // we have to sum local element counts excluding ghosts.
316  numGlobalElems.resize(numLocalElems.size());
317  minNumLocalElems.resize(numLocalElems.size());
318  maxNumLocalElems.resize(numLocalElems.size());
319  commWorld.allreduce(numLocalElems, numGlobalElems, PCL_RO_SUM);
320  commWorld.allreduce(numLocalElems, minNumLocalElems, PCL_RO_MIN);
321  commWorld.allreduce(numLocalElems, maxNumLocalElems, PCL_RO_MAX);
322  numGlobalSurfElems = commWorld.allreduce(numLocalSurfElems, PCL_RO_SUM);
323  #else
324  numGlobalElems = numLocalElems;
325  minNumLocalElems = numLocalElems;
326  maxNumLocalElems = numLocalElems;
327  numGlobalSurfElems = numLocalSurfElems;
328  #endif
329 
330  m_domainInfo.set_info(elemType, numGlobalElems, numLocalElems, minNumLocalElems,
331  maxNumLocalElems, numLocalGhosts, subsetDims, numGlobalSurfElems);
332 }
333 
334 template <typename TGrid, typename TSubsetHandler>
337 {
338  if(m_additionalSH[name].valid())
339  return false;
340 
341  m_additionalSH[name] = SmartPtr<TSubsetHandler>(new TSubsetHandler(*m_spGrid));
342  return true;
343 }
344 
345 template <typename TGrid, typename TSubsetHandler>
346 std::vector<std::string> IDomain<TGrid,TSubsetHandler>::
348 {
349  typedef typename std::map<std::string, SmartPtr<TSubsetHandler> >::const_iterator iterator_t;
350  std::vector<std::string> names;
351  for(iterator_t iter = m_additionalSH.begin(); iter != m_additionalSH.end(); ++iter){
352  if(iter->second.valid())
353  names.push_back(iter->first);
354  }
355  return names;
356 }
357 
358 template <typename TGrid, typename TSubsetHandler>
360 additional_subset_handler(std::string name)
361 {
362  SmartPtr<TSubsetHandler> sp = m_additionalSH[name];
363  if(!sp.valid()){
364  UG_THROW("Requested additional subset handler with name '" << name
365  << "' doesn't exist in the given domain!");
366  }
367  return sp;
368 }
369 
370 template <typename TGrid, typename TSubsetHandler>
372 additional_subset_handler(std::string name) const
373 {
374  SmartPtr<TSubsetHandler> sp = m_additionalSH[name];
375  if(!sp.valid()){
376  UG_THROW("Requested additional subset handler with name '" << name
377  << "' doesn't exist in the given domain!");
378  }
379  return sp;
380 }
381 
382 template <typename TGrid, typename TSubsetHandler>
385 {
386  m_refinementProjector = proj;
387  if(proj.valid())
388  proj->set_geometry(geometry3d());
389 }
390 
391 template <typename TGrid, typename TSubsetHandler>
393 refinement_projector() const
394 {
395  return m_refinementProjector;
396 }
397 
398 
399 #ifdef UG_PARALLEL
400 
401 template <typename TGrid, typename TSubsetHandler>
404  BinaryBuffer& buf,
406 {
407  static Archivar<boost::archive::text_oarchive,
410  archivar;
411 
413 
414  if(proj.invalid()){
415  Serialize(buf, std::string(""));
416  return;
417  }
418 
419  Serialize(buf, projFac.class_name(*proj));
420 
421  std::stringstream ss;
422  boost::archive::text_oarchive ar(ss, boost::archive::no_header);
423  archivar.archive(ar, *proj);
424  Serialize(buf, ss.str());
425 }
426 
427 template <typename TGrid, typename TSubsetHandler>
430 {
431  static Archivar<boost::archive::text_iarchive,
434  archivar;
435 
437 
438  std::string name;
439  Deserialize(buf, name);
440 
441  if(name.empty())
442  return SPRefinementProjector();
443 
444  SPRefinementProjector proj = projFac.create(name);
445 
446  std::string data;
447  Deserialize(buf, data);
448  std::stringstream ss(data, std::ios_base::in);
449  boost::archive::text_iarchive ar(ss, boost::archive::no_header);
450  archivar.archive(ar, *proj);
451  return proj;
452 }
453 
454 
455 template <typename TGrid, typename TSubsetHandler>
458  int rootProc,
459  pcl::ProcessCommunicator& procCom,
460  SPIGeometry3d geometry,
461  SPRefinementProjector projector)
462 {
463  BinaryBuffer buf;
464  const int magicNumber = 3243578;
465  const bool isRoot = (pcl::ProcRank() == rootProc);
466 
467  if(isRoot){
468  // if the specified projector is a projection handler, we'll perform a
469  // special operation.
470  ProjectionHandler* ph = NULL;
471  int projectorType = -1;// -1: none, 0: normal projector, 1: projection handler
472  if(projector.valid()){
473  ph = dynamic_cast<ProjectionHandler*>(projector.get());
474  if(ph)
475  projectorType = 1;
476  else
477  projectorType = 0;
478  }
479  Serialize(buf, projectorType);
480  if(ph){
481  const ISubsetHandler* psh = ph->subset_handler();
482  if (psh == subset_handler().get())
483  Serialize(buf, std::string(""));
484  else
485  {
486  typedef typename std::map<std::string, SmartPtr<TSubsetHandler> >::const_iterator map_it_t;
487  map_it_t it = m_additionalSH.begin();
488  map_it_t it_end = m_additionalSH.end();
489  for (; it != it_end; ++it)
490  {
491  if (it->second.get() == psh)
492  {
493  Serialize(buf, it->first);
494  break;
495  }
496  }
497  UG_COND_THROW(it == it_end, "Subset handler for projection handler not found "
498  "in list of available subset handlers.");
499  }
500 
501 
502  serialize_projector(buf, ph->default_projector());
503 
504  size_t numProjectors = ph->num_projectors();
505 
506  Serialize(buf, numProjectors);
507  for(size_t iproj = 0; iproj < numProjectors; ++iproj){
508  SPRefinementProjector proj = ph->projector(iproj);
509  serialize_projector(buf, proj);
510  }
511  }
512  else if(projector.valid()){
513  serialize_projector(buf, projector);
514  }
515 
516  Serialize(buf, magicNumber);
517  }
518 
519  procCom.broadcast(buf, rootProc);
520 
521  if(!isRoot){
522  int projectorType;
523  Deserialize(buf, projectorType);
524  if(projectorType == 1){
525  std::string sh_name;
526  Deserialize(buf, sh_name);
527  ProjectionHandler* ph;
528  if (sh_name == std::string(""))
529  ph = new ProjectionHandler(geometry, subset_handler());
530  else
531  {
532  typedef typename std::map<std::string, SmartPtr<TSubsetHandler> >::const_iterator map_it_t;
533  map_it_t it = m_additionalSH.begin();
534  map_it_t it_end = m_additionalSH.end();
535  for (; it != it_end; ++it)
536  {
537  if (it->first == sh_name)
538  {
539  ph = new ProjectionHandler(geometry, it->second);
540  break;
541  }
542  }
543  UG_COND_THROW(it == it_end, "Subset handler name for projection handler not found "
544  "in list of available names.");
545  }
546  SPProjectionHandler projHandler = make_sp(ph);
547 
548 
549  ph->set_default_projector(deserialize_projector(buf));
550 
551  size_t numProjectors;
552  Deserialize(buf, numProjectors);
553  for(size_t iproj = 0; iproj < numProjectors; ++iproj){
554  ph->set_projector(iproj, deserialize_projector(buf));
555  }
556 
557  projector = projHandler;
558  }
559  else if(projectorType == 0){
560  projector = deserialize_projector(buf);
561  }
562  else if(projectorType == -1){
563  projector = SPNULL;
564  }
565  else{
566  UG_THROW("Invalid projector type in 'BroadcastRefinementProjector': "
567  << projectorType);
568  }
569 
570  int tmp;
571  Deserialize(buf, tmp);
572  UG_COND_THROW(tmp != magicNumber, "Magic number mismatch in "
573  "'BroadcastRefinementProjector'. Received "
574  << tmp << ", but expected " << magicNumber);
575  }
576 
577  return projector;
578 }
579 
580 #endif
581 
582 
583 #ifdef UG_PARALLEL
584 template <typename TGrid, typename TSubsetHandler>
585 template <class TElem>
587 count_ghosts(std::vector<DomainInfo::int_t>& numGhostsOnLvlOut)
588 {
589  TGrid& mg = *m_spGrid;
590  DistributedGridManager& dgm = *mg.distributed_grid_manager();
591  GridLayoutMap& glm = dgm.grid_layout_map();
592 
593  numGhostsOnLvlOut.clear();
594  numGhostsOnLvlOut.resize(mg.num_levels(), 0);
595 
596  if(glm.has_layout<TElem>(INT_V_MASTER)){
597  typedef typename GridLayoutMap::Types<TElem>::Layout Layout;
598  typedef typename GridLayoutMap::Types<TElem>::Interface Interface;
599  Layout& layout = glm.get_layout<TElem>(INT_V_MASTER);
600  for(size_t lvl = 0; lvl < layout.num_levels(); ++lvl){
601  if(lvl >= mg.num_levels())
602  break;
603 
604  typename Layout::LevelLayout& lvlLayout = layout.layout_on_level(lvl);
605  for(typename Layout::LevelLayout::iterator iiter = lvlLayout.begin();
606  iiter != lvlLayout.end(); ++iiter)
607  {
608  Interface& intfc = lvlLayout.interface(iiter);
609  for(typename Interface::iterator eiter = intfc.begin();
610  eiter != intfc.end(); ++eiter)
611  {
612  if(dgm.is_ghost(intfc.get_element(eiter)))
613  ++numGhostsOnLvlOut[lvl];
614  }
615  }
616  }
617  }
618 }
619 #endif
620 
621 
622 template <typename TGrid, typename TSubsetHandler>
623 template <class TElem>
626 {
627  TGrid& mg = *m_spGrid;
628 # ifdef UG_PARALLEL
629  DistributedGridManager* dgm = mg.distributed_grid_manager();
630 # endif
631 
632  size_t numLoc = 0;
633 
634  typedef typename TGrid::template traits<TElem>::iterator iter_t;
635  for(iter_t ielem = mg.template begin<TElem>(); ielem != mg.template end<TElem>(); ++ielem)
636  {
637  TElem* e = *ielem;
638 
639  if(!mg.has_children(e)){
640  #ifdef UG_PARALLEL
641  if(!(dgm->is_ghost(e) || dgm->contains_status(e, ES_H_SLAVE)))
642  ++numLoc;
643  #else
644  ++numLoc;
645  #endif
646  }
647  }
648 
649  return numLoc;
650 }
651 
652 
654 // Domain
656 
657 template <int d, typename TGrid, typename TSubsetHandler>
659 Domain(bool isAdaptive) : IDomain<TGrid, TSubsetHandler>(isAdaptive)
660 {
661 // Depending on the dimesion, we'll activeate different options.
662 // Otherwise we probably would waste memory...
663 // In any case, sides of elements should always be present
664  uint gridOpts = GRIDOPT_AUTOGENERATE_SIDES;
665 
666 // Furthermore vertices should store associated elements.
667 // This option depends on the dimension of the domain
668  if(dim > 0)
669  gridOpts |= VRTOPT_STORE_ASSOCIATED_EDGES;
670  if(dim > 1)
671  gridOpts |= VRTOPT_STORE_ASSOCIATED_FACES;
672  if(dim > 2)
674 
675 // thats it for now. One could think about enabling
676 // FACEOPT_STORE_ASSOCIATED_EDGES, VOLOPT_STORE_ASSOCIATED_EDGES
677 // and VOLOPT_STORE_ASSOCIATED_FACES. However this costs considerably
678 // more memory compared to the performance benefits.
679 // Now set the options
680  this->grid()->set_options(gridOpts);
681 
682 // get position attachment
683  m_aPos = GetDefaultPositionAttachment<position_attachment_type>();
684 
685 // let position accessor access Vertex Coordinates
686  if(!this->grid()->template has_attachment<Vertex>(m_aPos))
687  this->grid()->template attach_to<Vertex>(m_aPos);
688  m_aaPos.access(*(this->grid()), m_aPos);
689 
690  m_geometry3d = MakeGeometry3d(*(this->grid()), m_aPos);
692 }
693 
694 
695 } // end namespace ug
696 
697 #endif /* __H__UG__LIB_DISC__DOMAIN_IMPL__ */
location name
Definition: checkpoint_util.lua:128
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
T * get()
returns encapsulated pointer
Definition: smart_pointer.h:197
bool valid() const
returns true if the pointer is valid, false if not.
Definition: smart_pointer.h:206
bool invalid() const
returns true if the pointer is invalid, false if not.
Definition: smart_pointer.h:212
the standard multi-level-layout implementation
Definition: pcl_communication_structs.h:615
You may add elements to this interface and iterate over them.
Definition: pcl_communication_structs.h:207
Definition: pcl_process_communicator.h:70
void allreduce(const void *sendBuf, void *recBuf, int count, DataType type, ReduceOperation op) const
performs MPI_Allreduce on the processes of the communicator.
Definition: pcl_process_communicator.cpp:318
void broadcast(void *v, size_t size, DataType type, int root=0) const
Definition: pcl_process_communicator.cpp:685
Definition: archivar.h:59
A Buffer for binary data.
Definition: binary_buffer.h:56
manages the layouts and interfaces which are associated with a distributed grid.
Definition: distributed_grid.h:88
bool is_ghost(TElem *elem) const
returns true if the element is a ghost
Definition: distributed_grid_impl.hpp:67
GridLayoutMap & grid_layout_map()
Definition: distributed_grid.h:103
bool contains_status(TGeomObj *o, byte status) const
returns true if the status of the given object contains the given status.
Definition: distributed_grid.h:135
A factory class which creates instances given a class-name.
Definition: factory.h:75
SmartPtr< TBase > create(const std::string &className)
Definition: factory.h:83
const std::string & class_name(const size_t i) const
Definition: factory.h:125
bool access(Grid &grid, TAttachment &a)
Definition: grid.h:189
lets you access layouts by type and key
Definition: parallel_grid_layout.h:152
bool has_layout(const Key &key) const
checks whether the layout associated with the given key exists for the given type.
Definition: parallel_grid_layout_impl.hpp:44
Types< TType >::Layout & get_layout(const Key &key)
creates the required layout if it doesn't exist already.
Definition: parallel_grid_layout_impl.hpp:52
void clear()
Definition: parallel_grid_layout_impl.hpp:118
A message sent along with "GridRefinement" messages.
Definition: lib_grid_messages.h:91
bool adaption_ends() const
tells whether grid adaption has just been started or has been finished.
Definition: lib_grid_messages.cpp:44
bool adaption_begins() const
tells whether grid adaption has just been started or has been finished.
Definition: lib_grid_messages.cpp:38
Definition: lib_grid_messages.h:195
int proc_id() const
Definition: lib_grid_messages.h:201
GridMessageCreationType msg() const
Definition: lib_grid_messages.h:200
Definition: lib_grid_messages.h:166
describes a physical domain
Definition: domain.h:139
Definition: subset_handler_interface.h:223
Associates different projectors with individual subsets.
Definition: projection_handler.h:53
void set_default_projector(SPRefinementProjector projector)
Definition: projection_handler.cpp:113
void set_projector(int subsetIndex, SPRefinementProjector projector)
associate a projector with a given subsetIndex. Note that '-1' is a valid index, too.
Definition: projection_handler.cpp:119
SPRefinementProjector projector(size_t i)
Definition: projection_handler.h:127
size_t num_projectors() const
Definition: projection_handler.h:124
const ISubsetHandler * subset_handler() const
return the subset handler that the projection handler is based on
Definition: projection_handler.h:104
SPRefinementProjector default_projector()
Definition: projection_handler.h:133
Adjusts vertex coordinates during refinement.
Definition: refinement_projector.h:55
virtual void set_geometry(SPIGeometry3d geometry)
Definition: refinement_projector.h:76
virtual ~IDomain()
Destructor.
Definition: domain_impl.h:89
void set_refinement_projector(SPRefinementProjector proj)
sets the ug::RefinementProjector which can be used by refiners during refinement
Definition: domain_impl.h:384
void grid_distribution_callback(const GridMessage_Distribution &msg)
Definition: domain_impl.h:201
Domain(bool isAdaptive=true)
Default constructor.
Definition: domain_impl.h:659
SPRefinementProjector refinement_projector() const
returns the domain's ug::RefinementProjector. The pointer may be invalid.
Definition: domain_impl.h:393
void grid_creation_callback(const GridMessage_Creation &msg)
Called when a domain has been loaded and during domain distribution.
Definition: domain_impl.h:189
SmartPtr< MultiGrid > grid()
returns Grid
Definition: domain.h:162
void update_subset_infos(int rootProc)
updates and broadcasts subset names and dimensions from the given rootProc to all other processes.
Definition: domain_impl.h:96
MessageHub::SPCallbackId m_spGridDistributionCallbackID
Definition: domain.h:252
SmartPtr< TGrid > m_spGrid
Grid.
Definition: domain.h:244
IDomain(bool isAdaptive=true)
Default constructor.
Definition: domain_impl.h:61
SmartPtr< TSubsetHandler > additional_subset_handler(std::string name)
returns an additional subset handler Subset Handler
Definition: domain_impl.h:360
void serialize_projector(BinaryBuffer &bufOut, SPRefinementProjector proj)
Definition: domain_impl.h:403
void grid_adaption_callback(const GridMessage_Adaption &msg)
Definition: domain_impl.h:163
std::vector< std::string > additional_subset_handler_names() const
returns a list with the names of additional subset handlers
Definition: domain_impl.h:347
SPRefinementProjector deserialize_projector(BinaryBuffer &buf)
Definition: domain_impl.h:429
MessageHub::SPCallbackId m_spGridAdaptionCallbackID
Definition: domain.h:250
unsigned long long int_t
Definition: domain.h:61
size_t count_local_unique_surface_elements()
counts local surface elements which are not ghosts or h-slaves
Definition: domain_impl.h:625
MessageHub::SPCallbackId m_spGridCreationCallbackID
Definition: domain.h:251
void count_ghosts(std::vector< DomainInfo::int_t > &numGhostsOnLvlOut)
Definition: domain_impl.h:587
SPMessageHub message_hub()
returns the message hub of the grid
Definition: domain.h:174
static const int dim
World dimension.
Definition: domain.h:294
bool create_additional_subset_handler(std::string name)
creates an additional subset-handler with the given name
Definition: domain_impl.h:336
SPRefinementProjector m_refinementProjector
Definition: domain.h:248
SPRefinementProjector broadcast_refinement_projector(int rootProc, pcl::ProcessCommunicator &procCom, SPIGeometry3d geometry, SPRefinementProjector projector=SPNULL)
helper method to broadcast ug::RefinementProjectors to different processes
Definition: domain_impl.h:457
SPIGeometry3d m_geometry3d
Definition: domain.h:343
void update_domain_info()
updates the internal domain-info object.
Definition: domain_impl.h:212
position_attachment_type m_aPos
Position Attachment.
Definition: domain.h:341
position_accessor_type m_aaPos
Accessor.
Definition: domain.h:342
@ ES_H_SLAVE
Definition: distributed_grid.h:59
@ VRTOPT_STORE_ASSOCIATED_EDGES
Definition: grid_constants.h:48
@ VRTOPT_STORE_ASSOCIATED_FACES
Definition: grid_constants.h:49
@ VRTOPT_STORE_ASSOCIATED_VOLUMES
Definition: grid_constants.h:50
@ GRIDOPT_NONE
Definition: grid_constants.h:91
@ GRIDOPT_AUTOGENERATE_SIDES
sides are automatically created
Definition: grid_constants.h:102
#define PCL_RO_SUM
Definition: pcl_methods.h:63
int ProcRank()
returns the rank of the process
Definition: pcl_base.cpp:83
#define PCL_RO_MAX
Definition: pcl_methods.h:61
#define PCL_RO_MIN
Definition: pcl_methods.h:62
#define PCL_DT_INT
Definition: pcl_datatype.h:51
static const int dim
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_THROW(msg)
Definition: error.h:57
unsigned int uint
Definition: types.h:114
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition: bidirectional_boost.h:157
the ug namespace
SmartPtr< RefinementProjector > SPRefinementProjector
Definition: refinement_projector.h:185
boost::mpl::tmp::ProjectorTypes ProjectorTypes
Definition: projectors.h:84
@ GMCT_CREATION_STOPS
Definition: lib_grid_messages.h:191
void Deserialize(TIStream &buf, ParallelVector< T > &v)
Deerialize for ParallelVector<T>
Definition: restart_bridge.cpp:112
SPIGeometry3d MakeGeometry3d(Grid &grid, TAPos aPos)
Utility method to construct an IGeometry3d for a given grid and position attachment.
Definition: geometry.h:163
GridBaseObjectId
enumeration of the GridBaseObjects that make up a grid.
Definition: grid_base_objects.h:59
@ VOLUME
Definition: grid_base_objects.h:63
@ VERTEX
Definition: grid_base_objects.h:60
@ EDGE
Definition: grid_base_objects.h:61
@ FACE
Definition: grid_base_objects.h:62
@ INT_V_MASTER
vertical master node
Definition: parallel_grid_layout.h:106
void Serialize(TOStream &buf, const ParallelVector< T > &v)
Serialize for ParallelVector<T>
Definition: restart_bridge.cpp:103
#define PROFILE_FUNC()
Definition: profiler.h:257
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836