![]() |
Session Support |
<<< Symmetric Multi-Processing In Parasolid | Chapters | Version Controls >>> |
This chapter introduces those areas of functionality that an application can use to control and get information about a Parasolid modelling session.
At any time during a session, information about the state of a modelling session can be returned.
PK_SESSION_ask_memory_usage returns the amount of memory currently occupied by the model data structure. This can be tested if storage space problems are anticipated:
PK_BODY_ask_memory_usage returns the amount of memory currently occupied by a body’s data structures.
You can manage the tag values in a session using the following functions:
Normally the tag limit is not expected to be changed during a Parasolid session. However, if it is changed, it is not affected by either session or partition roll operations - it remains at the value most recently set.
A session transmit file, or snapshot, is an image of a session at a particular instant, which can be loaded to re-create the session. Typically snapshots are used to:
PK_SESSION_transmit and PK_SESSION_transmit_u are used to create a snapshot of a session. You can choose what format the file should be in using the
transmit_format
option. It has the following formats:
this format uses the application frustrum functions which are registered by PK_SESSION_register_applio_2 |
The chosen format should be provided in your application frustrum as required. For more information about using session files when reporting faults, see the Parasolid Fault Reporting manual.
You can also choose whether to save user fields, pmarks, session marks, and delta information, using the
transmit_user_fields
,
transmit_deltas
, and
transmit_marks
options respectively. See PK_SESSION_transmit_o_t for more information.
For further information about transmit formats see Chapter 2, “File Handling”, of the Parasolid Downward Interfaces manual.
PK_SESSION_receive and PK_SESSION_receive_u restore a snapshot into the same version of Parasolid that transmitted it. For information on the options available in these functions, see PK_SESSION_receive_o_t.
Restoring a snapshot has the following effects on the session:
transmit_marks
option set to PK_SESSION_xmt_marks_all_c, then all session marks (PK_MARK_t) are the same as when the snapshot was saved; otherwise no session marks are available.
transmit_deltas
option set to PK_PARTITION_xmt_deltas_all_c, then all the pmarks in all partitions are the same as when the snapshot was saved; otherwise only the initial pmarks are available.PK_SESSION_receive_version and PK_SESSION_receive_version_u return information about the version of Parasolid used to create a session transmit file.
A journal file is a record of all calls to Parasolid functions and the arguments returned from those calls. These files are intended as a debugging tool. A developer can inspect a journal file to identify faults in the application code (journal files are always stored in text format).
Control of journalling is provided by:
A PK function which returns an error to the application journals a comment describing the error code and its severity (except when the user error handler long-jumps over Parasolid).
The generation of journal files is described in Chapter 2, “File Handling”, of the Parasolid Downward Interfaces manual.
For an example of this functionality, see the code example in the
C++\Code Examples\Application Support\Archiving\Journal
Debug
Report
Session
folder, located in
example_applications
in your Parasolid installation folder.
When journalling is on, PK_SESSION_comment can be used to assist deciphering files from the application. It enables a comment to be added to a journal file which can be used to link the PK function call to what the application was doing.
The application’s GO functions are permitted to make calls to PK functions. This might be used, for example, to get data from an attribute attached to an entity being rendered. Only one level of recursion is allowed.
A user field consists of a number of bytes of memory, allocated to every entity in a session, in which data needed by the application can be stored. The data contained in the user field of each entity can be set and read individually, using PK_ENTITY_set_user_field and PK_ENTITY_ask_user_field.
The decision of whether to use user fields is fundamental to the architecture of the application. When deciding whether or not to use them compare the relative benefits of user fields and attributes:
Users fields are enabled by passing the required length to PK_SESSION_start, and the current setting is returned by PK_SESSION_ask_user_field_len.
For further details of attributes see Chapter 95, “Attributes”.
When Parasolid requires memory for workspace or modelling operations, it calls the FMALLO function (PK_FMALLO_f_t) that you supply in the frustrum. Parasolid provides you with two functions that let you manage the minimum amount of contiguous space that Parasolid requests when it calls FMALLO. In some circumstances, changing the value of this minimum amount of memory may improve performance, both in terms of time and memory. For example, if your application’s memory management works on blocks of a certain size, using the same block size in Parasolid may improve performance slightly.
You can use PK_MEMORY_set_block_size to set the minimum memory that Parasolid requests via FMALLO. This function lets you specify a minimum block size between about 1/8 Mbyte (the default) and 16 Mbytes. It can be called at any time, whether or not the modeller is running. To return the minimum block size to Parasolid's default, call PK_MEMORY_set_block_size with an argument of zero.
You can use PK_MEMORY_ask_block_size to return the current minimum block size.
If you stop the modeller, the minimum block size is always reset to the default value.
Note:
1. Increasing the block size does
not allow Parasolid to perform bigger modelling operations. Parasolid always requests the amount of memory it needs for a given job. Larger block sizes simply mean that fewer blocks are needed when passing memory to Parasolid, which in turn means that FMALLO and FMFREE are called less often. Note: 2. The more you increase the minimum block size above the default, the less likely it is that Parasolid will be able to release blocks to the operating system after use. This may affect the performance of other processes on the system. Note: 3. The exact limits of the block sizes you can set are platform-dependent. If you need to know these limits exactly, experiment by setting small and large values for PK_MEMORY_set_block_size and then using PK_MEMORY_ask_block_size to see what values are returned. |
Sometimes, several entities are involved in a given error. In such cases, Parasolid lets you control, for the current session, whether additional information about these entities is returned in the Parasolid Report using the following functions:
Enquire whether additional error information is returned in a Parasolid Report of type PK_REPORT_4_t with the status PK_REPORT_4_error_report_c.Default: PK_ERROR_reports_off_c. |
|
Specify whether additional error information is returned in a Parasolid Report of type PK_REPORT_4_t with the status PK_REPORT_4_error_report_c.Default: PK_ERROR_reports_off_c. |
For more information on these functions, see the PK Reference,
Note: Individual application threads can override the session setting by calling PK_THREAD_set_err_reports with a value other than PK_ERROR_reports_inherit_c. For more information on this function, see Section 113.6.3, “Reporting errors involving multiple error entities”. |
<<< Symmetric Multi-Processing In Parasolid | Chapters | Version Controls >>> |