Create a directory where your writer will be located, for example
$CEI/ensight251/src/writers/mywriter/
Several example writers are provided which have source code and a Makefile.
For example, look at the flatfile format, an ASCII comma delimited writer.
cd $CEI/ensight251/src/writers/flatfile
Notice that there are several files in this directory.
libuserd_write.c - The writer code
Makefile - makefile
README - specific directions for using this writer
Copy these files into your directory:
$CEI/ensight251/src/writers/mywriter/
The Makefile should be used to compile and link a shared library.
Edit the Makefile so that it names the shared library properly.
Edit the C file.
give the writer a name. Ignore the other returned variable.
give the writer a version so you can use version control in the future revisions
The UDW routine called by EnSight. What you do in here is up to you; but basically you can open a file for writing, call a bunch of methods (listed below) to get the data of interest, write data into a file, and return an error status code to EnSight.
This method has the following arguments:
char full_fname[Z_MAXFILENP]
- (IN)
file name requested by the user from the GUI
int lis_parts[Z_MAXPART]
- (IN)
list of parts selected by the user in EnSight
int num_parts
- (IN)
number of selected parts
int do_binary
- (IN)
TRUE if writing binary file
FALSE if writing ASCII file
float max_fsize_mb
- (IN)
maximum file size value for this machine
int combined
- (IN)
TRUE if user requests single file output
FALSE if user allows multiple file output
float *timestep_vals
- (IN)
array of time step values
int ntime_steps
- (IN)
number of time steps
char text_input[ UDW_STRSIZE]
- (IN)
string entered from GUI by user can be used to input commands to modify writer behavior
int *error_flag
- (OUT)
Return from writer
Z_ERR if a problem
Z_EN_ERR_NONE if no problem
Edit the README file
Since each writer can operate however it wants, document any constraints, expectations, limitations, user specified parameters, etc, here. Given this is likely the only documentation available for the writer, give enough details about it for both end-users and future maintainers.
Set the UDW environment variable:
setenv ENSIGHT10_UDW $CEI/ensight251/src/writers/mywriter/
EnSight will first look in
$ENSIGHT10_UDW
and load the writer library. Next, EnSight will then look in $CEI/ensight251/machines/$CEI_ARCH/lib_writers/. If duplicate writers are found, they will only be loaded once.Make your library and fix all compile errors.
Run the EnSight using a manual connection and specify the command line option
-writerdbg
to the server to verify that it is loading the UDW correctly at runtime:ensight251_server -writerdbg (
or for Windowsensight251_server -writerdbg)
Compile in UDW debug output to track the progress of runtime loading of the writer and proper operation.
Topical List Of User-Defined Writer API Methods
The following is a topical list of the User-defined Writer API methods along with a brief description of each. These methods should be called from within the UDW's () method to retrieve data from EnSight.
General Info |
|
USERD_writer_part_verify |
|
USERD_get_undef_ptr |
Checks each element type for any undefined variable values |
USERD_get_num_time_steps |
Return the time-set num steps index based on var_index and meas_data |
USERD_writer_get_variable_transient |
Returns variable static (0) or transient (1) |
USERD_writer_get_var_type |
TRUE if model vars = static && measured vars = constant |
Variable Info |
|
USERD_writer_get_undef_val |
Echoes the EnSight undefined value |
USERD_writer_get_exist_active |
Does var exist and is it active? |
USERD_writer_get_variable_info |
Gets variable descriptors source, complex, type, descrip, vref, freq, parent |
USERD_writer_get_part_const_value |
Gets the value of a per part constant |
USERD_writer_get_per_elem_node |
Gets per element or per node flags, any undefined flag |
USERD_writer_get_number_of_variables |
Returns number of variables |
USERD_writer_get_measured_vector_var_val |
Returns vector of measured variable values |
USERD_writer_get_part_variable_status |
T or F, does part have variable(s)? |
USERD_writer_get_static_const_value |
A variable's current constant value |
USERD_writer_get_component_vector_var_val |
Returns vector of variable value |
Part Info |
|
USERD_writer_get_part_info |
Gets part_type, num elems, descrip, struct_flag |
USERD_writer_get_part_struct_unstruct |
Returns either structured or unstructured |
USERD_writer_get_changing_measured_geometry_flag |
Measured geom change status |
USERD_writer_get_changing_model_geometry_flag |
Coord, connect change status |
USERD_writer_get_structured_data |
Gets values assoc w/ struct data part_ijk_num, iblank nf, ghost flag, cell type |
USERD_writer_get_structured_data_ijk |
Gets values assoc w/ struct data part_ijk_num, iblank nf, ghost flag, cell type |
USERD_writer_get_structured_cell_type |
Gets only the cell type for structured data |
Nodal Info |
|
USERD_writer_get_node_label_status |
Does MODEL have node labels? |
USERD_writer_get_part_node_label_status |
Does PART have node labels? (T or F) |
USERD_writer_get_part_coords |
Gets part x, y, & z coordinates in 2d format |
USERD_writer_get_part_coords_vector |
Gets part x, y, & z coordinates in vector format |
USERD_writer_get_part_implicit_coords |
Gets structured part ijk implicit coordinate data |
USERD_writer_get_part_node_id |
Gets part node ids |
Element Info |
|
USERD_writer_get_part_element_size |
For a given element type, return the number of nodes in the element |
USERD_writer_get_part_element_connectivity |
Get the elemental connectivity for a specific part and a specific zoo element type |
USERD_writer_get_part_nsided_connectivity |
Get the N-Sided element connectivity |
USERD_writer_get_part_nfaced_connectivity |
Get the N-Faced element connectivity |
USERD_writer_get_element_label_status |
Does MODEL have element labels? |
USERD_writer_get_part_element_label_status |
Does PART have element labels? (T or F) |
USERD_writer_get_part_elem_id |
Returns array of element id's |
USERD_writer_get_part_elem_id_per_type |
Returns array of element id's per elem type |
USERD_writer_get_eletype_string |
Get the string describing that element type |
USERD_writer_get_element_connectivities_for_part |
Elem connectivity vector |
USERD_writer_get_element_connectivities_for_part_simple |
Elem connectivity by elem type |
USERD_get_Nfaced_size |
Total vector length, index of first connectivity val, max conn size, total # faces |
USERD_get_Nfaced_vector |
Gets vector of connectivity data |
Time |
|
USERD_writer_validate_time_step |
Validates the current EnSight time step for multiple scales |
USERD_writer_get_original_time |
Gets client time which is the original time. |
USERD_writer_set_current_time |
Sets the time |
Other |
|
USERD_get_titles |
Gets the two model title description lines |
USERD_writer_get_ensight_release |
Get EnSight release letter as string |
USERD_writer_get_ensight_version |
Get EnSight version number as string |
USERD_writer_whatis_machine_byte_order |
Current machine is big- or little-endian |
Sizing |
|
USERD_writer_get_var_max_sect_vals |
Loop thru parts & find max # variables of node or elem type |
USERD_get_modl_geo_max_node_size |
Loop thru parts & find max # of nodes |
USERD_get_modl_geo_max_conn_size |
Loop thru parts and find max connectivity size |
USERD_get_current_model_extents |
Either assign or compute model ranges |
Specialized |
|
USERD_writer_get_part_coords_per_elem |
Gets part coordinates fro TRI & QUA elems |
USERD_writer_get_part_coords_per_elem_border |
Gets part border coords for TRI & QUA |
USERD_run_border |
Calls create_border and finds boundary of part |