Analysis Solution

Analysis Modeler

Generating the Field Model

Generate the field model of an analysis entity associated to a support
Use Case

Abstract

This article explains how to generate the field model of an analysis entity associated to a support. This  step includes the creation of the start up into the catalog of features and the definition of the CATISamExplicitation extension. 


What You Will Learn With This Use Case

This use case is intended to help you to generate the field model of an analysis entity associated to a support. This use case will also include the definition of the authorized support. 

More specifically, the CAAAniExplicit use case shows how to :

[Top]

Definition of the authorized support of an analysis feature

Generation of the StartUp : ANISymetricalTensorEntityTst 

ANISymetricalTensorEntityTst is an analysis entity made of two basic components : a symmetrical (3x3) tensor and a degree of freedom. Its authorized support is only FreeGroup. In order to have the behavior of a clamp, we keep the default value of SAMDOFBinary which restraints each degree.  SAMDOFBinary  is composed of 6 bits to code each degree of freedom. If the degree is restrained, the value is set to 1. So for the clamp, we get a value of 63.

 The ANISymetricalTensorEntityTst derives from the AnalysisRestraint StartUp and the  ANISymetricalTensorTst from the SAMTensor StartUp.

 

[Top]

Authorized support : FreeGroup

In order to specify the authorized support born by ANISymetricalTensorEntityTst, you can use the CATISamAnalysisSupport::SetAuthorizedSupport method to set the "AuthorizedSupport" attribute to SupportId_FreeGroup (you can find the support identity in CATSamDefs.h).

[Top]

 

Implementation of CATESamTensorExplicit, extension of CATISamExplicitation

The link from Analysis features and field model entities is managed by both CATISamExplicit and CATISamExplicitation interfaces. CATISamExplicit manages the life cycle of the field model entities associated to a feature and CATISamExplicitation ensure the possibility for the analysis features to be translated into a format understandable by solvers (Explicit format). 

This second interface must be overloaded for a specific field model creation. That is why we must overload all the abstract methods of CATISamExplicitation which implies the overload of TranslateToFieldModel. The translation of an analysis feature into an explicit language may result in the creation of several explicit data.

In all cases Field model entities have to be created inside an implementation of CATISamExplicitation interface. This will ensure that all V5 fundamentals (copy/paste, update, undo/redo... ) will be correctly managed for the field model entities.

[Top]

 

The CAAAniExplicit Use Case

CAAAniExplicit is a use case of the CAAAnalysisInterfaces.edu framework that illustrates the CATIA Analysis modeler frameworks capabilities.

What Does CAAAniExplicit Do

The goal of this use case is to generate the associated field model of ANISymetricalTensorEntityTst, an analysis feature composed of a tensor, a degree of freedom and associated to a FreeGroup support. For this, the required method TranslateToFieldModel must be overloaded in the CAAEAniTensorExplicit extension of CATISamExplicitation interface. You have to manage prerequisite catalog knowledge or the exact attribute names used for the modelisation.

The main methods to use are:

More specifically, the CAAAniExplicit use case shows how to:

[Top]

Where to Find the CAAAniExplicit Code

CAAAniExplicit code is located in the CAAAniExplicit.m use case module of the CAAAnalysisInterfaces.edu framework:

Windows InstallRootDirectory\CAAAnalysisInterfaces.edu\CAAAniExplicit.m\
Unix InstallRootDirectory/CAAAnalysisInterfaces.edu/CAAAniExplicit.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed. It is made of a source file named CAAEAniTensorExplicit.cpp and the include file CAAEAniTensorExplicit.h. There is also a main file called CAAAniModifyCatalog.cpp which modifies the feature catalog, CAAAniCatalog.CATfct, used in the different UseCases.

[Top]

Illustration of the result

First two free groups have been creating : a spherical box ("Spherical Box/Edition.1") and a pad ("SAMBoxGroup.1"). Then we have applied a clamp on them with the feature ANISymetricalTensorEntityTst referenced by "Tensor/Edition.2" in the feature tree. We can notice that the TranslateToFieldModel has been well done. Indeed on every node belonged to the free groups there is a blue axis which shows the restraints.

[Top]

 

Step-by-Step

