[cgma-dev] Fw: Re: ***SPAM*** Re: errors with OCC

Tim Tautges tautges at mcs.anl.gov
Tue Feb 3 11:25:31 CST 2009


First, please refer to the CGM paper in Engineering with Computers (see 
http://homepages.cae.wisc.edu/~tautges/papers/EWC-cgm.pdf and 
http://homepages.cae.wisc.edu/~tautges/papers/attribs-paper.pdf).  For 
that second paper, note the design of the attributes classes has changed 
somewhat since it was written.

Specific comments below.

Jiangtao Hu wrote:
> Hi, Tim, Jason
> 
> Leidy asked some fundamental questions for how CGM was designed with regarding to mesh attributes. I wasn't involved in designing, so forwarding it to you guys, hopefully she'll get a satisfying reply...
> 
> Jane
> 
> --- On Mon, 2/2/09, Leidy Suarez <ly.suarez at ingeciber.com> wrote:
> 
>> From: Leidy Suarez <ly.suarez at ingeciber.com>
>> Subject: Re: ***SPAM***  Re: errors with OCC
>> To: jiangtao_ma at yahoo.com
>> Date: Monday, February 2, 2009, 10:30 AM
>> Hi, Jane
>>
>> Please see comments below.
>>
>> 1. Currently, mesh attributes is defined in Cubit
>> application, not in CGM application. So if you want to
>> define your mesh attributes without using Cubit, you can
>> define/register it in your application which will be on top
>> of CGM.
>>
>> Why does mesh attributes not define in CGM application? 
>>

CGM is designed to be independent of meshing code, yet provide a way for 
meshing code to extend geometry code (see details in CGM paper on 
extending CGM).

>>
>> 2. You can look at  CGMApp,  CubitAttrib, CubitAttribUser
>> and  CubitAttribManager in CGM on how to register/create
>> your type of attributes.
>>
>> I doing something that:
>>   result =
>> CGMApp::instance()->attrib_manager()->register_attrib_type(CA_MESH_INTERVAL,
>> "mesh size", "MESH_SIZE",
>> 									CAMeshSize_creator, CUBIT_TRUE, CUBIT_TRUE, 
>> 									CUBIT_TRUE, CUBIT_TRUE, CUBIT_TRUE, CUBIT_FALSE); 
>>  
>>
>> 3. After you've registered your attribute, you need to
>> define it's copy behavior. You may refer to any of the
>> CA* files (example CAEntityName) to see how each attributes
>> defines copy(split_owner).
>> 4. Finally, on you OCC open code, you can add copy
>> attributes call to the sweep code to copy attributes from
>> base shape to swept top shape.
>>
>>
>> I am trying to create a CAMeshSize class to apply mesh size
>> attribute (RefEntity RefVolume, RefFace or RefEdge). But I
>> do not know what I must doing to reach that for example,
>> when occur a geometry modification such as a result of
>> boolean operation, the surviving geometry preserves the size
>> mesh values assigned before operation.
>>
>> I have thought having a list maintains a map between
>> RefEntity pointer and the size mesh, similar to
>> RefEntityNameMapList. But I do not know when and where must
>> I update this list?.

You have several options.  The approach used by CUBIT is to derive a 
class from RefEntity, called MRefEntity, and create those when a normal 
refentity is created.  That's the reason there is a RefEntityFactory, 
and a way for your application to substitute its own version of that 
class.  If you do it that way, then you can maintain updates by 
inserting code in the constructor/destructor of your derived class. 
That will cover the case of creation/deletion.

For modifications, you can design your own attribute (CAxxx) and the 
copy, merge, and other behavior (implemented in method on the 
CubitAttrib class, I think).

I think handling the interval size in either way is fine, it just 
depends on how you encapsulate behavior, and whether you want to handle 
intervals directly in the derived refentity class or separately in some 
other attribute class.

- tim

>>
>> I want really functionalities of mesh size such that I can
>> apply a size mesh to the geometric entities. For example, I
>> would like have a virtual method in the class RefEntity and
>> your children: RefEdge, RefFace, RefVolume, etc. such as
>> "setMeshSize" and "getMeshSize" similar
>> to method entity_name() where I can set and get the size of
>> the mesh. 
>> I think can not doing adding functionalities of mesh size
>> without cause modifications to the CGM code. But I do not
>> want this. What do I doing ?
>>
>> Thanks,
>>
>> Leidy
>>
>>
>>
>> Jiangtao Hu wrote:
>>
>>   Hi, Leidy
>>
>> I discussed among my team, we are suggesting the following
>> way to address your desire for sweeping mesh attributes:
>>
>> 1. Currently, mesh attributes is defined in Cubit
>> application, not in CGM application. So if you want to
>> define your mesh attributes without using Cubit, you can
>> define/register it in your application which will be on top
>> of CGM.
>>
>> 2. You can look at  CGMApp,  CubitAttrib, CubitAttribUser
>> and  CubitAttribManager in CGM on how to register/create
>> your type of attributes.
>>
>> 3. After you've registered your attribute, you need to
>> define it's copy behavior. You may refer to any of the
>> CA* files (example CAEntityName) to see how each attributes
>> defines copy(split_owner).
>>
>> 4. Finally, on you OCC open code, you can add copy
>> attributes call to the sweep code to copy attributes from
>> base shape to swept top shape.
>>
>> Again, since mesh attributes are not registered in CGM, and
>> it's impossible to register and define them in CGM,
>> I've already removed the part of copy attributes in OCC
>> sweep code.
>>
>> Hope it helps.
>>
>> Jane
>>
>> --- On Mon, 1/26/09, Leidy Suarez
>> <ly.suarez at ingeciber.com> wrote:
>>
>>   
>>   
>>     From: Leidy Suarez <ly.suarez at ingeciber.com>
>> Subject: Re: ***SPAM*** Re: ***SPAM*** Re: errors with OCC
>> To: jiangtao_ma at yahoo.com
>> Date: Monday, January 26, 2009, 12:27 PM
>> Hi , Jane
>>
>> Please see comments below.
>>
>> <<I have added in OCC engine to propagate the
>> MESH_SIZE and MESH_SCHEME attribute 
>> for sweeping operations. You may want to update your code
>> to check it out.
>>
>> /I've downloaded CGM code. But, I have a question about
>> CGM Attributes, Is it necessary
>> do register the MESH_SIZE attributes? Similar to the
>> register others attributes such us:
>>
>>   result =
>> mAttribManager.register_attrib_type(CA_ENTITY_NAME,
>> "name", "ENTITY_NAME", 
>>                                               
>> CAEntityName_creator, CUBIT_TRUE,
>>                                                CUBIT_TRUE,
>> CUBIT_TRUE, CUBIT_TRUE,
>>                                                CUBIT_TRUE,
>> CUBIT_FALSE);/ 
>>
>> <<First, Are you using OCC engine? If yes, there
>> should be only one arc edge on the
>> sphere. Or if you are using Acis engine, there will be no
>> edges.
>>
>> /Yes, I've verified, there is only one arc on the
>> sphere./
>>
>> <<Again, if you are using OCC, there'll be one
>> edge having attrib.
>> /Yes, but I do not know how apply the attributes to the arc
>> of the sphere. 
>>
>> Could you help me? The method that I am using is:
>> "append_simple_attribute(tmpCurve,
>> &atribMeshSphere)", is method adequate?. 
>>
>> Too, the manner I am creating the atribMeshSphere is:///
>> 	// set attribute of the edges 
>> 	CubitString typeAttribute("Mesh Size");
>> 	DLIList<double > sizeMesh;
>> 	sizeMesh.append(1.0);
>> 	CubitSimpleAttrib atribMeshSphere(typeAttribute);
>> 	atribMeshSphere.set(typeAttribute, 0,
>> &//////sizeMesh//////);
>>
>> Thanks,
>> Leidy
>> //
>>
>>
>> Jiangtao Hu wrote:
>>     
>>     
>>       Hi, Leidy
>>
>> Please see comments below.
>>
>> Jane
>> --- On *Thu, 1/22/09, Leidy Suarez
>>       
>>     
>>     /<ly.suarez at ingeciber.com>/* wrote:
>>     
>>     
>>           From: Leidy Suarez
>> <ly.suarez at ingeciber.com>
>>     Subject: Re: ***SPAM*** Re: errors with OCC
>>     To: jiangtao_ma at yahoo.com
>>     Date: Thursday, January 22, 2009, 1:26 PM
>>
>>     Hi Jane,
>>     Many thanks.
>>
>>     You can save mesh size as an Attribute on the
>>       
>>     
>>     geometry entity, I will modify
>>     
>>     
>>           sweep code in CGM/OCC to copy attributes from
>>       
>>     
>>     bottom shape to the top shape,
>>     
>>     
>>           so when you sweep, its mesh size attribute get
>>       
>>     
>>     propagated. Is this satisfying
>>     
>>     
>>           your needs?
>>
>>     I have added in OCC engine to propagate the
>>       
>>     
>>     MESH_SIZE and MESH_SCHEME attribute 
>>     
>>     
>>           for sweeping operations. You may want to update
>>       
>>     
>>     your code to check it out.
>>     
>>     
>>       
>>
>>     Yes. It would be a good solution for me. Thank
>>       
>>     
>>     you.
>>     
>>     
>>           But the problem is I do not know how Attribute
>>       
>>     
>>     using to associate to the
>>     
>>     
>>           geometry  the mesh size. At this moment I am
>>       
>>     
>>     trying to use Attribute, the
>>     
>>     
>>           example that consist on:
>>
>>     1. I have done a sphere:
>>
>>     	//Create sphere
>>     	RefEntity* sphereEnt =
>>       
>>     
>>     GeometryModifyTool::instance()->sphere(15);
>>     
>>     
>>           	sphereEnt->entity_name("sphere");
>>
>>     First, Are you using OCC engine? If yes, there
>>       
>>     
>>     should be only one arc edge on the
>>     
>>     
>>           sphere. Or if you are using Acis engine, there
>>       
>>     
>>     will be no edges.
>>     
>>     
>>           2. Then I want to associate mesh size on every
>>       
>>     
>>     edge of sphere. I have done the
>>     
>>     
>>           following steps but I am not sure. 
>>     	//Assign mesh parameter on Edges
>>     	int numEdges =
>>      sphereTopo->num_ref_edges();
>>     	DLIList<RefEdge*> tmpEdge;
>>     	CubitSimpleAttrib atribMeshSphere("Mesh
>>       
>>     
>>     size");
>>     
>>     
>>           	DLIList<double> meshSize;
>>     	meshSize.append(1.0);
>>    
>>       
>>     
>>     	atribMeshSphere.initialize_from_lists(0,&meshSize,0);
>>     
>>     
>>           	for (int i = 0; i < numEdges; i  )
>>     	{
>>     		((Body*) sphereEnt)->ref_edges(tmpEdge);
>>     		Curve* tmpCurve =
>>       
>>     
>>     tmpEdge.get_and_step()->get_curve_ptr();
>>     
>>     
>>           		sphereTopo->append_attrib_internal(tmpCurve,
>>       
>>     
>>     &atribMeshSphere);
>>     
>>     
>>           	}
>>     Again, if you are using OCC, there'll be one
>>       
>>     
>>     edge having attrib.
>>     
>>     
>>           3. I have done a box.
>>     	//Create
>>     	CubitVector centerBox(10, 0.0, 10.0);
>>     	CubitVector dimensionsBox(15, 10, 7);
>>     	CubitVector axesBox[3] = { CubitVector(1.0, 0.0,
>>       
>>     
>>     0.0), CubitVector(0.0, 0.0,
>>     
>>     
>>           1.0), CubitVector(0.0, 1.0, 0.0)};
>>     	RefEntity* boxEnt =
>>       
>>     
>>     GeometryModifyTool::instance()->brick(centerBox,
>>     
>>     
>>           axesBox, dimensionsBox);
>>
>>     4. I
>>      want doing a boolean operation. The result that I
>>       
>>     
>>     want is conserve the
>>     
>>     
>>           mesh on the edges of the sphere that survive
>> after
>>       
>>     
>>     boolean operation.
>>     
>>     
>>           		toolBody.append( boxBody );
>>     		fromBody.append( sphereBody );
>>     		CubitStatus result =
>>       
>>     
>>     GeometryModifyTool::instance()->subtract(toolBody,
>>     
>>     
>>           fromBody, newBody, false, false);
>>
>>     But, I do not obtain the result wanted.
>>
>>     After operation, did you check how many edges are
>>       
>>     
>>     still in the sphere?
>>     
>>     
>>           and if the edge id has been changed? If the edge
>>       
>>     
>>     hasn't been changed
>>     
>>     
>>           in any ways, the mesh size attribute will be
>>       
>>     
>>     preserved.
>>     
>>     
>>           Or alternatively, if you assign the mesh size to
>>       
>>     
>>     the volume of the
>>     
>>     
>>           sphere, it should be persisted since the volume
>> is
>>       
>>     
>>     still there. I've
>>     
>>     
>>           checked CGM/ACIS and this case the mesh size
>>       
>>     
>>     attribute did survived
>>     
>>     
>>           the operation.
>>
>>     Maybe, I have confused you, sorry. I will try
>>      explained with the same example
>>     before.
>>     Lets suppose that then of obtain the object then
>>       
>>     
>>     I want change the sphere
>>     
>>     
>>           radius and that the boolean operation been
>>       
>>     
>>     recalculated. How I do it?
>>     
>>     
>>           I will need information about what type
>> operation,
>>       
>>     
>>     how the objects were
>>     
>>     
>>           create,...
>>
>>     If you want to support an undo operation, you may
>>       
>>     
>>     look at the 
>>     
>>     
>>           TNaming_NamedShape class and see how you can save
>>       
>>     
>>     the type of 
>>     
>>     
>>           operation in the enumeration TNaming_Evolution
>> and
>>       
>>     
>>     the 'new' 
>>     
>>     
>>           and 'old' shapes be saved. After you did
>>       
>>     
>>     'undo', you can modify
>>     
>>     
>>           your sphere, and do the operation again.
>>
>>
>>     When I talk you about "parametrization"
>>       
>>     
>>     (maybe it is not an
>>     
>>     
>>           appropiate name), I refer too to the case, when I
>>       
>>     
>>     create a circle with  radius
>>     
>>     
>>           "R = 5" how a parameter variable and I
>>      want assign units of
>>     millimeters. I internally will create the circle
>>       
>>     
>>     with a value, but i will need
>>     
>>     
>>           save information in the object
>>     with the list of parameters "R",
>>       
>>     
>>     "units millimeters".  And
>>     
>>     
>>           I always access this information when something
>>       
>>     
>>     change.
>>     
>>     
>>           How I do it?
>>
>>     It's really up to you, as you described,
>>       
>>     
>>     creating a sphere type of body
>>     
>>     
>>           isn't a bad idea, however, you can also
>>       
>>     
>>     distinguish bodies using their
>>     
>>     
>>           attributes, etc.
>>
>>     Thanks,
>>     Leidy
> 
> 
>       
> 

-- 
================================================================
"You will keep in perfect peace him whose mind is
   steadfast, because he trusts in you."               Isaiah 26:3

              Tim Tautges            Argonne National Laboratory
          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
          phone: (608) 263-8485      1500 Engineering Dr.
            fax: (608) 263-4499      Madison, WI 53706



More information about the cgma-dev mailing list