PCL and Customization > Modifying the Database Using PCL > Adding A New Analysis Preference
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Adding A New Analysis Preference
A new analysis code can be added to analysis preferences by adding any new analysis types and then adding the new analysis code.
A new analysis type can be added by using the following PCL function: 
 
db_create_analysis_type
(<analy_type_id>, <analy_type_name>)
 
Input:
 
 
INTEGER
<analy_type_id>
The ID for referencing the analysis type. This ID must be unique with respect to all previously defined analysis type IDs.
CHARACTER STRING
<analy_type_name>
The name of the analysis type.
Output:
 
 
INTEGER
<Return Value>
Status return value. The value will be 0 if the routine is successful.
Error Conditions:
 
 
None.
 
 
This function should only be used to add new analysis types. Three analysis types are already defined in all Patran databases:
 
Analysis type
<analy_type_id>
Structural Analysis
1
Thermal Analysis
2
Fluid Dynamics
3
The function to add a new analysis code is 
 
db_create_analysis_code
(<analy_code_id>, <analy_code_name>, <model_suffix>, <results_suffix>, <num_analy_types>, <analy_type_ids>, <def_analy_type>)
 
Input:
 
 
INTEGER
<analy_code_id>
The ID for referencing the analysis code. This ID must be unique with respect to all previously defined analysis code IDs. Users and third parties should define analysis code IDs in the range 20000 to 29999.
CHARACTER STRING
<analy_code_name>
The name of the analysis code.
CHARACTER STRING
<model_suffix>
Suffix to be added to the analysis code input file.
CHARACTER STRING
<results_suffix>
Suffix to be added to the analysis code results file.
INTEGER
<num_analy_types>
The number of analysis types valid for this analysis code.
INTEGER ARRAY
<analy_type_ids>
The <num_analy_types> analysis types IDs valid for this analysis code.
INTEGER
<def_analy_type>
The analysis type ID of the default analysis type.
Output:
 
 
INTEGER
<Return Value>
Status return value. The value will be 0 if the routine is successful.
Error Conditions:
 
None.
 
 
The following analysis code IDs should be reserved for MSC supported analysis interfaces:
 
Analysis Code
<analy_code_id>
MSC Nastran
1
ABAQUS
2
ANSYS
3
MARC
4
Patran FEA
5
Patran Thermal
6
Patran CFD
9
Patran Advanced FEA
10
MARC K5
11
ANSYS 5
12
Patran TEAM
13
SAMCEF
15
PATRAN 2NF
16
MSC.Dytran
17
Patran STRUCTURAL OPTIMIZATION
19
MARC K6
20
LMS CADA-X
21
FASTRUDL
31
SESAM
321
DYNA3D
32
RCS
41
CFX-F3D
42
CFX-FLOW
43
MSC.DropTest
51
MSC.Forging
52
LS-DYNA3D
10001
PAMCRASH
13001

1 Conflict with DYNA3D will be resolved when the DYNA3D preference is eliminated.

The following PCL function can be used to specify which analysis code will be the default analysis code, i.e., which analysis code is automatically chosen as the analysis preference upon opening a new database.  
db_get_default_anal_code
(<analysis_code_name>)
Input:
 
 
None
 
 
Output:
 
 
STRING[31]
<analysis_code_name>
Analysis code name.
Error Conditions:
 
None.
 
 
 
db_get_anal_code_id
(<analysis_code_name>, <analysis_code_id>)
 
Input:
 
 
STRING[31]
<analysis_code_name>
Analysis code name.
Output:
 
 
INTEGER
<analysis_code_id>
Analysis code ID.
Error Conditions:
 
None.
 
 
 
uil_pref_analysis.set_analysis_pref
(<analy_code_name>, <analy_type_name>, <input_file_suffix>, <output_file_suffix>)
 
Input:
 
 
CHARACTER STRING
<analy_code_name>
The name of the analysis code to be set as the default. This name can be no more than 31 characters.
CHARACTER STRING
<analy_type_name>
The name of the analysis type to be set as the default for the chosen analysis code. This name can be no more than 31 characters.
CHARACTER STRING
<input_file_suffix>
The default file suffix for the input files of the chosen analysis code. This suffix can be no more than 4 characters.
CHARACTER STRING
<output_file_suffix>
The default file suffix for the output files of the chosen analysis code. This suffix can be no more than 4 characters.
Output:
 
 
None.
 
 
Error Conditions:
 
