36 #include "PottsMeshWriter.hpp" 37 #include "Version.hpp" 42 template<
unsigned SPACE_DIM>
55 template<
unsigned SPACE_DIM>
57 const std::string& rBaseName,
58 const bool clearOutputDir)
63 mNodeMapCurrentIndex(0)
69 template<
unsigned SPACE_DIM>
86 template<
unsigned SPACE_DIM>
94 std::vector<double> coordinates(SPACE_DIM+1);
97 for (
unsigned j=0; j<SPACE_DIM; j++)
99 coordinates[j] = (*(
mpIters->pNodeIter))->GetPoint()[j];
101 coordinates[SPACE_DIM] = (*(
mpIters->pNodeIter))->IsBoundaryNode();
113 template<
unsigned SPACE_DIM>
122 for (
unsigned j=0; j<elem_data.NodeIndices.size(); j++)
124 unsigned old_index = (*(
mpIters->pElemIter))->GetNodeGlobalIndex(j);
129 elem_data.AttributeValue = (*(
mpIters->pElemIter))->GetAttribute();
141 template<
unsigned SPACE_DIM>
170 template<
unsigned SPACE_DIM>
176 std::string node_file_name = this->
mBaseName +
".node";
180 unsigned num_attr = 0;
181 unsigned max_bdy_marker = 1;
184 *p_node_file << num_nodes <<
"\t";
185 *p_node_file << SPACE_DIM <<
"\t";
186 *p_node_file << num_attr <<
"\t";
187 *p_node_file << max_bdy_marker <<
"\n";
188 *p_node_file << std::setprecision(6);
191 for (
unsigned item_num=0; item_num<num_nodes; item_num++)
193 std::vector<double> current_item = this->
GetNextNode();
194 *p_node_file << item_num;
195 for (
unsigned i=0; i<SPACE_DIM+1; i++)
197 *p_node_file <<
"\t" << current_item[i];
199 *p_node_file <<
"\n";
201 *p_node_file << comment <<
"\n";
202 p_node_file->close();
205 std::string element_file_name = this->
mBaseName +
".cell";
210 *p_element_file << num_elements <<
"\t";
217 if (num_elements != 0)
219 *p_element_file << num_attr <<
"\n";
223 *p_element_file << 0 <<
"\n";
227 for (
unsigned item_num=0; item_num<num_elements; item_num++)
233 std::vector<unsigned> node_indices = elem_data.
NodeIndices;
236 *p_element_file << item_num <<
"\t" << node_indices.size();
239 for (
unsigned i=0; i<node_indices.size(); i++)
241 *p_element_file <<
"\t" << node_indices[i];
248 *p_element_file <<
"\n";
251 *p_element_file << comment <<
"\n";
252 p_element_file->close();
MeshPottsWriterIterators< SPACE_DIM > * mpIters
bool IsMeshChanging() const
NodeIterator GetNodeIteratorEnd()
virtual unsigned GetNumNodes()
OutputFileHandler * mpOutputFileHandler
void WriteFilesUsingMesh(PottsMesh< SPACE_DIM > &rMesh)
virtual unsigned GetNumAllNodes() const
virtual std::vector< double > GetNextNode()
std::vector< unsigned > NodeIndices
void SetNewIndex(unsigned oldIndex, unsigned newIndex)
AbstractMesh< SPACE_DIM, SPACE_DIM >::NodeIterator * pNodeIter
PottsMesh< SPACE_DIM > * mpMesh
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
PottsMesh< SPACE_DIM >::PottsElementIterator * pElemIter
std::vector< double > GetNextNode()
PottsElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
PottsMeshWriter(const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
virtual unsigned GetNumNodes() const
NodeIterator GetNodeIteratorBegin(bool skipDeletedNodes=true)
unsigned mNodeMapCurrentIndex
unsigned GetNumElements()
ElementData GetNextElement()
virtual unsigned GetNumElements() const
unsigned GetNewIndex(unsigned oldIndex) const
static std::string GetProvenanceString()
virtual ElementData GetNextElement()
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpMeshReader