...
First we need to do in this function is to call some initialization procedures:
To open the file for writing:
Code Block |
---|
customlib::InitWriteFileGiD_WriteCalculationFile init $filename |
To initialize the material's database, indicating which 'conditions' have materials assigned.
...
Then we write some headers and to write the number of elements and nodes, we call some GiD_Info Functions:
Code Block |
---|
customlib::WriteStringGiD_WriteCalculationFile puts "[GiD_Info Mesh NumElements] [GiD_Info Mesh NumNodes]" |
To write the nodes and their coordinates we need to prepare the format for an integer node id and two reals x, y (z is omitted)
Code Block |
---|
customlib::WriteCoordinatesGiD_WriteCalculationFile coordinates -factor $mesh_factor "%5d %14.5e %14.5e%.0s\n" |
...
Code Block |
---|
set num_materials [customlib::GetNumberOfMaterials used] customlib::WriteString "NÂș Materials=GiD_WriteCalculationFile puts "Materials:" GiD_WriteCalculationFile puts $num_materials" |
And, to write the material information, again, we need to prepare the parameters to print the material's id and it's density, and call the function WriteMaterials
...
Code Block |
---|
set condition_list [list "Point_Weight"] set condition_formats [list {"%1d" "node" "id"} {"%13.5e" "property" "Weight"}] customlib::WriteNodesWriteNodesByGroup $condition_list $condition_formats "" active |
Finally, all we need to do is to close the writing file
Code Block |
---|
customlib::EndWriteFileGiD_WriteCalculationFile end ; |