None.
 
 
Since the action of the above function, namely the changing of the chosen analysis code and analysis type, might affect forms which are currently being displayed, the user might wish to include a call to the widget refresh function at the end of his analysis code definition loading session file or PCL function. The syntax of this refresh function is shown below.
ui_wid_refresh( )
Custom Data and Application Region Sub-Forms
This section is for application developers who want to create their own customized Data and Application Region sub-form classes. The class names for these custom forms will be stored and loaded in from the database with a selected analysis preference. They can then accessed by pressing the “Input Data...” and/or “Select Application Region...” buttons in the Create action of the Loads/Boundary Conditions form. If a selected analysis preference does not have a custom sub-form class(es) associated with it for the data and/or application region classes, it will use the Patran default sub-form class(es).
The Create action of the Loads/Boundary Conditions form is the parent class for the two sub-form classes. It makes a number of calls to functions within the default sub-form classes to manage them. Consequently, the custom sub-form classes must contain these same function names called from the Parent class in order to maintain the integrity of the Parent class code. The sub-form classes may or may not utilize all of the function names called from the Parent class.
Since the name of the sub-form class may vary, the parent Create class must have a generic way of accessing the sub-form class. Normally this is done by using the ui_exec_function(classname, function) call with the class name that was loaded in from the database with the selected analysis preference. This call will work for class name functions that don’t require arguments for data passing.
In order to facilitate communication between the custom sub-form classes and the parent Create class with data passing arguments, a generic interface layer has been created consisting of two new classes:
lbc_input
lbc_select
These new classes are independent of the classes that control the data input and application region selection sub-forms. The interface layer is basically a set of storage areas for the common data being passed between the Create class and the associated custom class managing the sub-form.
Each custom sub-form class is required to contain function names which will be called by Patran whether the custom sub-forms utilize them or not.Some of the functions pass data to/from the calling class. Within the functions requiring data passing, the programmer must include a call to the corresponding lbc_input or lbc_select class to retrieve or return data as noted in the following documented interface calls for these functions.
Following is a list of the function names that Patran uses for communication and management of its two default sub-forms.
 
Important:  
One of the required function names for each custom class is initx. The initial Patran design of the LBC forms was made to bypass the standard init function and use an initx function. The initx functions of the custom sub-form classes must contain a call to ui_exec_function(classname, “init”) in order for the UIMS to know that the form has been initialized. Consequently the ui_form_exists(classname) call will return correctly whether or not the form has been initialized.
Required Functions for Data Input Class
The required function names for this class are:
init()
initx()
display()
input_disabled()
set_cur_data()
get_data()
get_mem()
update_cur_data()
get_data_defn()
The functions that require data passing through the generic interface layer are described below:
 
Required Function for Data Input Class
Input_disabled()
 
Description:
 
 
Called by loadsbcs_create class to determine if the data input form for the current (object, method, target) should be accessible.
Variable declarations (optional):
LOGICAL
flag
True: Enable the Input Data button.
False: Disable the Input Data button.
Preference call:
 
lbc_input.set_input_disable(flag)
Error Conditions:
 
None.
 
 
Notes:
Since it only makes sense to have access to the custom data input form, the variable declaration is optional and the interface call can be made as:
      lbc_input.set_input_disable(FALSE)
 
Required Function for Data Input Class
set_cur_data()
 
Description:
 
 
When an existing LBC set is selected from the listbox on the Create panel of the Loads/Boundary Conditions form, the values for the widgets which are to be displayed in this sub-form are set with the given values.
Variable declarations:
 
REAL
lbc_sf
Loads/BC Set Scale Factor.
STRING[LBC_DATA_LEN]
cid_data
Coordinate Frame.
INTEGER
num_data
Number of databoxes on the Input Data form.
INTEGER(NUM_LBC_INP_FLDS)
data_id
Internal Ids corresponding to the databoxes.
STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)
stat_data
Values from static databoxes.
STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)
dyn_data
Values from dynamic databoxes.
Preference call:
 
lbc_input.get_cur_data(lbc_sf, cid_data, num_data, data_id, stat_id, dyn_id)
Error Conditions:
 
None.
 
 
Notes:
Requires #include “app_lbcs.p” for variable array sizes.
 
Required Function for Data Input Class
get_data()
 
Description:
 
 
Used to transfer data from the data input sub-form to the loadsbcs_create class when creating a new set.
Variable declarations:
 
