49 const std::string& rBaseName,
100 out_stream p_node_file = OpenNodeFile();
101 WriteNodeFileHeader(p_node_file);
104 for (
unsigned item_num=0; item_num<this->GetNumNodes(); item_num++)
106 std::vector<double> current_item = this->GetNextNode();
108 *p_node_file <<
"Node:\t" << item_num+1 <<
"\t";
109 for (
unsigned i=0; i<SPACE_DIM; i++)
111 *p_node_file << current_item[i] <<
"\t";
114 *p_node_file <<
"\n";
116 p_node_file->close();
122 std::vector<boost::shared_ptr<std::ofstream> > elem_files = OpenElementFiles();
123 WriteElementsFileHeader(elem_files);
126 for (
unsigned item_num=0; item_num<this->GetNumElements(); item_num++)
129 std::vector<unsigned> current_element = elem.
NodeIndices;
134 *elem_files[elem.
AttributeValue] <<
"Element:\t" << item_num+1 <<
" 0 0 Nodes:\t";
135 for (
unsigned i=0; i<mNumNodesPerElement; i++)
137 *elem_files[elem.
AttributeValue] << current_element[mReordering[i]]+1 <<
"\t";
144 for (
unsigned region_index=0; region_index<mRegionNames.size(); region_index++)
146 elem_files[region_index]->close();
173 std::vector<boost::shared_ptr<std::ofstream> > elem_files;
175 if (mRegionNames.size() == 0)
177 mRegionNames.push_back(this->mBaseName);
179 elem_files.resize(mRegionNames.size());
181 std::string directory = this->mpOutputFileHandler->GetOutputDirectoryFullPath();
182 for (
unsigned region_index=0; region_index<mRegionNames.size(); region_index++)
184 std::string elem_file_name = mRegionNames[region_index] +
".exelem";
186 boost::shared_ptr<std::ofstream> p_output_file(
new std::ofstream((directory+elem_file_name).c_str(), GetOpenMode(append)));
188 if (!p_output_file->is_open())
190 EXCEPTION(
"Could not open file \"" + elem_file_name +
"\" in " + directory);
200 elem_files[region_index] = p_output_file;
242 for (
unsigned region_index=0; region_index<mRegionNames.size(); region_index++)
248 *rElemFiles[region_index] << comment;
250 *rElemFiles[region_index] <<
"Group name: " << mGroupName <<
"\n";
251 *rElemFiles[region_index] << mElementFileHeader;
254 unsigned number_of_fields = mAdditionalFieldNames.size();
255 std::stringstream string_of_number_of_fields;
258 string_of_number_of_fields << number_of_fields+1;
261 *rElemFiles[region_index] <<
" #Fields="<<string_of_number_of_fields.str()<<
"\n";
264 *rElemFiles[region_index] << mCoordinatesFileHeader;
267 for (
unsigned i = 0; i < number_of_fields; i++)
270 std::stringstream i_string;
272 *rElemFiles[region_index]<<i_string.str()<<
") "<<mAdditionalFieldNames[i]<<
" ,";
273 *rElemFiles[region_index] << mAdditionalFieldHeader;
304 out_stream p_node_file = OpenNodeFile(
true);
308 for (NodeIterType iter = this->mpDistributedMesh->GetNodeIteratorBegin();
309 iter != this->mpDistributedMesh->GetNodeIteratorEnd();
312 const c_vector<double, SPACE_DIM>& r_current_item = iter->rGetLocation();
313 *p_node_file <<
"Node:\t" << iter->GetIndex()+1 <<
"\t";
315 for (
unsigned i=0; i<SPACE_DIM; i++)
317 *p_node_file << r_current_item[i] <<
"\t";
320 *p_node_file <<
"\n";
322 p_node_file->close();
326 std::vector<boost::shared_ptr<std::ofstream> > elem_files = OpenElementFiles(
true);
329 for (ElemIterType iter = this->mpDistributedMesh->GetElementIteratorBegin();
330 iter != this->mpDistributedMesh->GetElementIteratorEnd();
333 if (this->mpDistributedMesh->CalculateDesignatedOwnershipOfElement(iter->GetIndex()))
335 assert(iter->GetUnsignedAttribute() < mRegionNames.size());
337 *elem_files[iter->GetUnsignedAttribute()] <<
"Element:\t" << iter->GetIndex()+1 <<
" 0 0 Nodes:\t";
338 for (
unsigned i=0; i<this->mNodesPerElement; i++)
340 *elem_files[iter->GetUnsignedAttribute()] << iter->GetNodeGlobalIndex(i)+1 <<
"\t";
343 *elem_files[iter->GetUnsignedAttribute()] <<
"\n";
347 for (
unsigned region_index=0; region_index<mRegionNames.size(); region_index++)
349 elem_files[region_index]->close();