[MOAB-dev] Closing/opening moab instances
Patrick Shriwise
shriwise at wisc.edu
Fri Jan 17 16:02:54 CST 2014
On 01/14/2014 09:46 AM, Patrick Shriwise wrote:
> On 01/09/2014 12:43 PM, Tim Tautges (ANL) wrote:
>> Either declare the Core instance in a local variable, e.g. as in the
>> test/MBTest.cpp test (mb_vertex_coordinate_test function and the ones
>> following), or use Interface::delete_mesh. I'd recommend the former,
>> as that gives you a clean instance.
>>
>> - tim
>>
>> On 01/09/2014 12:22 PM, Patrick Shriwise wrote:
>>> Hi all,
>>>
>>> Working on a set of tests in which I would like to read an ACIS file
>>> independently in several different functions using
>>> moab::Core::load_file. I believe that I am creating a new moab
>>> instance in every function. However when I load the file
>>> in a new function, the data from the original load seems to remain.
>>> Any advice on how to load the file without having it
>>> overlap between functions?
>>>
>>> Cheers,
>>>
>> I've setup my local moab instance calls just as in MBTest.cpp and
>> mb_vertex_coordinate_test but am still having the same problem. When
>> I load a simple cube geometry and check that it has the appropriate
>> number of vertices it works the first time, but if I repeat the test
>> in main it will find twice the number of vertices as expected upon a
>> repeated test run. Any thoughts?
>
Hey all,
Got this problem figured out. When loading a file using
ReadCGM::load_file , a CGM instance is created which is persistent (see
InitCGMA.cpp lines 65-80). This means that unless the CGMA geometry is
removed before leaving ReadCGM, it still exists when loading another
file or the same file whether this occurs in the same MOAB instance or
not. By adding to ReadCGM a line calling delete_geometry() from CGM at
the end of ReadCGM::load_file it allows the CGMA data to be removed and
leave the existing MOAB Entities in tact.
This leads to a question: Is there ever a case in which we would want to
re-access the CGMA geometry data from a file after transferring it to
MOAB (loading a file twice, loading multiple files into CGMA then moving
it to MOAB, etc. ) or should this be the default behavior for ReadCGM?
For the current DAGMC workflow its is not necessary or problematic that
the CGM instance is persistent. Since we have all the ACIS geometry in a
single file loaded once it is not an issue, however in testing that
involves multiple file loads even in separate MOAB instances containing
the original geometry AND the new geometry.
Which leads up to my real question, will adding a delete_geometry() call
from CGM cause problems in everyone else's workflow? (This change does
not break other tests.)
Thanks ,
Patrick
--
Patrick C. Shriwise
Research Assistant
University of Wisconsin - Madison
Engineering Research Building - Rm. 428
1500 Engineering Drive
Madison, WI 53706
(608) 446-8173
More information about the moab-dev
mailing list