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"
43#include "ImmersedBoundaryCellPopulation.hpp"
45template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
51template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
58 bool element_contains_dead_cells_or_deleted_nodes =
false;
61 for (
unsigned i=0; i<ELEMENT_DIM+1; i++)
63 unsigned node_index = elem_iter->GetNodeGlobalIndex(i);
65 if (pCellPopulation->
GetNode(node_index)->IsDeleted())
67 element_contains_dead_cells_or_deleted_nodes =
true;
74 element_contains_dead_cells_or_deleted_nodes =
true;
79 if (!element_contains_dead_cells_or_deleted_nodes)
81 for (
unsigned i=0; i<ELEMENT_DIM+1; i++)
83 *this->mpOutStream << elem_iter->GetNodeGlobalIndex(i) <<
" ";
89template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
92 EXCEPTION(
"CellPopulationElementWriter cannot be used with a CaBasedCellPopulation");
95template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
98 EXCEPTION(
"CellPopulationElementWriter cannot be used with a NodeBasedCellPopulation");
101template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
106 cell_iter != pCellPopulation->
End();
112 bool elem_corresponds_to_dead_cell =
false;
120 if (!(pCellPopulation->
GetElement(elem_index)->IsDeleted()) && !elem_corresponds_to_dead_cell)
123 unsigned num_nodes_in_element = p_element->
GetNumNodes();
126 *this->mpOutStream << num_nodes_in_element <<
" ";
129 for (
unsigned i=0; i<num_nodes_in_element; i++)
137template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
142 cell_iter != pCellPopulation->
End();
148 bool elem_corresponds_to_dead_cell =
false;
156 if (!(pCellPopulation->
GetElement(elem_index)->IsDeleted()) && !elem_corresponds_to_dead_cell)
159 unsigned num_nodes_in_element = p_element->
GetNumNodes();
162 *this->mpOutStream << num_nodes_in_element <<
" ";
165 for (
unsigned i=0; i<num_nodes_in_element; i++)
173template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
177 for (
auto cell_iter = pCellPopulation->
Begin(); cell_iter != pCellPopulation->
End(); ++cell_iter)
182 bool elem_corresponds_to_dead_cell =
false;
190 if (!(pCellPopulation->
GetElement(elem_index)->IsDeleted()) && !elem_corresponds_to_dead_cell)
193 const unsigned num_nodes_in_element = p_element->
GetNumNodes();
196 *this->mpOutStream << num_nodes_in_element <<
" ";
199 for (
unsigned i=0; i<num_nodes_in_element; i++)
#define EXCEPTION(message)
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
virtual bool IsCellAttachedToLocationIndex(unsigned index)
unsigned GetLocationIndexUsingCell(CellPtr pCell)
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
unsigned GetNumNodes() const
unsigned GetNodeGlobalIndex(unsigned localIndex) const
ElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
ElementIterator GetElementIteratorEnd()
CellPopulationElementWriter()
virtual void Visit(MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM > *pCellPopulation)
ImmersedBoundaryMesh< DIM, DIM > & rGetMesh()
ImmersedBoundaryElement< DIM, DIM > * GetElement(unsigned elementIndex)
ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
Node< SPACE_DIM > * GetNode(unsigned index)
MutableMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
PottsElement< DIM > * GetElement(unsigned elementIndex)
PottsMesh< DIM > & rGetMesh()
VertexElement< DIM, DIM > * GetElement(unsigned elementIndex)
MutableVertexMesh< DIM, DIM > & rGetMesh()
VertexElement< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const