PCL and Customization > Accessing the Patran Database > Multi-point Constraints
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Multi-point Constraints
The MPC entity in a database is really a collection of multi-point constraint relations called “sub MPCs.” There will probably be a one to one relationship between a Patran sub MPC and the target analysis code’s MPC equation but a one to many relationship between a Patran MPC entity and the target analysis code’s MPC equation.
Exportation of Multi-point Constraint Data
Multi-point constraints are members of groups just as nodes and elements are. Therefore, MPCs of a specified group (e.g., the current group) or all the MPCs in the database can be translated to determine the count of MPCs in a group or all the MPCs in the database use one of the following two functions. This count can be used for allocation of storage memory.
To get the count of all the MPCs in the database, use the function below.
 
db_count_mpcs
( <num_mpcs> )
 
Output:
 
 
INTEGER
<num_mpcs>
The number of MPCs defined in the database.
LOGICAL
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbCountMpcs.
int DbCountMpcs ( num_mpcs )
 int 	*num_mpcs
Or, the following function can be used to determine the number of MPCs in a specified group.
 
db_count_mpcs_in_group
( <group_id>, <num_mpcs> )
 
Input:
 
 
INTEGER
<group_id>
The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.
Output:
 
 
INTEGER
<num_mpcs>
The number of MPCs belonging to the group specified by <group_id>.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbCountMpcsInGroup.
int DbCountMpcsInGroup ( group_id, num_mpcs )
 int 	group_id
 int 	*num_mpcs
 
db_get_mpc_ids
( <num_mpcs>, <mpc_ids> )
 
Input:
 
 
INTEGER
<num_mpcs>
The number of MPCs defined in the database.
Output:
 
 
INTEGER ARRAY
 
 
<mpc_ids>
The <num_mpcs> IDs of all the MPCs defined in the database.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetMpcIds.
int DbGetMpcIds ( num_mpcs, mpc_ids )
 int 	num_mpcs
 int 	mpc_ids [ ]
Use the function “db_get_mpcs_in_group” to extract all the IDs for the MPCs belonging to a particular group.
 
db_get_mpcs_in_group
( <num_mpcs>, <group_id>, <mpc_ids> )
 
Input:
 
 
INTEGER
<num_mpcs>
The number of MPCs defined in the database.
INTEGER
<group_id>
The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.
Output:
 
 
INTEGER ARRAY
 
 
<mpc_ids>
The <num_mpcs> IDs of all the MPCs belonging to the group specified by <group_id>.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetMpcsInGroup.
int DbGetMpcsInGroup ( num_mpcs, group_id, mpc_ids )
 int 	num_mpcs
 int 	group_id
 int 	mpc_ids [ ]
The function “db_get_mpc” is used to get data about an MPC entity including the type of the MPC and the number of relations (sub MPCs) belonging to the MPC.
 
