78 out_stream p_node_file = OpenNodeFile();
81 unsigned num_nodes = this->GetNumNodes();
82 *p_node_file << num_nodes <<
"\n";
85 for (
unsigned item_num=0; item_num<num_nodes; item_num++)
87 std::vector<double> current_item = this->GetNextNode();
88 for (
unsigned i=0; i<SPACE_DIM; i++)
90 *p_node_file << current_item[i] <<
"\t";
94 *p_node_file << 0 <<
"\t";
98 *p_node_file << 0 <<
"\t" << 0 <<
"\t";
100 *p_node_file <<
"\n";
103 *p_node_file << comment;
104 p_node_file->close();
107 std::string element_file_name;
109 if (ELEMENT_DIM == 3)
111 element_file_name = this->mBaseName +
".tetras";
113 else if (ELEMENT_DIM == 2)
115 element_file_name = this->mBaseName +
".tri";
119 element_file_name = this->mBaseName +
".cnnx";
122 out_stream p_element_file = OpenElementFile();
125 unsigned num_elements = this->GetNumElements();
127 *p_element_file << num_elements <<
"\n";
130 unsigned nodes_per_element = ELEMENT_DIM+1;
131 for (
unsigned item_num=0; item_num<num_elements; item_num++)
135 std::vector<unsigned> current_item = element_data.
NodeIndices;
136 for (
unsigned i=0; i<nodes_per_element; i++)
138 if (this->mIndexFromZero)
140 *p_element_file << current_item[i] <<
"\t";
144 *p_element_file << current_item[i]+1 <<
"\t";
150 *p_element_file << comment;
151 p_element_file->close();
156 out_stream p_face_file = OpenFaceFile();
159 unsigned num_faces = this->GetNumBoundaryFaces();
161 *p_face_file << num_faces <<
"\n";
164 double material_property = 0.0;
165 for (
unsigned item_num=0; item_num<num_faces; item_num++)
167 ElementData current_item = this->GetNextBoundaryElement();
168 for (
unsigned i=0; i<ELEMENT_DIM; i++)
170 if (this->mIndexFromZero)
172 *p_face_file << current_item.
NodeIndices[i] <<
"\t";
176 *p_face_file << current_item.
NodeIndices[i]+1 <<
"\t";
179 *p_face_file << material_property <<
"\n";
181 *p_face_file << comment;
182 p_face_file->close();
235 std::string element_file_name;
237 if (ELEMENT_DIM == 3)
239 element_file_name = this->mBaseName +
".tetras";
241 else if (ELEMENT_DIM == 2)
243 element_file_name = this->mBaseName +
".tri";
247 element_file_name = this->mBaseName +
".cnnx";
250 return this->mpOutputFileHandler->OpenOutputFile(element_file_name, GetOpenMode(append));
266 out_stream p_node_file = OpenNodeFile();
269 unsigned num_nodes = this->GetNumNodes();
270 *p_node_file << num_nodes <<
"\n";
272 p_node_file->close();
278 out_stream p_element_file = OpenElementFile();
281 unsigned num_elements = this->GetNumElements();
282 *p_element_file << num_elements <<
"\n";
284 p_element_file->close();
292 out_stream p_face_file = OpenFaceFile();
295 unsigned num_faces = this->GetNumBoundaryFaces();
296 *p_face_file << num_faces <<
"\n";
298 p_face_file->close();
308 out_stream p_node_file = OpenNodeFile(
true);
312 for (NodeIterType iter = this->mpDistributedMesh->GetNodeIteratorBegin();
313 iter != this->mpDistributedMesh->GetNodeIteratorEnd();
316 const c_vector<double, SPACE_DIM>& r_current_item = iter->rGetLocation();
317 for (
unsigned i=0; i<SPACE_DIM; i++)
319 *p_node_file << r_current_item[i] <<
"\t";
323 *p_node_file << 0 <<
"\t";
327 *p_node_file << 0 <<
"\t" << 0 <<
"\t";
329 *p_node_file <<
"\n";
331 p_node_file->close();
333 out_stream p_element_file = OpenElementFile(
true);
337 for (ElemIterType iter = this->mpDistributedMesh->GetElementIteratorBegin();
338 iter != this->mpDistributedMesh->GetElementIteratorEnd();
341 if (this->mpDistributedMesh->CalculateDesignatedOwnershipOfElement(iter->GetIndex()))
343 for (
unsigned i=0; i<this->mNodesPerElement; i++)
345 if (this->mIndexFromZero)
347 *p_element_file << iter->GetNodeGlobalIndex(i) <<
"\t";
351 *p_element_file << iter->GetNodeGlobalIndex(i)+1 <<
"\t";
355 *p_element_file << iter->GetAttribute() <<
"\n";
358 p_element_file->close();
361 if (ELEMENT_DIM == 3)
363 out_stream p_face_file = OpenFaceFile(
true);
367 for (BoundaryElemIterType iter = this->mpDistributedMesh->GetBoundaryElementIteratorBegin();
368 iter != this->mpDistributedMesh->GetBoundaryElementIteratorEnd();
371 if (this->mpDistributedMesh->CalculateDesignatedOwnershipOfBoundaryElement((*iter)->GetIndex()))
373 for (
unsigned i=0; i<ELEMENT_DIM; i++)
375 if (this->mIndexFromZero)
377 *p_face_file << (*iter)->GetNodeGlobalIndex(i) <<
"\t";
381 *p_face_file << (*iter)->GetNodeGlobalIndex(i)+1 <<
"\t";
385 *p_face_file << (*iter)->GetAttribute() <<
"\n";
388 p_face_file->close();