[MOAB-dev] Fwd: MOAB Help

Tim Tautges tautges at mcs.anl.gov
Wed Jun 23 19:33:36 CDT 2010


[Forwarding to moab-dev, could someone help Paul with this?  Thanks.]

Paul, in the future, please send general help requests like this to moab-dev instead of to me, you'll probably get more 
timely response.

- tim

-------- Original Message --------
Subject: MOAB Help
Date: Tue, 22 Jun 2010 09:31:02 -0600
From: Stanfield, Paul <pstanfi at sandia.gov>
To: 'Tim Tautges' <tautges at mcs.anl.gov>

I was trying to create a tag and I am having some trouble. It doesn't seem to like the inputs I'm giving it.

---------------------------------------------------------------------------------------------------------
    moab::Core moab;
    moab::Interface& mb = moab;
    moab::ErrorCode rval;
    moab::Tag energy;
    double def_val = 1.00;
    double new_val=10.00;



rval=mb.tag_create("ENERGY", int(sizeof(double)), MB_TAG_DENSE, MB_TYPE_DOUBLE, energy, &def_val);
/*(            const char* name,
                const int size,
                const TagType storage,
                const DataType data,
                      Tag& handle,
                const void* def_val,
                      bool use_existing = false ) = 0;
*/

KDMain.C(66): error: no instance of overloaded function "moab::Interface::tag_create" matches the argument list
             argument types are: (const char [7], int, TagType, DataType, moab::Tag, double *)
             object type is: moab::Interface
   rval=mb.tag_create("ENERGY", int(sizeof(double)), MB_TAG_DENSE, MB_TYPE_DOUBLE, energy, &def_val);
---------------------------------------------------------------------------------------------------------




I was trying to follow the format of the example given in the manual:


---------------------------------------------------------------------------------------------------------
// load a file using MOAB and get the vertices
MBErrorCode rval = moab->load_file("fname.vtk");
MBRange verts;
rval = moab->get_entities_by_dimension(file_set, 0, verts);
// create a tag called "TEMPERATURE"
MBTag temperature;
double def_val = -1.0d-300, new_val = 273.0;
rval = moab->tag_create("TEMPERATURE", sizeof(double), MB_TAG_DENSE,
                         MB_TYPE_DOUBLE, temperature, &def_val);
// assign a value to vertices
for (MBRange::iterator vit = verts.begin();
      vit != verts.end(); vit++)
   rval = moab->tag_set_data(temperature, &(*rit), 1, &new_val);
---------------------------------------------------------------------------------------------------------




More information about the moab-dev mailing list