PCL and Customization > Accessing the Patran Database > Association between Elements and Element Properties
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Association between Elements and Element Properties
Extracting Association between Elements and Element Properties
There are two methods of determining an element’s association to an element property region. Use “db_get_region_for_elements” in order to get the region IDs associated with each input element ID. The form of this function is as follows:
 
db_get_region_for_elements
( <num_elems>, <element_ids>, <region_ids> )
 
Input:
 
 
INTEGER
<num_elems>
The number of elements input to this function.
INTEGER ARRAY
<element_ids>
The <num_elems> IDs of all the input elements.
Output:
 
 
INTEGER ARRAY
<region_ids>
The <num_elems> IDs of all the element property regions associated with each input element.
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 DbFGetRegionForElements.
int DbFGetRegionForElements ( num_elems, element_ids, region_ids )
int 	num_elems
int 	element_ids[ ]
int 	region_ids[ ]
Alternatively, to get the count of all the elements associated to a given element property region and then extract the IDs of all the elements associated with the specified element property region. The two functions needed for this method are described below.
 
db_count_elements_in_region
( <region_id>, <num_elems> )
 
Input:
 
 
INTEGER
<region_id>
The internal ID of the element property region of interest.
Output:
 
 
INTEGER
<num_elems>
The number of elements associated with the element property region specified by <region_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 differs. It is DbFCountElementsInRegion.
int DbFCountElementsInRegion ( region_id, num_elems )
int 	region_id
int 	*num_elems
  
db_get_elements_in_region
( <num_elems>,<region_id>,<element_ids> )
 
Input:
 
 
INTEGER
<num_elems>
Input only if the input value is not zero. The number of elements associated with the element property region specified by <region_id>.
INTEGER
<region_id>
The internal ID of the element property region of interest.
Output:
 
 
INTEGER
<num_elems>
Only output if the input value is zero. The number of elements associated with the element property region specified by <region_id>.
INTEGER ARRAY
<element_ids>
The <num_elems> IDs of all the elements associated with the element property region specified by <region_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 differs. It is DbFGetElementsInRegion.
int DbFGetElementsInRegion ( num_elems, region_id, element_ids )
int 	*num_elems
int 	region_id
int 	*element_ids
Note that there are two ways of incorporating the two functions mentioned above. To determine the exact number of elements associated to the region by using “db_count_elements_in_region” allocate exactly that much memory and then get the element IDs from “db_get_elements_in_region”. In this scenario, the <num_elems> argument input to “db_get_elements_in_region” would be non-zero and would be the value coming from “db_count_elements_in_region”. On the other hand, if a maximum limit is known for the number of elements associated with the property region, say the number of elements in the model, then skip the first function, allocate memory according to the maximum limit and then call “db_get_elements_in_region” with the input argument <num_elems> having the value of zero. The first approach takes more time but does not waste memory, whereas the second approach is faster but may allocate unnecessarily large chunks of memory.
Creating Association between Elements and Element Properties
The function used to create association between an element and an element property region is described below. Note that an element can only be associated to one element property region.
  
db_associate_element_to_region
( element_id, region_id )
 
Input:
 
 
INTEGER
num_elems
The ID of the element to be associated to the specified element property region.
INTEGER
element_ids
The ID of the element property region to which the element is to be associated.
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 differs. It is DbFAssociateElementToRegion.
int DbFAssociateElementToRegion ( element_id, region_id )
int 	element_id
int 	region_id