REAL
lbc_sf
Loads/BC Set Scale Factor.
STRING[LBC_DATA_LEN]
cid_data
Coordinate Frame.
INTEGER
num_data
Number of databoxes on the Input Data form.
INTEGER(NUM_LBC_INP_FLDS)
data_id
Internal Ids corresponding to the databoxes.
STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)
stat_data
Values from static databoxes.
STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)
dyn_data
Values from dynamic databoxes.
Preference call:
 
lbc_input.set_data(lbc_sf, cid_data, num_data, data_id, stat_id, dyn_id)
Error Conditions:
 
None.
 
 
Notes:
Requires #include “app_lbcs.p” for variable array sizes.
 
Required Function for Data Input Class
get_mem()
 
Description:
 
 
Allocate memory for any classwide virtual arrays.
Variable declarations:
 
INTEGER
stat
Return status of success or failure (0: success; -1: error)
Preference call:
 
lbc_input.set_status(stat)
Error Conditions:
 
None.
 
 
Required Functions for Application Region Selection Class
The required function names for this class are
 
init()
initx()
display()
get_mem()
get_data()
set_cur_data()
get_geo_index()
clear_app_region()
update_cur_data()
The functions that require data passing through the generic interface layer are described below:
 
Required Function for Data Input Class
get_geo_index()
 
Description:
 
 
Called by the loadsbcs_create class when an existing set is selected from the listbox. Given the selected set’s geometry string, this function returns the internal index for its application region’s geometry filter.
Variable declarations:
 
STRING
geometry_str[31}
Real Geometry Group string:
LBC_GEOMETRY_STR
LBC_FEM_STR
INTEGER
geo_index
Geometry Group internal index
1: Geometry
2: FEM
Preference call:
 
geometry_str = lbc_select.get_geo_group_str( )
lbc_select.set_geo_index(geo_index)
Error Conditions:
 
None.
 
 
Example:
geometry_str = lbc_select.get_geo_group_str()
IF (geometry_str == LBC_GEOMETRY_STR) THEN
geo_index = 1
ELSE IF (geometry_str == LBC_FEM_STR) THEN
geo_index = 2
END IF
lbc_select.set_geo_index(geo_index)
Notes:
Requires #include “app_lbcs.p” for LBC string definitions.
 
Required Function for Data Input Class
set_cur_data()
 
Description:
 
 
When an existing LBC set is selected from the listbox on the Create panel of the Loads/Boundary Conditions form, the values for the widgets which are to be displayed in this sub-form are set by changing the values with the given data.
Variable declarations:
 
INTEGER
grp
Geometry Group.
INTEGER
num_list
Number of application region lists.
STRING[VIRTUAL](VIRTUAL)
app_list
Application region lists.
INTEGER
couple
Coupling option.
INTEGER
order
Ordering option.
Preference call:
 
lbc_select.get_cur_data(grp, num_list, app_list)
lbc_select.get_cur_2_app_data(couple, order)
Error Conditions:
 
None.
 
 
Notes:
lbc_select.get_cur_2_app_data is only needed for 2 application region forms.
 
Required Function for Data Input Class
get_data()
 
Description:
 
 
Used to transfer data from the Select Application Region sub-form to the loadsbcs_create class when creating a new set.
Variable declarations:
 
INTEGER
result
Return status of success or failure. (0: success; -1: error)
INTEGER
num_ar
Number of application region.
INTEGER(2)
ar_id
Application Region ids.
STRING[VIRTUAL]
app_list1
Application Region list 1 of entities.
STRING[VIRTUAL]
app_list2
Application Region list 2 of entities.
STRING
geo_fltr[31]
Geometry filter which restricts entities which can be selected.
INTEGER
couple
Coupling option.
INTEGER
order
Ordering option.
Preference call:
 
lbc_select.set_status(result)
lbc_select.set_data(num_ar, ar_id, app_list1, app_list2, geo_fltr)
lbc_select.set_2_app_data(couple, order)
Error Conditions:
 
None.
 
 
Notes:
lbc_select.set_2_app_data is only needed for 2 application region forms.
 
Required Function for Data Input Class
get_mem()
 
Description:
 
 
Allocate memory for any classwide virtual arrays.
Variable declarations:
 
INTEGER
stat
Return status of success or failure. 0: success; -1: error)
Preference call:
 
lbc_select.set_status(stat)
Error Conditions:
 
None.