36 #ifndef PARALLELCELLSGENERATOR_HPP_ 37 #define PARALLELCELLSGENERATOR_HPP_ 41 #include "WildTypeCellMutationState.hpp" 42 #include "AbstractCellProperty.hpp" 43 #include "NodesOnlyMesh.hpp" 49 template<
class CELL_CYCLE_MODEL,
unsigned DIM>
52 friend class TestParallelCellsGenerator;
74 std::vector<CellPtr>& cells,
76 boost::shared_ptr<AbstractCellProperty> pCellProliferativeType=boost::shared_ptr<AbstractCellProperty>());
80 template<
class CELL_CYCLE_MODEL,
unsigned DIM>
87 for (
unsigned i=0; i<DIM; i++)
89 base_bounding_box[2*i] -= 1e-14;
90 base_bounding_box[2*i + 1] += 1e-14;
96 unsigned node_index = 0;
98 std::ifstream infile(archivePath.c_str(), std::ios::in);
101 std::getline(infile, line);
103 while (std::getline(infile, line))
106 std::istringstream iss(line);
109 c_vector<double, DIM> location;
110 for (
unsigned k=0; k<DIM; k++)
123 CELL_CYCLE_MODEL* p_cell_cycle_model =
new CELL_CYCLE_MODEL;
124 p_cell_cycle_model->SetDimension(DIM);
128 CellPtr p_cell(
new Cell(p_state, p_cell_cycle_model));
129 p_cell->SetCellProliferativeType(pCellProliferativeType);
130 cells.push_back(p_cell);
143 template<
class CELL_CYCLE_MODEL,
unsigned DIM>
146 c_vector<double, 2*DIM> bounding_box;
147 for (
unsigned i=0; i<DIM; i++)
149 bounding_box[2*i] = DBL_MAX;
150 bounding_box[2*i + 1] = -DBL_MAX;
153 std::ifstream infile(archivePath.c_str());
156 std::getline(infile, line);
158 std::istringstream iss(line);
162 unsigned file_dimension;
164 iss >> num_lines >> file_dimension;
166 if (file_dimension != DIM)
168 EXCEPTION(
"Space dimension of ParallelCellsGenerator and archive file do not match");
171 while (std::getline(infile, line))
173 std::stringstream new_iss(line);
174 for (
unsigned i=0; i<DIM; i++)
178 bounding_box[2*i] = (point < bounding_box[2*i]) ? point : bounding_box[2*i];
179 bounding_box[2*i+1] = (point > bounding_box[2*i+1]) ? point : bounding_box[2*i+1];
virtual unsigned GetMaximumNodeIndex()
#define EXCEPTION(message)
void ReMesh(NodeMap &rMap)
static CellPropertyRegistry * Instance()
double GetMaximumInteractionDistance()
void SetInitialBoxCollection(const c_vector< double, 2 *SPACE_DIM > domainSize, double maxInteractionDistance)
unsigned AddNode(Node< SPACE_DIM > *pNewNode)
bool IsOwned(c_vector< double, SPACE_DIM > &location)
void GenerateParallelCells(std::string archivePath, std::vector< CellPtr > &cells, NodesOnlyMesh< DIM > &mesh, boost::shared_ptr< AbstractCellProperty > pCellProliferativeType=boost::shared_ptr< AbstractCellProperty >())
c_vector< double, 2 *DIM > GetArchiveBoundingBox(std::string archivePath)