51 out_stream p_file = out_stream(NULL);
53 unsigned num_nodes = this->mpReader->GetNumberOfRows();
54 unsigned num_timesteps = this->mpReader->GetUnlimitedDimensionValues().size();
62 for (
unsigned time_step=0; time_step<num_timesteps; time_step++)
65 std::stringstream time_step_string;
68 time_step_string << time_step;
71 p_file = this->mpOutputFileHandler->OpenOutputFile(this->mFileBaseName +
"_" + time_step_string.str() +
".exnode");
74 if (this->mPrecision != 0)
76 p_file->precision(this->mPrecision);
80 std::vector<ReplicatableVector*> all_data;
81 unsigned num_vars = this->mpReader->GetVariableNames().size();
82 for (
unsigned var=0; var<num_vars; var++)
85 this->mpReader->GetVariableOverNodes(data, this->mpReader->GetVariableNames()[var], time_step);
87 assert(p_repl_data->
GetSize()==num_nodes);
88 all_data.push_back(p_repl_data);
97 *p_file <<
"Group name: " << this->mFileBaseName <<
"\n";
98 *p_file <<
"#Fields=" << num_vars <<
"\n";
99 for (
unsigned var=0; var<num_vars; var++)
101 *p_file <<
" " << var+1 <<
") " <<this->mpReader->GetVariableNames()[var]<<
" , field, rectangular cartesian, #Components=1" <<
"\n" <<
"x. Value index=1, #Derivatives=0, #Versions=1"<<
"\n";
102 if (var != num_vars-1)
109 for (
unsigned i=0; i<num_nodes; i++)
112 *p_file <<
"Node: "<< i+1 <<
"\n";
113 for (
unsigned var=0; var<num_vars; var++)
115 *p_file << (*(all_data[var]))[i] <<
"\n";
120 for (
unsigned var=0; var<num_vars; var++)
122 delete all_data[var];
137 const std::string& rFileBaseName,
141 :
AbstractHdf5Converter<ELEMENT_DIM,SPACE_DIM>(rInputDirectory, rFileBaseName, pMesh,
"cmgui_output", precision)
160 std::vector<std::string> field_names = this->
mpReader->GetVariableNames();
164 std::vector<std::string> names;
165 names.push_back(
"tissue");
166 names.push_back(
"bath");
180 std::string original_file=this->
mpMesh->GetMeshFileBaseName();
181 std::shared_ptr<AbstractMeshReader<ELEMENT_DIM, SPACE_DIM> > p_original_mesh_reader
182 = GenericMeshReader<ELEMENT_DIM, SPACE_DIM>(original_file);
193 unsigned num_timesteps = this->mpReader->GetUnlimitedDimensionValues().size();
194 assert(this->mpReader->GetVariableNames().size() > 0);
195 std::string variable_name = this->mpReader->GetVariableNames()[0];
199 out_stream p_script_file = this->mpOutputFileHandler->OpenOutputFile(
"LoadSolutions.com");
203 *p_script_file << comment;
205 *p_script_file <<
"# Read the mesh \n"
209 <<
"# Create a window \n"
210 <<
"gfx cre win 1 \n"
211 <<
"# Modify the scene (obtained by gfx list g_element XXXX commands) to visualize first var on lines and nodes \n"
212 <<
"gfx modify g_element "<<
HeartConfig::Instance()->
GetOutputFilenamePrefix()<<
" general clear circle_discretization 6 default_coordinate coordinates element_discretization \"4*4*4\" native_discretization none; \n"
214 <<
"gfx modify g_element "<<
HeartConfig::Instance()->
GetOutputFilenamePrefix()<<
" node_points glyph point general size \"1*1*1\" centre 0,0,0 font default select_on material default data "<<variable_name<<
" spectrum default selected_material default_selected; \n"
215 <<
"# Load the data \n"
216 <<
"for ($i=0; $i<" << num_timesteps <<
"; $i++) { \n"
217 <<
" gfx read node " << this->mFileBaseName <<
"_$i.exnode time $i\n"
219 p_script_file->close();
Hdf5ToCmguiConverter(const FileFinder &rInputDirectory, const std::string &rFileBaseName, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, bool hasBath=false, unsigned precision=0u)