36 #include "CellPopulationElementWriter.hpp"
37 #include "AbstractCellPopulation.hpp"
38 #include "MeshBasedCellPopulation.hpp"
39 #include "CaBasedCellPopulation.hpp"
40 #include "NodeBasedCellPopulation.hpp"
41 #include "PottsBasedCellPopulation.hpp"
42 #include "VertexBasedCellPopulation.hpp"
44 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
50 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
57 bool element_contains_dead_cells_or_deleted_nodes =
false;
60 for (
unsigned i=0; i<ELEMENT_DIM+1; i++)
62 unsigned node_index = elem_iter->GetNodeGlobalIndex(i);
64 if (pCellPopulation->
GetNode(node_index)->IsDeleted())
66 element_contains_dead_cells_or_deleted_nodes =
true;
73 element_contains_dead_cells_or_deleted_nodes =
true;
78 if (!element_contains_dead_cells_or_deleted_nodes)
80 for (
unsigned i=0; i<ELEMENT_DIM+1; i++)
82 *this->mpOutStream << elem_iter->GetNodeGlobalIndex(i) <<
" ";
88 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
91 EXCEPTION(
"CellPopulationElementWriter cannot be used with a CaBasedCellPopulation");
94 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
97 EXCEPTION(
"CellPopulationElementWriter cannot be used with a NodeBasedCellPopulation");
100 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
105 cell_iter != pCellPopulation->
End();
111 bool elem_corresponds_to_dead_cell =
false;
119 if (!(pCellPopulation->
GetElement(elem_index)->IsDeleted()) && !elem_corresponds_to_dead_cell)
122 unsigned num_nodes_in_element = p_element->
GetNumNodes();
125 *this->mpOutStream << num_nodes_in_element <<
" ";
128 for (
unsigned i=0; i<num_nodes_in_element; i++)
136 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
141 cell_iter != pCellPopulation->
End();
147 bool elem_corresponds_to_dead_cell =
false;
155 if (!(pCellPopulation->
GetElement(elem_index)->IsDeleted()) && !elem_corresponds_to_dead_cell)
158 unsigned num_nodes_in_element = p_element->
GetNumNodes();
161 *this->mpOutStream << num_nodes_in_element <<
" ";
164 for (
unsigned i=0; i<num_nodes_in_element; i++)
ElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
virtual void Visit(MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM > *pCellPopulation)
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
unsigned GetLocationIndexUsingCell(CellPtr pCell)
unsigned GetNodeGlobalIndex(unsigned localIndex) const
ElementIterator GetElementIteratorEnd()
PottsMesh< DIM > & rGetMesh()
#define EXCEPTION(message)
CellPopulationElementWriter()
virtual bool IsCellAttachedToLocationIndex(unsigned index)
VertexElement< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
MutableMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
MutableVertexMesh< DIM, DIM > & rGetMesh()
unsigned GetNumNodes() const
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
Node< SPACE_DIM > * GetNode(unsigned index)
PottsElement< DIM > * GetElement(unsigned elementIndex)
VertexElement< DIM, DIM > * GetElement(unsigned elementIndex)