[MOAB-dev] r4525 - in MOAB/trunk: . examples itaps/imesh src src/io src/moab src/parallel test test/h5file test/io test/perf tools tools/vtkMOABReader
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed Feb 23 17:42:24 CST 2011
Author: kraftche
Date: 2011-02-23 17:42:24 -0600 (Wed, 23 Feb 2011)
New Revision: 4525
Modified:
MOAB/trunk/
MOAB/trunk/examples/FileRead.cpp
MOAB/trunk/itaps/imesh/iMesh.h
MOAB/trunk/src/Core.cpp
MOAB/trunk/src/io/ReadABAQUS.cpp
MOAB/trunk/src/io/ReadCCMIO.cpp
MOAB/trunk/src/io/ReadCGM.cpp
MOAB/trunk/src/io/ReadGmsh.cpp
MOAB/trunk/src/io/ReadHDF5.cpp
MOAB/trunk/src/io/ReadIDEAS.cpp
MOAB/trunk/src/io/ReadMCNP5.cpp
MOAB/trunk/src/io/ReadNASTRAN.cpp
MOAB/trunk/src/io/ReadNC.cpp
MOAB/trunk/src/io/ReadNCDF.cpp
MOAB/trunk/src/io/ReadSTL.cpp
MOAB/trunk/src/io/ReadSmf.cpp
MOAB/trunk/src/io/ReadSms.cpp
MOAB/trunk/src/io/ReadTetGen.cpp
MOAB/trunk/src/io/ReadVtk.cpp
MOAB/trunk/src/io/Tqdcfr.cpp
MOAB/trunk/src/io/WriteAns.cpp
MOAB/trunk/src/io/WriteAns.hpp
MOAB/trunk/src/io/WriteCCMIO.cpp
MOAB/trunk/src/io/WriteGMV.cpp
MOAB/trunk/src/io/WriteGmsh.cpp
MOAB/trunk/src/io/WriteHDF5.cpp
MOAB/trunk/src/io/WriteNCDF.cpp
MOAB/trunk/src/io/WriteSLAC.cpp
MOAB/trunk/src/io/WriteSTL.cpp
MOAB/trunk/src/io/WriteSmf.cpp
MOAB/trunk/src/io/WriteTemplate.cpp
MOAB/trunk/src/io/WriteVtk.cpp
MOAB/trunk/src/moab/Core.hpp
MOAB/trunk/src/moab/Interface.hpp
MOAB/trunk/src/parallel/ParallelComm.cpp
MOAB/trunk/src/parallel/ReadParallel.cpp
MOAB/trunk/test/h5file/h5regression.cpp
MOAB/trunk/test/io/readutil_test.cpp
MOAB/trunk/test/perf/perf.cpp
MOAB/trunk/test/perf/perftool.cpp
MOAB/trunk/test/perf/seqperf.cpp
MOAB/trunk/test/scdseq_test.cpp
MOAB/trunk/test/scdseq_timing.cpp
MOAB/trunk/tools/convert.cpp
MOAB/trunk/tools/vtkMOABReader/vtkMOABMesh.cpp
Log:
Use templates and typeids to clean up query/release_interface stuff.
The following old code:
> ScdInterface* tool;
> void* tmp_ptr;
> rval = mbinst->query_interface( "ScdInterface", &tmp_ptr );
> tool = reinterpret_cast<ScdInterface*>(tmp_ptr);
> ...
> rval = mbinst->release_interface( "ScdInterface", tool );
should now be written as:
> ScdInterface* tool;
> rval = mbinst->query_interface( tool );
> ...
> rval = mbinst->release_interface( tool );
NOTES:
o Old string versions of functions are still present, but marked as
deprecated. G++ will emit warnings if you use them.
o Template functions are inline in Interface. So if you have a Core*
instead of an Interface*, you'll need to do:
core->Interface::query_interface( tool );
This will no longer be necessary once the old string versions of
the functions are removed.
o The type is inferred from the type of the pointer, so make sure
the type of the pointer passed to release_interface is the same
as that passed to query_interface (as opposed to a base class,
void*, etc.)
Property changes on: MOAB/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /MOAB/branches/Version4.0:4351
/MOAB/branches/jk-direct-tag:4069-4327
+ /MOAB/branches/Version4.0:4323-4497
/MOAB/branches/jk-direct-tag:4069-4327
Modified: MOAB/trunk/examples/FileRead.cpp
===================================================================
--- MOAB/trunk/examples/FileRead.cpp 2011-02-23 23:04:05 UTC (rev 4524)
+++ MOAB/trunk/examples/FileRead.cpp 2011-02-23 23:42:24 UTC (rev 4525)
@@ -22,15 +22,14 @@
return 0; // a line with some data in it, then
}
-ErrorCode ReadTriangleOutput( Core *mb, string fileBase ) {
+ErrorCode ReadTriangleOutput( Interface *mb, string fileBase ) {
//
// get the read interface from moab
- void* ptr = 0;
- mb->query_interface("ReadUtilIface", &ptr);
- ReadUtilIface *iface = reinterpret_cast<ReadUtilIface*>(ptr);
+ ReadUtilIface *iface;
+ ErrorCode rval = mb->query_interface(iface);
//
- if (NULL == iface)
+ if (MB_SUCCESS != rval)
{
cout<<"Can't get interface.\n";
return MB_FAILURE;
@@ -76,7 +75,7 @@
// also, it will return a starting handle for the node sequence
vector<double*> arrays;
EntityHandle startv;
- ErrorCode rval = iface->get_node_coords(2, num_nodes, 0, startv, arrays);
+ rval = iface->get_node_coords(2, num_nodes, 0, startv, arrays);
for (int i = 0; i < num_nodes; i++)
{
getline(nodeFile, line);
@@ -129,6 +128,7 @@
}
}
+ mb->release_interface(iface);
//
return MB_SUCCESS;
}
More information about the moab-dev
mailing list