4. Report Writing - ProRender, LogFile
The modules ProRender and LogFile are designed to facilitate the generation of text and graphics content for report writing. Note that these modules are under preliminary development and the functions and argument lists are subject to change.
4.1. Rendering - ProRender
The ProRender module is designed to generate graphics objects and render them to 2D image files and 3D object files. The methods associated with a ProRender object are the following.
Begin and end an instance of an object, generic object functions
vfx_ProRenderBegin()
- create an instance of a ProRender objectvfx_ProRenderEnd()
- destroy an instance of a ProRender objectvfx_ProRenderError()
- return ProRender object error flag
Operations
vfx_ProRenderDraw()
- render to image filevfx_ProRenderFile()
- export to object filevfx_ProRenderModel()
- generate graphics object of Modelvfx_ProRenderState()
- generate graphics object of Statevfx_ProRenderSetDimension()
- set image pixel dimensionsvfx_ProRenderSetLookAt()
- set viewing transformationvfx_ProRenderSetObject()
- set attribute objectsvfx_ProRenderSetParamc()
- set character parametersvfx_ProRenderSetParami()
- set integer parameters
Instance a ProRender object using vfx_ProRenderBegin()
.
Use vfx_ProRenderSetObject()
to register the current Model object. This
gives ProRender access to the model element connectivity and node coordinate
information. The complete process of creating a 2D image file or 3D object
file is a two step process. First an internal graphics object is generated
of either a finite element model or result using vfx_ProRenderModel()
or vfx_ProRenderState()
respectively. Then this internal graphics object
may be drawn to a 2D image file (such as a GIF file) using
vfx_ProRenderDraw()
or exported to a 3D object file (such as a VRML file) using
vfx_ProRenderFile()
.
When rendering to an image file (currently only GIF is supported). The
dimension of the final image in pixels
is set using vfx_ProRenderSetDimension()
. The viewing transformation used
is set using vfx_ProRenderSetLookAt()
.
Use the function vfx_ProRenderSetParamc()
to set the output file name.
The image file name should include the extension .gif, the object
file name should include the extension .wrl.
Destroy an instance of a ProRender object using vfx_ProRenderEnd()
.
4.2. Function Descriptions
The currently available ProRender functions are described in detail in this section.
-
vfx_ProRender *vfx_ProRenderBegin(void)
create an instance of a ProRender object
Create an instance of a ProRender object. Memory is allocated for the object private data and the pointer to the object is returned.
Destroy an instance of a ProRender object using
void vfx_ProRenderEnd (vfx_ProRender *prorender)
Return the current value of a ProRender object error flag using
Vint vfx_ProRenderError (vfx_ProRender *prorender)
- Returns:
The function returns a pointer to the newly created ProRender object. If the object creation fails, NULL is returned.
-
void vfx_ProRenderEnd(vfx_ProRender *p)
destroy an instance of a ProRender object
-
Vint vfx_ProRenderError(vfx_ProRender *p)
return the current value of a ProRender object error flag
-
void vfx_ProRenderSetObject(vfx_ProRender *p, Vint objecttype, Vobject *object)
set attribute objects
Set a pointer to an attribute object. The Model object must be registered. The State object must be registered if
vfx_ProRenderState()
is executed.- Errors
SYS_ERROR_OBJECTTYPE
is generated if an improper objecttype is specified.
- Parameters:
p – Pointer to ProRender object.
objecttype – The object type identifier
x=VIS_MODEL Model object =VIS_STATE State object
object – Pointer to the object to be set.
-
void vfx_ProRenderSetParami(vfx_ProRender *p, Vint ptype, Vint iparam)
set integer parameters
Specify integer parameters to control entity color, etc. The edge and face colors must be chosen from the set of available colors in the
vis_ColorMapRamp()
function when using theCOLORMAP_SET
ramp. By default edge color isCOLORMAP_SET_WHITE
and face color isCOLORMAP_SET_GRAY50
.- Errors
SYS_ERROR_ENUM
is generated if an improper ptype is specified.
- Parameters:
p – Pointer to ProRender object.
ptype – Type of solution parameter to set
x=PRORENDER_EDGECOLOR Edge color =PRORENDER_FACECOLOR Face color
iparam – Specifies the integer value that ptype will be set to.
-
void vfx_ProRenderSetParamc(vfx_ProRender *p, Vint ptype, Vchar *cparam)
set character parameters
Specify character parameters to control output file name. By default the output file is prorender.gif.
- Errors
SYS_ERROR_ENUM
is generated if an improper ptype is specified.
- Parameters:
p – Pointer to ProRender object.
ptype – Type of solution parameter to set
x=PRORENDER_OUTFILE Pathname for output file
cparam – Specifies the character value that ^ptype^ will be set to.
-
void vfx_ProRenderSetDimension(vfx_ProRender *p, Vint xsize, Vint ysize)
set image pixel dimensions
Set the pixel dimension of generated image. The default is xsize = 320 and ysize = 240.
- Parameters:
p – Pointer to ProRender object.
xsize – Horizontal dimension in pixels
ysize – Vertical dimension in pixels
-
void vfx_ProRenderSetLookAt(vfx_ProRender *p, Vfloat ex, Vfloat ey, Vfloat ez, Vfloat cx, Vfloat cy, Vfloat cz, Vfloat ux, Vfloat uy, Vfloat uz)
set viewing transformation
Set the viewing transformation used to render image. The default eye position is (1.,0.,0.), point along line of sight is (0.,0.,0.) and up direction is (0.,1.,0.).
- Parameters:
p – Pointer to ProRender object.
ex, ey, ez – Position of eye
cx, cy, cz – Point along line of sight
ux, uy, uz – Vector pointing in up direction
-
void vfx_ProRenderModel(vfx_ProRender *p)
generate graphics object of Model
Generate a graphics object of the current Model attribute object. The model is rendered in gray with feature edges added.
- Parameters:
p – Pointer to ProRender object.
-
void vfx_ProRenderState(vfx_ProRender *p)
generate graphics object of State
Generate a graphics object of the current State attribute object. A contour plot of a scalar derived quantity is generated. The vector magnitude is used for vector states, Von Mises stress is used for tensor states and the translation magnitude is used for six dof states.
- Parameters:
p – Pointer to ProRender object.
4.3. Log File Content - LogFile
The LogFile module is designed to generate text content for monitoring the progress of a finite element solution. The methods associated with a LogFile object are the following.
Begin and end an instance of an object, generic object functions
vfx_LogFileBegin()
- create an instance of a LogFile objectvfx_LogFileEnd()
- destroy an instance of a LogFile objectvfx_LogFileError()
- return LogFile object error flag
Operations
vfx_LogFileSetError()
- set error handler to use with LogFilevfx_LogFileSetObject()
- set attribute objects
Output
vfx_LogFileTableInit()
- flag beginning of a tablevfx_LogFileTableTerm()
- flag end of a tablevfx_LogFileTableEntryc()
- create table entry with stringvfx_LogFileTableEntryd()
- create table entry with doublevfx_LogFileTableEntryi()
- create table entry with integervfx_LogFileTableEntry1()
- create one typed table entryvfx_LogFileTableEntry2()
- create two typed table entryvfx_LogFileTableEntry3()
- create three typed table entryvfx_LogFileTableEntry4()
- create four typed table entryvfx_LogFileTableEntry5()
- create five typed table entryvfx_LogFileTextString()
- write unformatted string
Instance a LogFile object using vfx_LogFileBegin()
.
Use vfx_LogFileSetObject()
to register the TextFun object where output
will be written to. Use vfx_LogFileSetError()
to use the internally-defined
error handler so all solver output is integrated with the TextFun object
registered. Send messages and/or tables to the log file using vfx_LogFileTextString()
and/or any of the table entry function variations.
Destroy an instance of a LogFile object using vfx_LogFileEnd()
.
4.4. Function Descriptions
The currently available LogFile functions are described in detail in this section.
-
vfx_LogFile *vfx_LogFileBegin(void)
create an instance of a
LogFile object
Create an instance of a LogFile object. Memory is allocated for the object private data and the pointer to the object is returned.
Destroy an instance of a LogFile object using
void vfx_LogFileEnd (vfx_LogFile *logfile)
Return the current value of a LogFile object error flag using
Vint vfx_LogFileError (vfx_LogFile *logfile)
- Returns:
The function returns a pointer to the newly created LogFile object. If the object creation fails, NULL is returned.
-
void vfx_LogFileEnd(vfx_LogFile *p)
destroy an instance of a LogFile object
-
Vint vfx_LogFileError(vfx_LogFile *p)
return the current value of a LogFile object error flag
-
void vfx_LogFileSetObject(vfx_LogFile *p, Vint objecttype, Vobject *object)
set attribute objects
Set a pointer to an attribute object. The TextFun object must be registered.
- Errors
SYS_ERROR_OBJECTTYPE
is generated if an improper objecttype is specified.
- Parameters:
p – Pointer to LogFile object.
objecttype – The object type identifier
x=VSY_TEXTFUN TextFun object
object – Pointer to the object to be set.
-
void vfx_LogFileTableInit(vfx_LogFile *p, const Vchar *message)
flag beginning of a table
Flag the beginning of a new table.
- Errors
SYS_ERROR_OPERATION
is generated ifvfx_LogFileTableInit()
has already been called without a correspondingvfx_LogFileTableTerm()
call to indicate the end of the table.
- Parameters:
p – Pointer to LogFile object.
message – Table title
-
void vfx_LogFileTableEntryi(vfx_LogFile *p, const Vchar *message, Vint ival)
create table entry with string
-
void vfx_LogFileTableEntryd(vfx_LogFile *p, const Vchar *message, Vdouble dval)
create table entry with string
-
void vfx_LogFileTableEntryc(vfx_LogFile *p, const Vchar *message, const Vchar *cvalue)
create table entry with string
Adds a line to the table of the form
- Parameters:
p – Pointer to LogFile object.
message – Descriptive string
cvalue – Value corresponding to descriptive string
-
void vfx_LogFileTableEntry1(vfx_LogFile *p, Vint type1, Vobject *value1)
create one typed table entry
Adds a line to the table of the form
- Parameters:
p – Pointer to LogFile object.
type1 – Type of value
x=LOGFILE_STRING Null-terminated string =LOGFILE_SPACE A null-terminated string of spaces =LOGFILE_IMAGE File name with image =LOGFILE_INTEGER An integer value =LOGFILE_DOUBLE A double value =LOGFILE_FLOAT A float value
value1 – Object with value data
-
void vfx_LogFileTableEntry2(vfx_LogFile *p, Vint type1, Vobject *obj1, Vint type2, Vobject *obj2)
create one typed table entry
-
void vfx_LogFileTableEntry3(vfx_LogFile *p, Vint type1, Vobject *obj1, Vint type2, Vobject *obj2, Vint type3, Vobject *obj3)
create one typed table entry
-
void vfx_LogFileTableEntry4(vfx_LogFile *p, Vint type1, Vobject *obj1, Vint type2, Vobject *obj2, Vint type3, Vobject *obj3, Vint type4, Vobject *obj4)
create one typed table entry
-
void vfx_LogFileTableEntry5(vfx_LogFile *p, Vint type1, Vobject *obj1, Vint type2, Vobject *obj2, Vint type3, Vobject *obj3, Vint type4, Vobject *obj4, Vint type5, Vobject *obj5)
create one typed table entry
-
void vfx_LogFileTableTerm(vfx_LogFile *p)
flag end of a table
Flag the end of a table.
- Errors
SYS_ERROR_OPERATION
is generated ifvfx_LogFileTableInit()
has
- Parameters:
p – Pointer to LogFile object.
-
void vfx_LogFileTextString(vfx_LogFile *p, const Vchar *message)
write unformatted string
Sends the string to the log file.
- Parameters:
p – Pointer to LogFile object.
message – String to be displayed
-
void vfx_LogFileSetError(vfx_LogFile *p)
set error handler to use with LogFile
Set the error handler to a LogFile specific function which will stream error messages through LogFile. This function will replace the currently defined error handler and error object. Please see
vut_ErrorSetHandler()
andvut_ErrorSetObject()
.- Parameters:
p – Pointer to LogFile object.