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>());
81 template<
class CELL_CYCLE_MODEL,
unsigned DIM>
85 c_vector<double, 2*DIM> base_bounding_box = GetArchiveBoundingBox(archivePath);
88 for (
unsigned i=0; i<DIM; i++)
90 base_bounding_box[2*i] -= 1e-14;
91 base_bounding_box[2*i + 1] += 1e-14;
97 unsigned node_index = 0;
99 std::ifstream infile(archivePath.c_str(), std::ios::in);
102 std::getline(infile, line);
104 while (std::getline(infile, line))
107 std::istringstream iss(line);
110 c_vector<double, DIM> location;
111 for (
unsigned k=0; k<DIM; k++)
124 CELL_CYCLE_MODEL* p_cell_cycle_model =
new CELL_CYCLE_MODEL;
125 p_cell_cycle_model->SetDimension(DIM);
129 CellPtr p_cell(
new Cell(p_state, p_cell_cycle_model));
130 p_cell->SetCellProliferativeType(pCellProliferativeType);
131 cells.push_back(p_cell);
144 template<
class CELL_CYCLE_MODEL,
unsigned DIM>
147 c_vector<double, 2*DIM> bounding_box;
148 for (
unsigned i=0; i<DIM; i++)
150 bounding_box[2*i] = DBL_MAX;
151 bounding_box[2*i + 1] = -DBL_MAX;
154 std::ifstream infile(archivePath.c_str());
157 std::getline(infile, line);
159 std::istringstream iss(line);
163 unsigned file_dimension;
165 iss >> num_lines >> file_dimension;
167 if (file_dimension != DIM)
169 EXCEPTION(
"Space dimension of ParallelCellsGenerator and archive file do not match");
172 while (std::getline(infile, line))
174 std::stringstream new_iss(line);
175 for (
unsigned i=0; i<DIM; i++)
179 bounding_box[2*i] = (point < bounding_box[2*i]) ? point : bounding_box[2*i];
180 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)