Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Let's open the cmas2d_customlib.tcl file and see how are we processing the event of GiD that is called when the user wants to calculate: GiD_Event_AfterWriteCalculationFile. After a few check of the environment, 'Cmas2d::WriteCalculationFile AfterWriteCalculationFile $filename ' is called (It is defined in scripts/writing.tcl).

...


To initialize the material's database, indicating wich which 'conditions' have materials assigned.

Code Block
customlib::InitMaterials [list "Shells"] active


Then we write some headers and to write the number of elements and nodes, we call some GiD_Info Functions:

...


To write the nodes and their coordinates we need to prepare the format and call WriteCoordinates:for an integer node id and two reals x, y (z is omitted)

Code Block
customlib::WriteCoordinates "%5d %14.5e %14.5e%.0s\n"


As we can see, the format is prepared to write 2D coordinates (X & Y).


Next we need to write are the connectivities of the elements. For each element, we want to write it's id, it's nodes, and the material id that we assigned. In order to do this, again we prepare the parameters for the function WriteConnectivities:

Code Block
set elements_conditions [list "Shells"]
set element_formats [list {"%10d" "element" "id"} {"%10d" "element" "connectivities"} {"%10d" "material" "MID"}]
customlib::WriteConnectivities $elements_conditions $element_formats active


Then, the material's block. To get and write the number of materials, there is a function, GetNumberOfMaterials:

...