37#include "Cylindrical2dNodesOnlyMesh.hpp"
49 if (fmod(
mWidth,cutOffLength ) > 1e-14)
51 EXCEPTION(
"The periodic width must be a multiple of cut off length.");
53 else if (
mWidth/cutOffLength == 2.0)
56 EXCEPTION(
"The periodic domain width cannot be 2*CutOffLength." );
64 isDimPeriodic = zero_vector<bool>(2);
65 isDimPeriodic[0] =
true;
76 assert(rDimension==0 || rDimension==1);
92 assert(!concreteMove);
102 else if (x_coord < 0.0)
104 double new_x_coord = x_coord +
mWidth;
105 double fudge_factor = 1e-14;
108 if (new_x_coord >
mWidth-fudge_factor)
110 new_x_coord =
mWidth-fudge_factor;
116 this->
GetNode(nodeIndex)->SetPoint(point);
126 SetNode(node_index, new_node_point);
134 c_vector<double, 2> vector = rLocation2 - rLocation1;
135 vector[0] = fmod(vector[0],
mWidth);
141 if (vector[0] > 0.5*
mWidth)
145 else if (vector[0] < -0.5*
mWidth)
157 unsigned num_nodes =
mNodes.size();
158 for (
unsigned i=0; i<num_nodes; i++)
160 double& x_location = (
mNodes[i]->rGetModifiableLocation())[0];
161 if (x_location < 0.0)
165 else if (x_location >=
mWidth)
167 x_location = fmod(x_location,
mWidth);
#define EXCEPTION(message)
#define CHASTE_CLASS_EXPORT(T)
virtual void RefreshMesh()
virtual double GetWidth(const unsigned &rDimension) const
Node< SPACE_DIM > * GetNode(unsigned index) const
std::vector< Node< SPACE_DIM > * > mNodes
c_vector< double, DIM > & rGetLocation()
void SetCoordinate(unsigned i, double value)
double GetWidth(const unsigned &rDimension) const
Cylindrical2dNodesOnlyMesh(double width)
unsigned AddNode(Node< 2 > *pNewNode)
virtual void SetUpBoxCollection(double cutOffLength, c_vector< double, 2 *2 > domainSize, int numLocalRows=PETSC_DECIDE, c_vector< bool, 2 > isDimPeriodic=unit_vector< bool >(2, 0))
void SetNode(unsigned nodeIndex, ChastePoint< 2 > point, bool concreteMove=false)
c_vector< double, 2 > GetVectorFromAtoB(const c_vector< double, 2 > &rLocation1, const c_vector< double, 2 > &rLocation2)
ChastePoint< SPACE_DIM > GetPoint() const
unsigned AddNode(Node< SPACE_DIM > *pNewNode)
void SetUpBoxCollection(const std::vector< Node< SPACE_DIM > * > &rNodes)