45template<
unsigned SPACE_DIM>
49 mIsBoundaryNode = isBoundaryNode;
52 mpNodeAttributes =
nullptr;
55template<
unsigned SPACE_DIM>
59 CommonConstructor(index, isBoundaryNode);
62template<
unsigned SPACE_DIM>
65 for (
unsigned i=0; i<SPACE_DIM; i++)
67 mLocation(i) = coords.at(i);
69 CommonConstructor(index, isBoundaryNode);
72template<
unsigned SPACE_DIM>
76 CommonConstructor(index, isBoundaryNode);
79template<
unsigned SPACE_DIM>
91 CommonConstructor(index, isBoundaryNode);
94template<
unsigned SPACE_DIM>
97 for (
unsigned i=0; i<SPACE_DIM; i++)
99 mLocation(i) = location[i];
101 CommonConstructor(index, isBoundaryNode);
104template<
unsigned SPACE_DIM>
107 delete mpNodeAttributes;
114template<
unsigned SPACE_DIM>
120template<
unsigned SPACE_DIM>
126template<
unsigned SPACE_DIM>
129 mIsBoundaryNode = value;
132template<
unsigned SPACE_DIM>
138template<
unsigned SPACE_DIM>
150template<
unsigned SPACE_DIM>
157template<
unsigned SPACE_DIM>
163template<
unsigned SPACE_DIM>
166 return mIsBoundaryNode;
169template<
unsigned SPACE_DIM>
172 ConstructNodeAttributes();
174 mpNodeAttributes->AddAttribute(attribute);
177template<
unsigned SPACE_DIM>
180 CheckForNodeAttributes();
182 return mpNodeAttributes->rGetAttributes();
185template<
unsigned SPACE_DIM>
188 unsigned num_attributes;
189 if (!mpNodeAttributes)
195 num_attributes = mpNodeAttributes->rGetAttributes().size();
198 return num_attributes;
201template<
unsigned SPACE_DIM>
204 return (mpNodeAttributes !=
nullptr);
207template<
unsigned SPACE_DIM>
210 CheckForNodeAttributes();
212 return mpNodeAttributes->rGetAppliedForce();
215template<
unsigned SPACE_DIM>
218 ConstructNodeAttributes();
220 mpNodeAttributes->ClearAppliedForce();
223template<
unsigned SPACE_DIM>
226 ConstructNodeAttributes();
228 mpNodeAttributes->AddAppliedForceContribution(rForceContribution);
231template<
unsigned SPACE_DIM>
234 CheckForNodeAttributes();
236 return mpNodeAttributes->IsParticle();
239template<
unsigned SPACE_DIM>
242 ConstructNodeAttributes();
244 mpNodeAttributes->SetIsParticle(isParticle);
247template<
unsigned SPACE_DIM>
250 CheckForNodeAttributes();
252 return mpNodeAttributes->GetRadius();
255template<
unsigned SPACE_DIM>
258 ConstructNodeAttributes();
260 mpNodeAttributes->SetRadius(radius);
267template<
unsigned SPACE_DIM>
270 mElementIndices.insert(index);
273template<
unsigned SPACE_DIM>
276 unsigned count = mElementIndices.erase(index);
279 EXCEPTION(
"Tried to remove an index which was not in the set");
283template<
unsigned SPACE_DIM>
286 unsigned count = mBoundaryElementIndices.erase(index);
289 EXCEPTION(
"Tried to remove an index which was not in the set");
293template<
unsigned SPACE_DIM>
296 mBoundaryElementIndices.insert(index);
299template<
unsigned SPACE_DIM>
302 return mElementIndices;
305template<
unsigned SPACE_DIM>
308 return mBoundaryElementIndices;
311template<
unsigned SPACE_DIM>
314 return mElementIndices.size();
317template<
unsigned SPACE_DIM>
320 return mBoundaryElementIndices.size();
327template<
unsigned SPACE_DIM>
330 ConstructNodeAttributes();
332 return mpNodeAttributes->AddNeighbour(index);
335template<
unsigned SPACE_DIM>
338 ConstructNodeAttributes();
340 mpNodeAttributes->ClearNeighbours();
343template<
unsigned SPACE_DIM>
346 CheckForNodeAttributes();
348 mpNodeAttributes->RemoveDuplicateNeighbours();
351template<
unsigned SPACE_DIM>
354 CheckForNodeAttributes();
356 return mpNodeAttributes->NeighboursIsEmpty();
359template<
unsigned SPACE_DIM>
362 ConstructNodeAttributes();
364 mpNodeAttributes->SetNeighboursSetUp(flag);
367template<
unsigned SPACE_DIM>
370 CheckForNodeAttributes();
372 return mpNodeAttributes->GetNeighboursSetUp();
375template<
unsigned SPACE_DIM>
378 CheckForNodeAttributes();
380 return mpNodeAttributes->rGetNeighbours();
387template<
unsigned SPACE_DIM>
390 if (mpNodeAttributes ==
nullptr)
392 EXCEPTION(
"Node has no attributes associated with it. Construct attributes first");
396template<
unsigned SPACE_DIM>
399 if (mpNodeAttributes ==
nullptr)
405template<
unsigned SPACE_DIM>
411template<
unsigned SPACE_DIM>
417template<
unsigned SPACE_DIM>
423template<
unsigned SPACE_DIM>
429template<
unsigned SPACE_DIM>
432 ConstructNodeAttributes();
433 mpNodeAttributes->SetRegion(region);
436template<
unsigned SPACE_DIM>
441 if (mpNodeAttributes)
443 region = mpNodeAttributes->GetRegion();
#define EXCEPTION(message)
c_vector< double, DIM > & rGetLocation()
void SetPoint(ChastePoint< SPACE_DIM > point)
std::set< unsigned > & rGetContainingElementIndices()
void SetRegion(unsigned region)
void AddNodeAttribute(double attribute)
c_vector< double, SPACE_DIM > & rGetAppliedForce()
std::vector< double > & rGetNodeAttributes()
c_vector< double, SPACE_DIM > & rGetModifiableLocation()
void AddNeighbour(unsigned index)
void SetIndex(unsigned index)
void RemoveDuplicateNeighbours()
void SetRadius(double radius)
unsigned GetNumContainingElements() const
std::set< unsigned > & rGetContainingBoundaryElementIndices()
void AddElement(unsigned index)
Node(unsigned index, ChastePoint< SPACE_DIM > point, bool isBoundaryNode=false)
void CommonConstructor(unsigned index, bool isBoundaryNode)
unsigned GetNumBoundaryElements() const
void AddBoundaryElement(unsigned index)
void RemoveBoundaryElement(unsigned index)
const c_vector< double, SPACE_DIM > & rGetLocation() const
bool GetNeighboursSetUp()
bool IsBoundaryNode() const
ChastePoint< SPACE_DIM > GetPoint() const
unsigned GetIndex() const
void SetAsBoundaryNode(bool value=true)
void AddAppliedForceContribution(const c_vector< double, SPACE_DIM > &rForceContribution)
unsigned GetNumNodeAttributes()
void SetIsParticle(bool isParticle)
std::vector< unsigned > & rGetNeighbours()
void SetNeighboursSetUp(bool flag)
void ConstructNodeAttributes()
void CheckForNodeAttributes() const
unsigned GetRegion() const
void RemoveElement(unsigned index)