Chaste  Release::3.4
NodesOnlyMesh.cpp
1 /*
2 
3 Copyright (c) 2005-2016, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include <map>
37 #include "NodesOnlyMesh.hpp"
38 #include "ChasteCuboid.hpp"
39 
40 template<unsigned SPACE_DIM>
42  : MutableMesh<SPACE_DIM, SPACE_DIM>(),
43  mMaximumInteractionDistance(1.0),
44  mIndexCounter(0u),
45  mMinimumNodeDomainBoundarySeparation(1.0),
46  mMaxAddedNodeIndex(0u),
47  mpBoxCollection(NULL),
48  mCalculateNodeNeighbours(true)
49 {
50 }
51 
52 template<unsigned SPACE_DIM>
54 {
55  Clear();
56  ClearBoxCollection();
57 }
58 
59 template<unsigned SPACE_DIM>
60 void NodesOnlyMesh<SPACE_DIM>::ConstructNodesWithoutMesh(const std::vector<Node<SPACE_DIM>*>& rNodes, double maxInteractionDistance)
61 {
62  assert(maxInteractionDistance > 0.0 && maxInteractionDistance < DBL_MAX);
63  mMaximumInteractionDistance = maxInteractionDistance;
64 
65  mMinimumNodeDomainBoundarySeparation = mMaximumInteractionDistance;
66 
67  Clear();
68 
69  SetUpBoxCollection(rNodes);
70 
71  mLocalInitialNodes.resize(rNodes.size(), false);
72 
73  for (unsigned i=0; i<rNodes.size(); i++)
74  {
75  if (mpBoxCollection->IsOwned(rNodes[i]))
76  {
77  mLocalInitialNodes[i] = true;
78 
79  assert(!rNodes[i]->IsDeleted());
80  c_vector<double, SPACE_DIM> location = rNodes[i]->rGetLocation();
81 
82  Node<SPACE_DIM>* p_node_copy = new Node<SPACE_DIM>(GetNextAvailableIndex(), location);
83  p_node_copy->SetRadius(0.5); // Default value.
84 
85  this->mNodes.push_back(p_node_copy);
86 
87  // Update the node map
88  mNodesMapping[p_node_copy->GetIndex()] = this->mNodes.size()-1;
89  }
90  }
91 }
92 
93 template<unsigned SPACE_DIM>
94 void NodesOnlyMesh<SPACE_DIM>::ConstructNodesWithoutMesh(const AbstractMesh<SPACE_DIM,SPACE_DIM>& rGeneratingMesh, double maxInteractionDistance)
95 {
96  ConstructNodesWithoutMesh(rGeneratingMesh.mNodes, maxInteractionDistance);
97 }
98 
99 template<unsigned SPACE_DIM>
101 {
102  return mLocalInitialNodes;
103 }
104 
105 template<unsigned SPACE_DIM>
106 unsigned NodesOnlyMesh<SPACE_DIM>::SolveNodeMapping(unsigned index) const
107 {
108  std::map<unsigned, unsigned>::const_iterator node_position = mNodesMapping.find(index);
109 
110  if (node_position == mNodesMapping.end())
111  {
112  EXCEPTION("Requested node " << index << " does not belong to process " << PetscTools::GetMyRank());
113  }
114 
115  return node_position->second;
116 }
117 
118 template<unsigned SPACE_DIM>
120 {
121  // Call Clear() on the parent class
123 
124  // Clear the nodes mapping
125  mNodesMapping.clear();
126 
127  mIndexCounter = 0;
128 }
129 
130 template<unsigned SPACE_DIM>
132 {
133  return mpBoxCollection;
134 }
135 
136 template <unsigned SPACE_DIM>
138 {
139  Node<SPACE_DIM>* p_node;
140 
141  std::map<unsigned, unsigned>::const_iterator node_position = mHaloNodesMapping.find(index);
142 
143  if (node_position != mHaloNodesMapping.end())
144  {
145  p_node = mHaloNodes[node_position->second].get();
146  }
147  else
148  {
149  p_node = this->GetNode(index);
150  }
151 
152  assert(p_node != NULL);
153 
154  return p_node;
155 }
156 
157 template<unsigned SPACE_DIM>
158 bool NodesOnlyMesh<SPACE_DIM>::IsOwned(c_vector<double, SPACE_DIM>& location)
159 {
160  return mpBoxCollection->IsOwned(location);
161 }
162 
163 template<unsigned SPACE_DIM>
165 {
166  return this->mNodes.size() - this->mDeletedNodeIndices.size();
167 }
168 
169 template<unsigned SPACE_DIM>
171 {
172  return std::max(mIndexCounter* PetscTools::GetNumProcs() + PetscTools::GetMyRank(), mMaxAddedNodeIndex);
173 }
174 
175 template<unsigned SPACE_DIM>
177 {
178  mMaximumInteractionDistance = maxDistance;
179 }
180 
181 template<unsigned SPACE_DIM>
183 {
184  return mMaximumInteractionDistance;
185 }
186 
187 template<unsigned SPACE_DIM>
188 double NodesOnlyMesh<SPACE_DIM>::GetWidth(const unsigned& rDimension) const
189 {
190  double local_width = AbstractMesh<SPACE_DIM, SPACE_DIM>::GetWidth(rDimension);
191  double global_width;
192 
193  MPI_Allreduce(&local_width, &global_width, 1, MPI_DOUBLE, MPI_MAX, PetscTools::GetWorld());
194 
195  return global_width;
196 }
197 
198 template<unsigned SPACE_DIM>
200 {
201  mCalculateNodeNeighbours = calculateNodeNeighbours;
202 }
203 
204 template<unsigned SPACE_DIM>
205 void NodesOnlyMesh<SPACE_DIM>::CalculateInteriorNodePairs(std::vector<std::pair<Node<SPACE_DIM>*, Node<SPACE_DIM>*> >& rNodePairs, std::map<unsigned, std::set<unsigned> >& rNodeNeighbours)
206 {
207  assert(mpBoxCollection);
208 
209  mpBoxCollection->CalculateInteriorNodePairs(this->mNodes, rNodePairs, rNodeNeighbours);
210 }
211 
212 template<unsigned SPACE_DIM>
213 void NodesOnlyMesh<SPACE_DIM>::CalculateBoundaryNodePairs(std::vector<std::pair<Node<SPACE_DIM>*, Node<SPACE_DIM>*> >& rNodePairs, std::map<unsigned, std::set<unsigned> >& rNodeNeighbours)
214 {
215  assert(mpBoxCollection);
216 
217  mpBoxCollection->CalculateBoundaryNodePairs(this->mNodes, rNodePairs, rNodeNeighbours);
218 }
219 
220 template<unsigned SPACE_DIM>
222 {
223  map.ResetToIdentity();
224 
225  RemoveDeletedNodes(map);
226 
227  this->mDeletedNodeIndices.clear();
228  this->mAddedNodes = false;
229 
230  UpdateNodeIndices();
231 
232  this->SetMeshHasChangedSinceLoading();
233 }
234 
235 template<unsigned SPACE_DIM>
237 {
238  typename std::vector<Node<SPACE_DIM>* >::iterator node_iter = this->mNodes.begin();
239  while (node_iter != this->mNodes.end())
240  {
241  if ((*node_iter)->IsDeleted())
242  {
243  map.SetDeleted((*node_iter)->GetIndex());
244 
245  mNodesMapping.erase((*node_iter)->GetIndex());
246 
247  // Free memory before erasing the pointer from the list of nodes.
248  delete (*node_iter);
249  node_iter = this->mNodes.erase(node_iter);
250  }
251  else
252  {
253  ++node_iter;
254  }
255  }
256 }
257 
258 template<unsigned SPACE_DIM>
260 {
261  mNodesMapping.clear();
262  for (unsigned location_in_vector=0; location_in_vector < this->mNodes.size(); location_in_vector++)
263  {
264  unsigned global_index = this->mNodes[location_in_vector]->GetIndex();
265  mNodesMapping[global_index] = location_in_vector;
266  }
267 }
268 
269 template<unsigned SPACE_DIM>
271 {
272  mNodesToSendRight.clear();
273  mNodesToSendLeft.clear();
274 
275  for (typename AbstractMesh<SPACE_DIM, SPACE_DIM>::NodeIterator node_iter = this->GetNodeIteratorBegin();
276  node_iter != this->GetNodeIteratorEnd();
277  ++node_iter)
278  {
279  unsigned owning_process = mpBoxCollection->GetProcessOwningNode(&(*node_iter));
280  if (owning_process == PetscTools::GetMyRank())
281  {
282  // Do nothing.
283  }
284  else if (owning_process == PetscTools::GetMyRank() + 1)
285  {
286  mNodesToSendRight.push_back(node_iter->GetIndex());
287  }
288  else if (owning_process == PetscTools::GetMyRank() - 1)
289  {
290  mNodesToSendLeft.push_back(node_iter->GetIndex());
291  }
292  }
293 }
294 
295 template<unsigned SPACE_DIM>
297 {
298  return mNodesToSendLeft;
299 }
300 
301 template<unsigned SPACE_DIM>
303 {
304  return mNodesToSendRight;
305 }
306 
307 template<unsigned SPACE_DIM>
309 {
310  return mpBoxCollection->rGetHaloNodesRight();
311 }
312 
313 template<unsigned SPACE_DIM>
315 {
316  return mpBoxCollection->rGetHaloNodesLeft();
317 }
318 
319 template<unsigned SPACE_DIM>
321 {
322  unsigned location_in_nodes_vector = 0;
323 
324  if (this->mDeletedNodeIndices.empty())
325  {
326  this->mNodes.push_back(pNewNode);
327  location_in_nodes_vector = this->mNodes.size() - 1;
328  }
329  else
330  {
331  location_in_nodes_vector = this->mDeletedNodeIndices.back();
332  this->mDeletedNodeIndices.pop_back();
333  delete this->mNodes[location_in_nodes_vector];
334  this->mNodes[location_in_nodes_vector] = pNewNode;
335  }
336 
337  this->mAddedNodes = true;
338 
339  mMaxAddedNodeIndex = (pNewNode->GetIndex() > mMaxAddedNodeIndex) ? pNewNode->GetIndex() : mMaxAddedNodeIndex;
340 
341  // Update mNodesMapping
342  mNodesMapping[pNewNode->GetIndex()] = location_in_nodes_vector;
343 
344  // Then update cell radius to default.
345  pNewNode->SetRadius(0.5);
346 }
347 
348 template<unsigned SPACE_DIM>
349 void NodesOnlyMesh<SPACE_DIM>::AddHaloNode(boost::shared_ptr<Node<SPACE_DIM> > pNewNode)
350 {
351  mHaloNodes.push_back(pNewNode);
352  mHaloNodesMapping[pNewNode->GetIndex()] = mHaloNodes.size() - 1;
353 }
354 
355 template<unsigned SPACE_DIM>
357 {
358  mHaloNodes.clear();
359 
360  mHaloNodesMapping.clear();
361 }
362 
363 template<unsigned SPACE_DIM>
365 {
366  unsigned fresh_global_index = GetNextAvailableIndex();
367  pNewNode->SetIndex(fresh_global_index);
368 
369  AddNodeWithFixedIndex(pNewNode);
370 
371  return fresh_global_index;
372 }
373 
374 template<unsigned SPACE_DIM>
375 void NodesOnlyMesh<SPACE_DIM>::SetNode(unsigned nodeIndex, ChastePoint<SPACE_DIM> point, bool concreteMove)
376 {
377  // concreteMove should always be false for a NodesOnlyMesh as there are no elements to check
378  assert(!concreteMove);
379 
380  // Update the node's location
381  this->GetNode(nodeIndex)->SetPoint(point);
382 }
383 
384 template<unsigned SPACE_DIM>
385 void NodesOnlyMesh<SPACE_DIM>::AddMovedNode(boost::shared_ptr<Node<SPACE_DIM> > pMovedNode)
386 {
387  // Make a deep copy of this node pointer so that it isn't accidentally deleted.
388  unsigned index = pMovedNode->GetIndex();
389  c_vector<double, SPACE_DIM> location = pMovedNode->rGetLocation();
390 
391  Node<SPACE_DIM>* p_node = new Node<SPACE_DIM>(index, location);
392 
393  if (pMovedNode->HasNodeAttributes())
394  {
395  double radius = pMovedNode->GetRadius();
396  p_node->SetRadius(radius);
397 
398  unsigned region = pMovedNode->GetRegion();
399  p_node->SetRegion(region);
400 
401  bool is_particle = pMovedNode->IsParticle();
402  p_node->SetIsParticle(is_particle);
403 
404  for (unsigned i=0; i<pMovedNode->GetNumNodeAttributes(); i++)
405  {
406  double attribute = pMovedNode->rGetNodeAttributes()[i];
407  p_node->AddNodeAttribute(attribute);
408  }
409  }
410 
411  AddNodeWithFixedIndex(p_node);
412 }
413 
414 template<unsigned SPACE_DIM>
416 {
417  if (this->GetNode(index)->IsDeleted())
418  {
419  EXCEPTION("Trying to delete a deleted node");
420  }
421 
422  unsigned local_index = SolveNodeMapping(index);
423 
424  this->mNodes[local_index]->MarkAsDeleted();
425  this->mDeletedNodeIndices.push_back(local_index);
426  mDeletedGlobalNodeIndices.push_back(index);
427 }
428 
429 template<unsigned SPACE_DIM>
431 {
432  DeleteNode(index);
433 
434  // Remove index from deleted indices, as moved indices must not be re-used.
435  mDeletedGlobalNodeIndices.pop_back();
436 }
437 
438 template<unsigned SPACE_DIM>
440 {
441  assert(!(separation < 0.0));
442 
443  mMinimumNodeDomainBoundarySeparation = separation;
444 }
445 
446 template<unsigned SPACE_DIM>
448 {
449  unsigned index;
450 
451  if (!this->mDeletedGlobalNodeIndices.empty())
452  {
453  index = this->mDeletedGlobalNodeIndices.back();
454  this->mDeletedGlobalNodeIndices.pop_back();
455  }
456  else
457  {
458  unsigned counter = mIndexCounter;
459  mIndexCounter++;
460  index = counter * PetscTools::GetNumProcs() + PetscTools::GetMyRank();
461  }
462 
463  return index;
464 }
465 
466 template<unsigned SPACE_DIM>
468 {
469  assert(mpBoxCollection);
470 
471  int num_local_rows = mpBoxCollection->GetNumLocalRows();
472  int new_local_rows = num_local_rows + (int)(PetscTools::AmTopMost()) + (int)(PetscTools::AmMaster());
473 
474  c_vector<double, 2*SPACE_DIM> current_domain_size = mpBoxCollection->rGetDomainSize();
475  c_vector<double, 2*SPACE_DIM> new_domain_size;
476 
477  double fudge = 1e-14;
478  for (unsigned d=0; d < SPACE_DIM; d++)
479  {
480  new_domain_size[2*d] = current_domain_size[2*d] - (mMaximumInteractionDistance - fudge);
481  new_domain_size[2*d+1] = current_domain_size[2*d+1] + (mMaximumInteractionDistance - fudge);
482  }
483 
484  SetUpBoxCollection(mMaximumInteractionDistance, new_domain_size, new_local_rows);
485 }
486 
487 template<unsigned SPACE_DIM>
489 {
490  assert(mpBoxCollection);
491 
492  int is_local_node_close = 0;
493  c_vector<double, 2*SPACE_DIM> domain_boundary = mpBoxCollection->rGetDomainSize();
494 
495  for (typename AbstractMesh<SPACE_DIM, SPACE_DIM>::NodeIterator node_iter = this->GetNodeIteratorBegin();
496  node_iter != this->GetNodeIteratorEnd();
497  ++node_iter)
498  {
499  // Note that we define this vector before setting it as otherwise the profiling build will break (see #2367)
500  c_vector<double, SPACE_DIM> location;
501  location = node_iter->rGetLocation();
502 
503  for (unsigned d=0; d<SPACE_DIM; d++)
504  {
505  if (location[d] < (domain_boundary[2*d] + mMinimumNodeDomainBoundarySeparation) || location[d] > (domain_boundary[2*d+1] - mMinimumNodeDomainBoundarySeparation))
506  {
507  is_local_node_close = 1;
508  break;
509  }
510  }
511  if (is_local_node_close)
512  {
513  break; // Saves checking every node if we find one close to the boundary
514  }
515  }
516 
517  // Synchronise between processes
518  int is_any_node_close = 0;
519  MPI_Allreduce(&is_local_node_close, &is_any_node_close, 1, MPI_INT, MPI_SUM, PetscTools::GetWorld());
520 
521  return (is_any_node_close > 0);
522 }
523 
524 template<unsigned SPACE_DIM>
526 {
527  if (mpBoxCollection)
528  {
529  delete mpBoxCollection;
530  }
531  mpBoxCollection = NULL;
532 }
533 
534 template<unsigned SPACE_DIM>
535 void NodesOnlyMesh<SPACE_DIM>::SetInitialBoxCollection(const c_vector<double, 2*SPACE_DIM> domainSize, double maxInteractionDistance)
536 {
537  this->SetUpBoxCollection(maxInteractionDistance, domainSize);
538 }
539 
540 template<unsigned SPACE_DIM>
542 {
543  ClearBoxCollection();
544 
545  ChasteCuboid<SPACE_DIM> bounding_box = this->CalculateBoundingBox(rNodes);
546 
547  c_vector<double, 2*SPACE_DIM> domain_size;
548  for (unsigned i=0; i < SPACE_DIM; i++)
549  {
550  domain_size[2*i] = bounding_box.rGetLowerCorner()[i] - 1e-14;
551  domain_size[2*i+1] = bounding_box.rGetUpperCorner()[i] + 1e-14;
552  }
553 
554  SetUpBoxCollection(mMaximumInteractionDistance, domain_size);
555 }
556 
557 template<unsigned SPACE_DIM>
558 void NodesOnlyMesh<SPACE_DIM>::SetUpBoxCollection(double cutOffLength, c_vector<double, 2*SPACE_DIM> domainSize, int numLocalRows, bool isPeriodic)
559 {
560  ClearBoxCollection();
561 
562  mpBoxCollection = new DistributedBoxCollection<SPACE_DIM>(cutOffLength, domainSize, isPeriodic, numLocalRows);
563  mpBoxCollection->SetupLocalBoxesHalfOnly();
564  mpBoxCollection->SetupHaloBoxes();
565  mpBoxCollection->SetCalculateNodeNeighbours(mCalculateNodeNeighbours);
566 }
567 
568 template<unsigned SPACE_DIM>
570 {
571  // Put the nodes in the boxes.
572  for (typename AbstractMesh<SPACE_DIM, SPACE_DIM>::NodeIterator node_iter = this->GetNodeIteratorBegin();
573  node_iter != this->GetNodeIteratorEnd();
574  ++node_iter)
575  {
576  unsigned box_index = mpBoxCollection->CalculateContainingBox(&(*node_iter));
577  mpBoxCollection->rGetBox(box_index).AddNode(&(*node_iter));
578  }
579 }
580 
581 template<unsigned SPACE_DIM>
583 {
584  // Add halo nodes
585  for (typename std::vector<boost::shared_ptr<Node<SPACE_DIM> > >::iterator halo_node_iter = mHaloNodes.begin();
586  halo_node_iter != mHaloNodes.end();
587  ++halo_node_iter)
588  {
589  unsigned box_index = mpBoxCollection->CalculateContainingBox((*halo_node_iter).get());
590  mpBoxCollection->rGetHaloBox(box_index).AddNode((*halo_node_iter).get());
591  }
592 }
593 
594 template<unsigned SPACE_DIM>
596 {
597  assert(mpBoxCollection);
598 
599  // Remove node pointers from boxes in BoxCollection.
600  mpBoxCollection->EmptyBoxes();
601 
602  AddNodesToBoxes();
603 
604  mpBoxCollection->UpdateHaloBoxes();
605 }
606 
607 template<unsigned SPACE_DIM>
609 {
610  if (!mpBoxCollection)
611  {
612  SetUpBoxCollection(this->mNodes);
613  }
614 
615  while (IsANodeCloseToDomainBoundary())
616  {
617  EnlargeBoxCollection();
618  }
619 }
620 
621 template<unsigned SPACE_DIM>
623 {
624  std::vector<int> local_node_distribution = mpBoxCollection->CalculateNumberOfNodesInEachStrip();
625 
626  unsigned new_rows = mpBoxCollection->LoadBalance(local_node_distribution);
627 
628  c_vector<double, 2*SPACE_DIM> current_domain_size = mpBoxCollection->rGetDomainSize();
629 
630  // This ensures the domain will stay the same size.
631  double fudge = 1e-14;
632  for (unsigned d=0; d < SPACE_DIM; d++)
633  {
634  current_domain_size[2*d] = current_domain_size[2*d] + fudge;
635  current_domain_size[2*d+1] = current_domain_size[2*d+1] - fudge;
636  }
637  SetUpBoxCollection(mMaximumInteractionDistance, current_domain_size, new_rows);
638 }
639 
640 template<unsigned SPACE_DIM>
642 {
644 
645  // Set the correct global node indices
646  for (unsigned i=0; i<this->mNodes.size(); i++)
647  {
648  this->mNodes[i]->SetIndex(GetNextAvailableIndex());
649  }
650 }
651 
653 // Explicit instantiation
655 
656 template class NodesOnlyMesh<1>;
657 template class NodesOnlyMesh<2>;
658 template class NodesOnlyMesh<3>;
659 
660 // Serialization for Boost >= 1.36
bool IsANodeCloseToDomainBoundary()
std::vector< unsigned > & rGetNodesToSendLeft()
virtual unsigned GetMaximumNodeIndex()
std::vector< unsigned > & rGetHaloNodesToSendLeft()
void EnlargeBoxCollection()
void SetNode(unsigned nodeIndex, ChastePoint< SPACE_DIM > point, bool concreteMove=false)
Definition: Node.hpp:58
void LoadBalanceMesh()
void AddNodeAttribute(double attribute)
Definition: Node.cpp:171
void SetRadius(double radius)
Definition: Node.cpp:257
std::vector< bool > & rGetInitiallyOwnedNodes()
#define EXCEPTION(message)
Definition: Exception.hpp:143
Node< SPACE_DIM > * GetNodeOrHaloNode(unsigned index) const
static bool AmMaster()
Definition: PetscTools.cpp:120
void ConstructFromMeshReader(AbstractMeshReader< SPACE_DIM, SPACE_DIM > &rMeshReader)
void ConstructFromMeshReader(AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
void AddNodeWithFixedIndex(Node< SPACE_DIM > *pNewNode)
void ResetToIdentity()
Definition: NodeMap.cpp:57
static MPI_Comm GetWorld()
Definition: PetscTools.cpp:174
void SetIndex(unsigned index)
Definition: Node.cpp:121
void SetUpBoxCollection(const std::vector< Node< SPACE_DIM > * > &rNodes)
std::vector< unsigned > & rGetHaloNodesToSendRight()
const ChastePoint< SPACE_DIM > & rGetUpperCorner() const
void SetCalculateNodeNeighbours(bool calculateNodeNeighbours)
void AddHaloNodesToBoxes()
std::vector< Node< SPACE_DIM > * > mNodes
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
void DeleteNode(unsigned index)
double GetWidth(const unsigned &rDimension) const
void SetIsParticle(bool isParticle)
Definition: Node.cpp:241
double GetMaximumInteractionDistance()
void DeleteMovedNode(unsigned index)
unsigned GetNextAvailableIndex()
void RemoveDeletedNodes(NodeMap &map)
void ResizeBoxCollection()
void SetDeleted(unsigned index)
Definition: NodeMap.cpp:75
unsigned SolveNodeMapping(unsigned index) const
void SetInitialBoxCollection(const c_vector< double, 2 *SPACE_DIM > domainSize, double maxInteractionDistance)
void SetMaximumInteractionDistance(double maxDistance)
void UpdateBoxCollection()
void AddHaloNode(boost::shared_ptr< Node< SPACE_DIM > > pNewNode)
void CalculateNodesOutsideLocalDomain()
void ConstructNodesWithoutMesh(const std::vector< Node< SPACE_DIM > * > &rNodes, double maxInteractionDistance)
void SetRegion(unsigned region)
Definition: Node.cpp:371
void SetMinimumNodeDomainBoundarySeparation(double separation)
unsigned AddNode(Node< SPACE_DIM > *pNewNode)
DistributedBoxCollection< SPACE_DIM > * GetBoxCollection()
void CalculateBoundaryNodePairs(std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &rNodePairs, std::map< unsigned, std::set< unsigned > > &rNodeNeighbours)
std::vector< unsigned > & rGetNodesToSendRight()
virtual double GetWidth(const unsigned &rDimension) const
void CalculateInteriorNodePairs(std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &rNodePairs, std::map< unsigned, std::set< unsigned > > &rNodeNeighbours)
static bool AmTopMost()
Definition: PetscTools.cpp:126
void AddNodesToBoxes()
bool IsOwned(c_vector< double, SPACE_DIM > &location)
static unsigned GetNumProcs()
Definition: PetscTools.cpp:108
void ClearBoxCollection()
unsigned GetIndex() const
Definition: Node.cpp:159
static unsigned GetMyRank()
Definition: PetscTools.cpp:114
void UpdateNodeIndices()
void AddMovedNode(boost::shared_ptr< Node< SPACE_DIM > > pMovedNode)
virtual ~NodesOnlyMesh()
double GetRadius()
Definition: Node.cpp:249
unsigned GetNumNodes() const
const ChastePoint< SPACE_DIM > & rGetLowerCorner() const