There are seven logical sections in CAAAniExplicit.m. We will now comment each of those sections by looking at the code.

[Top]

Update the dictionary to link the CATISamExplicitation interface to SAMSymetricalTensorEntityTst

STRUCTURAL_ANISymetricalTensorEntityTst        CATISamExplicitation
libCAAAniExplicit
             STRUCTURAL_My feature  Interface it adheres to      Library that contains the actual code 
through its extension for this given interface adhesion

In order to implement the extension bound to SAMSymetricalTensorEntityTst, you have to update the dictionary (*.dic). 

[Top]

Implementing the CATISamExplicitation extension : CAAEAniTensorExplicit

...
CATImplementClass( CAAEAniTensorExplicit, CodeExtension, CATBaseUnknown, STRUCTURAL_ANISymetricalTensorEntityTst);
 
// Tie the implementation to its interface
// ---------------------------------------
#include "TIE_CATISamExplicitation.h"
TIEchain_CATISamExplicitation(CAAEAniTensorExplicit);
...

[Top]

Function TranslateToFieldModel to implement

...
HRESULT CAAEAniTensorExplicit::TranslateToFieldModel(	CATISpecObject* iFeatToTranslate, 
		 			       	CATISamAnalysisModel* iFEMModel, 
						CATAnalysisExplicitListUsr& iOldExplObjects, 
						CATAnalysisExplicitListUsr& oNewExplObjects)
{ ...

iFeatToTranslate is the analysis feature to "translate" to the field model (implement CATISAMExplicit). iFEMModel is the analysis model in which the feature is defined. iOldExplObjects is the previous version of the field model version, where as oNewExplObjects is the new version of the field model objects.

[Top]

Retrieve the field model pointer 

...
CATISamExplicit_var SpecExpli(iFeatToTranslate);
if (! SpecExpli) return E_NOINTERFACE;
CATAnalysisExplicitModel* ExplicitModel = SpecExpli -> GetExplicitModel();
if (!ExplicitModel) return E_FAIL;
...

[Top]

Creation of the needed lists for the explicitation and retrieve the list of containing data 

...
CATAnalysisExplicitListUsr	ContainingData,	AxisList;
ContainingData.CreateList(ExplicitModel);
AxisList.CreateList(ExplicitModel);

HR = SpecExpli -> GetContainingData(iOldExplObjects,ContainingData);
...

The method GetContainingData returns the list of explicit parent object in which the feature is involved. 

[Top]

Creation of the new version of the explicit objects 

The ANISymetricalTensorEntityTst is defined by its value (DoF = 63, "clamp") and is applied to the nodes determined by the FreeGroup support. This implies that in the field model an entity with the physical type "RESTRAINT_DISPLACEMENT" must be created. Moreover this entity is applied to the list of nodes.

...
CATISamAnalysisEntity_var AnalysisEntity(iFeatToTranslate);
if(!AnalysisEntity)	return E_HANDLE;
	
CATLISTV(CATBaseUnknown_var) *BasCompList = NULL;
CATISamBasicComponent_var aBasComp;

// We get the Basic Component dedicated to the DOF description of
// the restrain. 
int DOFDescVal=0;
HR = AnalysisEntity->GetBasicComponents(BasCompList,"SAMDOFBinary");
if (SUCCEEDED(HR) && BasCompList->Size()>0)
{
	aBasComp = (*BasCompList)[1];		
	if (!aBasComp) 			HR = E_FAIL;

	if (SUCCEEDED(HR))HR = aBasComp->GetIntegerValue(DOFDescVal);	
}
if (BasCompList) 	delete BasCompList;	BasCompList = NULL;
...

To extract the values of the basic component, you can use the CATISamAnalysisEntity interface which is implemented on iFeatToTranslate.

[Top]

...
CATISamAnalysisSupport_var Support(iFeatToTranslate);
if (!Support) return E_FAIL;

CATLISTV(CATBaseUnknown_var) SupportsList;
HR = Support->GetEntities(SupportsList,CATBaseUnknown::ClassId());
if (FAILED(HR)) return E_FAIL;
...

[Top]

...
CATISamGroup_var					Group;
CATISamAnalysisConnector_var			Connector	;
const	CATAnalysisEntityCollector*	EntityCollector	= NULL;
CATSamValue					SamValue		= CATSamValueNode;
const	CATSamPhysicalType*			oElemTypes	= NULL;
CATLISTP(CATAnalysisEntityCollector) 		ListCollectors;
 
for (i=1 ; i <= SupportsList.Size() ; i++)
{
	Connector = SupportsList[i];
	if (!!Connector)	Group = Connector;
	if (!Group) return E_FAIL;
	HR = Group->GetContent(SamValue,Position,EntityCollector);
	if (FAILED(HR) ) return E_FAIL;
	if (EntityCollector)
	{
		ListCollectors.Append((CATAnalysisEntityCollector*)EntityCollector);
		EntityCollector=NULL;
	}	
	else 
		return E_FAIL;
}
...

To retrieve the list of nodes from the FreeGroup, you can use the GetContent method.

[Top]

...
CATSamPhysicalType EntPhysTypeNb,CharacPhysTypeNb;
CATAnalysisExplicitEntity ExpEntity;
CATAnalysisExplicitCharac ExpCharac;
short characValue = DOFDescVal;
size = ListCollectors.Size();
const CATAnalysisExplicitRulesData *pRulesData = NULL;
pRulesData = ExplicitModel->GetRulesData();
if(!pRulesData) return E_FAIL;
pRulesData->GetPhysicalTypeNumber(aPhysicalType,EntPhysTypeNb);
pRulesData->GetPhysicalTypeNumber("DEGREES_OF_FREEDOM",CharacPhysTypeNb);
  
for(i=1 ; i <= size ; i++)
{
  ExpEntity.CreateEntity(ExplicitModel,EntPhysTypeNb);
  ExpCharac.CreateCharac(ExpEntity,CharacPhysTypeNb);
  ExpCharac.SetValues(characValue);
  if (ExpEntity != NULL_exp) oNewExplObjects += ExpEntity;
}
...

The main object is created without parent and is stored in the oNewExplObjects list.

[Top]

...
const CATSamExplicitPtr * ApplyTo = NULL;
const int* ApplyNumber = NULL;
int NbEntity = oNewExplObjects.GetLength();
if (!NbEntity) return E_FAIL;
ExpEntity = *(oNewExplObjects.First()) ;
CATSamPosition  ApplyPosition;

//Retrieve the collector information
CATString Pos;
for(i=1 ; i <= ListCollectors.Size(); i++)
{
	EntityCollector = ListCollectors[i];
	if(!EntityCollector) return E_FAIL;

	HR = EntityCollector->GetDefinition(SamValue, Pos);
	if(FAILED(HR)) return HR;
	HR = CATSamIdentityEnum(Pos.CastToCharPtr(), ApplyPosition);
	
	//retrieve the explicit pointers
	HR = EntityCollector -> GetExplicitPointers(Number, ApplyTo, ApplyNumber);
	if (FAILED(HR)) return HR;
	if (ApplyNumber) 
		HR = ExpEntity.ApplyTo(Number, ApplyTo, ApplyPosition, ApplyNumber);
	else             
		HR = ExpEntity.ApplyTo(Number, ApplyTo, ApplyPosition);
	if (FAILED(HR)) return HR;

	ApplyTo = NULL;
	EntityCollector = NULL;
	if (NbEntity == size) ExpEntity = *(oNewExplObjects.Next()) ;
}
...

[Top]

Update the lists 

...
HR = SpecExpli -> UpdateExplicitList(iOldExplObjects,ContainingData,oNewExplObjects);
if (ContainingData != NULL_exp ) ContainingData.Delete();
...

This method deletes the oOldExplObjects, create the links between oNewExplObjects and the containing data. 

[Top]

In Short

This article goal is to have a example of the implementation of the CATISamExpliciation interface on an analysis entity associated to a support.

[Top]


References

[1] Feature Modeler
[2] Analysis Modeler Overview
[3] About Degree of Freedom

[4]

Creating Analysis Startup's in a Catalog file

[Top]

History

Version: 1 [Dec 2002] Document created
[Top]

Copyright © 2002, Dassault Systèmes. All rights reserved.