db_get_mpc
( <mpc_id>, <mpc_type_id>, <geom_flag>, <coord_id>, <constant>, <sequen_flag>,<num_sub_mpcs>,<num_terms>,<max_num_nodes>, <max_num_dofs> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity of interest.
Output:
 
 
INTEGER
<mpc_type_id>
The ID of the MPC type. See db_create_mpc_type_def, 589 for details about the meaning of this ID.
LOGICAL
<geom_flag>
A flag specifying whether this MPC references geometry (TRUE) or finite element nodes (FALSE).
INTEGER
<coord_id>
The coordinate frame in which the multi-point constraint relations are expressed. Zero if in the relation is expressed in the global system or a frame reference is not appropriate.
REAL
<constant>
The equation constant of the MPC, if applicable.
LOGICAL
<sequen_flag>
A flag specifying whether the sequence of data input is of importance (TRUE) or not (FALSE). If sequence is important, the order in which the data is received from the database functions will be the order in which the data was input to Patran.
INTEGER
<num_sub_mpcs>
The number of sub MPCs (multi-point constraint relations) which belong to this MPC entity.
INTEGER
<num_terms>
The number of terms which each of the sub MPCs will have.
INTEGER
<max_num_nodes>
The maximum number of nodes associated with any given MPC term in this MPC entity.
INTEGER
<max_num_dofs>
The maximum number of degrees-of-freedom associated with any given MPC term in this MPC entity.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetMpc.
int DbGetMpc ( mpc_id, mpc_type_id, geom_flag, coord_id, constant, sequen_flag,
	num_sub_mpcs, num_terms, max_num_nodes, max_num_dofs )
 int 	mpc_id
 int 	*mpc_type_id
 int 	*geom_flag
 int 	*coord_id
 float 	*constant
 int 	*sequen_flag
 int 	*num_sub_mpcs
 int 	*num_terms
 int 	*max_num_nodes
 int 	*max_num_dofs
The <mpc_type_id> argument in the above function (“db_get_mpc”) should be sufficient to determine the type of MPC and how this MPC should be translated. But, if more information is desired about the definition of this MPC type, use the following function.
 
db_get_mpc_type_def
( <type_id>, <type_name>, <geom_flag>, <coord_flag>, <const_flag>, <const_label>, <sequen_flag>, <depend_coeff_flag>, <depend_dof_flag>, <max_depend_terms>, <min_depend_terms>, <dofs_per_depend>, <nodes_per_depend>, <indep_coeff_flag>, <indep_dof_flag>, <max_indep_terms>, <min_indep_terms>, <dofs_per_indep>, <nodes_per_indep> )
 
Input:
 
 
INTEGER
<type_id>
The ID of the MPC type of interest.
Output:
 
 
CHARACTER STRING
 
 
<type_name>
The name of this MPC type.
LOGICAL
<geom_flag>
A flag specifying whether this MPC type references geometry or nodes:
TRUE = references geometry
FALSE = references nodes
LOGICAL
<coord_flag>
A flag specifying whether this MPC type references a coordinate frame or not:
TRUE = references coordinate frame
FALSE = does not reference frame
LOGICAL
 
A flag specifying whether this MPC type has a constant term or not:
TRUE = has constant term
FALSE = does not have constant term
CHARACTER STRING
 
 
<const_label>
The label to be used for the constant term
LOGICAL
<sequen_flag>
A flag specifying whether the order of term definition should be maintained or not:
TRUE = maintain order
FALSE = ignore order
LOGICAL
<depend_coeff_flag>
 
 
A flag specifying whether the dependent terms have multiplicative constants assigned to them or not:
TRUE = have multiplicative constants
FALSE = do not have constants
LOGICAL
<depend_dof_flag>
 
 
A flag specifying whether the dependent terms have explicitly or implicitly specified degrees-of-freedom:
TRUE = degrees-of-freedom explicitly defined
FALSE = implicit degrees-of-freedom
 
 
INTEGER
<max_depend_terms>
 
 
The maximum number of dependent terms allowed. Zero if there is no limit.
INTEGER
<min_depend_terms>
 
 
The minimum number of dependent terms allowed.
INTEGER
<dofs_per_depend>
 
 
The maximum number of degrees-of-freedom that can be associated with a dependent term.
INTEGER
<nodes_per_depend>
 
 
The number of nodes to be associated with each dependent term. Zero if there is no definite number.
LOGICAL
<indep_coeff_flag>
 
 
A flag specifying whether the independent terms have multiplicative constants assigned to them or not:
TRUE = have multiplicative constants
FALSE = do not have constants
LOGICAL
<indep_dof_flag>
 
 
A flag specifying whether the independent terms have explicitly or implicitly specified degrees-of-freedom:
TRUE = degrees-of-freedom explicitly defined
FALSE = implicit degrees-of-freedom
INTEGER
<max_indep_terms>
 
 
The maximum number of independent terms allowed. Zero if there is no limit.
INTEGER
<min_indep_terms>
 
 
The minimum number of independent terms allowed.
INTEGER
<dofs_per_indep>
 
 
The maximum number of degrees-of-freedom that can be associated with an independent term.
INTEGER
<nodes_per_indep>
 
 
The number of nodes to be associated with each independent term. Zero if there is no definite number.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetMpcTypeDef.
int DbGetMpcTypeDef (type_id, type_name, geom_flag, coord_flag, const_flag, const_label,
	sequen_flag, depend_coeff_flag, depend_dof_flag, max_depend_terms,
	 min_depend_terms, dofs_per_depend, nodes_per_depend,
	 indep_coeff_flag, indep_dof_flag, max_indep_terms,
	 min_indep_terms, dofs_per_indep, nodes_per_indep )
int 	type_id
char 	type_name [ ]
int 	*geom_flag
int 	*coord_flag
int 	*const_flag
char 	const_label [ ]
int 	*sequen_flag
int 	*depend_coeff_flag
int 	*depend_dof_flag
int 	*max_depend_terms
int 	*min_depend_terms
int 	*dofs_per_depend
int 	*nodes_per_depend
int 	*indep_coeff_flag
int 	*indep_dof_flag
int 	*max_indep_terms
int 	*min_indep_terms
int 	*dofs_per_indep
int 	*nodes_per_indep
The IDs of all the sub MPCs belonging to the MPC entity is extracted by “get all”/”get next” functions. First, the “get all” function is called to prepare for the extraction of the sub MPC IDs. Then, the “get next” function is called until a non-zero status is returned signifying that all the sub MPC IDs have been received. The “get all” function is described below.
 
db_get_all_sub_mpc
( <mpc_id> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity of interest.
Output:
 
 
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetAllSubMpc.
int DbGetAllSubMpc ( mpc_id )
 int 	mpc_id
The “get next” function for extracting sub MPC IDs is described below. This function should be called until a non-zero status is returned. The data received from the call that returned the non-zero status is meaningless (i.e., all data was extracted in the previous calls).
 
db_get_next_sub_mpc
( <mpc_id>, <sub_mpc_id> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity of interest.
Output:
 
 
INTEGER
<sub_mpc_id>
The ID of one of the sub MPCs (multi-point constraint relations) belonging to the MPC entity specified by <mpc_id>.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetNextSubMpc.
int DbGetNextSubMpc ( mpc_id, sub_mpc_id )
 int 	mpc_id
 int 	*sub_mpc_id
The terms belonging to a sub MPC are extracted from the database using a “get all”/”get next” set of functions also. As mentioned above, first call the “get all” function to prepare for the exportation of the MPC term data. Then, call the “get next” function until a non-zero return status from the function is received (signifying that all the MPC term data has already been extracted). The “get all” function is described below:
.
db_get_all_mpc_term
( <mpc_id>, <sub_mpc_id> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity of interest.
INTEGER
<sub_mpc_id>
The ID of the sub MPC (or multi-point constraint relation) of interest.
Output:
 
 
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetAllMpcTerm.
int DbGetAllMpcTerm ( mpc_id, sub_mpc_id )
 int 	mpc_id
 int 	sub_mpc_id
The “get next” function for extracting MPC term data is described below. This function should be called until a non-zero status is returned. The data received from the call that returned the non-zero status is meaningless (i.e., all data was extracted in the previous calls).
 
db_get_next_mpc_term
( <mpc_id>, <sub_mpc_id>, <max_num_nodes>, <max_num_dofs>, <mpc_term_id>, <depend_flag>, <term_coeff>, <node_ids>, <dofs>, <num_nodes>, <num_dofs> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity of interest.
INTEGER
<sub_mpc_id>
The ID of the sub MPC (or multi-point constraint relation) of interest.
INTEGER
<max_num_nodes>
 
 
The maximum number of nodes that can be associated with this term. This value is obtained from “db_get_mpc”.
INTEGER
<max_num_dofs>
 
 
The maximum number of degrees-of-freedom that can be associated with this term. This value is gotten from “db_get_mpc”.
Output:
 
 
INTEGER
<mpc_term_id>
The ID of this MPC term.
LOGICAL
<depend_flag>
A flag specifying whether the term is a dependent term of the MPC equation (TRUE) or an independent term (FALSE).
REAL
<term_coeff>
The coefficient specified for this MPC term.
INTEGER ARRAY
 
 
<node_ids>
The IDs of all the nodes associated with this MPC term.
INTEGER ARRAY
 
 
<dofs>
The IDs of all the degrees-of-freedom associated with this MPC term. For details about the meanings of these IDs, see db_create_degree_of_freedom. These degrees-of-freedom are applied to each of the nodes specified in <node_ids>. For example, three node IDs in <node_ids> and three degrees-of-freedom in <dofs> would result in nine equation terms.
INTEGER
<num_nodes>
The actual number of nodes associated with this MPC term.
INTEGER
<num_dofs>
The actual number of degrees-of-freedom associated with this MPC term.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetNextMpcTerm.
int DbGetNextMpcTerm ( mpc_id, sub_mpc_id, max_num_nodes, max_num_dofs,
 	mpc_term_id, depend_flag, term_coeff, node_ids, dof, num_nodes,
	 num_dofs )
 int 	mpc_id
 int 	sub_mpc_id
 int 	max_num_nodes
 int 	max_num_dofs
 int 	*mpc_term_id
 int 	*depend_flag
 float 	*term_coeff
 int 	node_ids [ ]
 int 	dof [ ]
 int 	*num_nodes
 int 	*num_dofs
Importation of Multi-Point Constraint Data
There are three different techniques which to employee in assigning IDs to MPC entities. Assume that there will be no MPC ID conflict and simply add the MPC entities with the IDs they currently possess. Fetch the largest MPC ID which exists in the database and assign MPC IDs greater than this value. Lastly, query for MPC ID conflicts using the original ID if there is no conflict or using an ID greater than the largest existing MPC ID if there is a conflict. The function for querying for a MPC ID conflict is “db_mpc_exist.”
 
db_mpc_exist
( <num_mpcs>, <mpc_ids>, <exist> )
  
Input:
 
 
INTEGER
<num_mpcs>
The number of MPC IDs to be checked.
INTEGER ARRAY
 
 
<mpc_ids>
The <num_mpcs> MPC IDs to check.
Output:
 
 
INTEGER ARRAY
 
 
<exist>
The <num_mpcs> flags specifying whether each MPC ID is already in use (1) or not (0).
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFMpcExist.
int DbFMpcExist ( num_mpcs, mpc_id, exist )
 int 	num_mpcs
 int 	*mpc_id
 int 	*exist
The function “db_get_max_mpc” is used to fetch the maximum MPC ID existent in the database.
 
db_get_max_mpc
( <max_mpc_id> )
 
Output:
 
 
INTEGER
<max_mpc_id>
The maximum MPC ID currently existing in the database.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbGetMaxMpc.
int DbGetMaxMpc ( max_mpc_id )
int 	*max_mpc_id
First define the MPC entity. This is accomplished with the following function.
 
db_create_mpc_nodal
( <mpc_id>, <mpc_type_id>, <coord_id>, <constant> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity as determined by one of the methods described above. This ID must be unique with respect to all other MPC entity IDs and must be greater than zero.
INTEGER
<mpc_type_id>
The ID of the MPC type. See db_create_mpc_type_def, 589 for details about this ID.
INTEGER
<coord_id>
The ID of the coordinate frame in which all the multi-point constraint relations of this MPC entity are expressed. Zero if the relations are in the global system or if the equations are interpreted in the nodal system of each node.
REAL
<constant>
The constant term for all the constraint relations of this MPC entity.
Output:
 
 
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C prototype for this function is:
      int DbCreateMpcNodal
         (
         int 	mpc_id,
         int	mpc_type_id,
         int  	coord_id,
         double	constant,
         );
To assign sub MPCs (multi-point constraint relations) to the MPC entity created above, the following function is used.
 
db_create_sub_mpc
( <mpc_id>, <sub_mpc_id> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity to which a sub MPC is to be added.
Output:
 
 
INTEGER
<sub_mpc_id>
The ID assigned to the new sub MPC by Patran.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbCreateSubMpc.
int DbCreateSubMpc ( mpc_id, sub_mpc_id )
 int 	mpc_id
 int 	*sub_mpc_id
To assign the necessary MPC term data to the sub MPCs, use the function listed below.
 
db_create_mpc_term
( <mpc_id>, <sub_mpc_id>, <depend_flag>, <num_nodes>, <num_dofs>, <term_coeff>, <node_ids>,<dofs>,<mpc_term_id> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC entity as determined by one of the methods described above. This ID must be unique with respect to all other MPC entity IDs and must be greater than zero.
INTEGER
<sub_mpc_id>
The ID of the sub MPC to which the MPC term is to be added.
LOGICAL
<depend_flag>
A flag specifying whether this MPC term is a dependent term (TRUE) or an independent term (FALSE).
INTEGER
<num_nodes>
The number of nodes belonging to this MPC term.
INTEGER
<num_dofs>
The number of degrees-of-freedom belonging to this MPC term.
REAL
<term_coeff>
The coefficient assigned to this MPC term.
INTEGER ARRAY
 
 
<node_ids>
The <num_nodes> IDs of all the nodes belonging to this MPC term.
INTEGER ARRAY
 
 
<dofs>
The <num_dofs> IDs of all the degrees-of-freedom belonging to this MPC term. See db_create_degree_of_freedom, 469 for details about these IDs. These degrees-of-freedom affected each of the nodes listed in <node_ids>. For example, three nodes in <node_ids> and three degrees-of-freedom in <dofs> will result in nine equation terms.
Output:
 
 
INTEGER
<mpc_term_id>
The ID assigned to this MPC term by Patran.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C prototype for this function is:
      int DbCreateMpcTerm
         (
         int	mpc_id,
         int	sub_mpc_id,
         int	depend_flag,
         int	num_nodes,
         int	num_dofs,
         double	coefficient,
         int	*  node_ids,
         int	*  dof_ids,
         int	*  mpc_term_id
         );
Lastly, add the newly created MPC to a group. The function “db_add_mpc_to_group” will accomplish this task.
 
db_add_mpc_to_group
( <mpc_id>, <group_id>, <visible> )
 
Input:
 
 
INTEGER
<mpc_id>
The ID of the MPC to be added to the specified group.
INTEGER
<group_id>
The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups.
LOGICAL
<visible>
A flag specifying whether the MPC entity is visible (TRUE) or not (FALSE).
Output:
 
 
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name is DbAddMpcToGroup.
int DbAddMpcToGroup ( mpc_id, group_id, visible )
 int 	mpc_id
 int 	group_id
 int 	visible