00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "CmguiWriter.hpp"
00030
00032
00034
00035 CmguiWriter::CmguiWriter(const std::string &rDirectory,
00036 const std::string &rBaseName,
00037 const bool &rCleanDirectory)
00038 : AbstractTetrahedralMeshWriter<3,3>(rDirectory, rBaseName, rCleanDirectory)
00039 {
00040 this->mIndexFromZero = false;
00041 }
00042
00043 void CmguiWriter::WriteFiles()
00044 {
00046
00048 std::string node_file_name = this->mBaseName + ".exnode";
00049 out_stream p_node_file = this->mpOutputFileHandler->OpenOutputFile(node_file_name);
00050
00051
00052 *p_node_file << "Group name: " << this->mBaseName << "\n";
00053 *p_node_file << CmguiNodeFileHeader;
00054
00055
00056 for (unsigned item_num=0; item_num<this->GetNumNodes(); item_num++)
00057 {
00058 std::vector<double> current_item = this->mNodeData[item_num];
00059
00060 *p_node_file << "Node:\t" << item_num+1 << "\t";
00061 for (unsigned i=0; i<3; i++)
00062 {
00063 *p_node_file << current_item[i] << "\t";
00064 }
00065
00066 *p_node_file << "\n";
00067 }
00068 p_node_file->close();
00069
00071
00073 std::string elem_file_name = this->mBaseName + ".exelem";
00074 out_stream p_elem_file = this->mpOutputFileHandler->OpenOutputFile(elem_file_name);
00075
00076
00077 *p_elem_file << "Group name: " << this->mBaseName << "\n";
00078 *p_elem_file << CmguiElementFileHeader;
00079
00080
00081 for (unsigned item_num=0; item_num<this->GetNumElements(); item_num++)
00082 {
00083 std::vector<unsigned> current_element = this->mElementData[item_num];
00084
00085 *p_elem_file << "Element:\t" << item_num+1 << " 0 0 Nodes:\t";
00086 for (unsigned i=0; i<4; i++)
00087 {
00088 *p_elem_file << current_element[i]+1 << "\t";
00089 }
00090
00091 *p_elem_file << "\n";
00092 }
00093 p_elem_file->close();
00094 }