moab
Initialization

Functions

void iMesh_newMesh (const char *options, iMesh_Instance *instance, int *err, int options_len)
 Construct a new iMesh instance.
void iMesh_dtor (iMesh_Instance instance, int *err)
 Destroy an iMesh instance.
void iMesh_load (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, int name_len, int options_len)
 Load a mesh from a file.
void iMesh_save (iMesh_Instance instance, const iBase_EntitySetHandle entity_set_handle, const char *name, const char *options, int *err, const int name_len, int options_len)
 Save a mesh to a file.
void iMesh_getRootSet (iMesh_Instance instance, iBase_EntitySetHandle *root_set, int *err)
 Get handle of the root set for this instance.
void iMesh_getGeometricDimension (iMesh_Instance instance, int *geom_dim, int *err)
 Get the geometric dimension of mesh represented in this instance.
void iMesh_setGeometricDimension (iMesh_Instance instance, int geom_dim, int *err)
 Set geometric dimension of vertex coordinates.
void iMesh_getDfltStorage (iMesh_Instance instance, int *order, int *err)
 Get the default storage order used by this implementation.

Function Documentation

void iMesh_dtor ( iMesh_Instance  instance,
int *  err 
)

Destroy an iMesh instance.

Parameters:
[in]instanceiMesh instance handle
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 308 of file iMesh_MOAB.cpp.

  {
    delete MBIMESHI;
    *err = iBase_SUCCESS;
  }
void iMesh_getDfltStorage ( iMesh_Instance  instance,
int *  order,
int *  err 
)

Get the default storage order used by this implementation.

Get the default storage order used by this implementation. Value returned is a member of the iBase_StorageOrder enumeration.

Parameters:
[in]instanceiMesh instance handle
[out]orderPointer to storage order returned from function (
See also:
iBase_StorageOrder)
Parameters:
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 397 of file iMesh_MOAB.cpp.

void iMesh_getGeometricDimension ( iMesh_Instance  instance,
int *  geom_dim,
int *  err 
)

Get the geometric dimension of mesh represented in this instance.

Parameters:
[in]instanceiMesh instance handle
[out]geom_dimPointer to dimension returned from this function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 381 of file iMesh_MOAB.cpp.

  {
    MOABI->get_dimension(*geom_dim);
    RETURN(iBase_SUCCESS);
  }
void iMesh_getRootSet ( iMesh_Instance  instance,
iBase_EntitySetHandle root_set,
int *  err 
)

Get handle of the root set for this instance.

Get handle of the root set for this instance. All mesh entities in this instance can be accessed from this set.

Parameters:
[in]instanceiMesh instance handle
[out]root_setPointer to set handle returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 373 of file iMesh_MOAB.cpp.

  {
    *root_set = 0;
      //return CAST_TO_VOID(MOABI->get_root_set());
    RETURN(iBase_SUCCESS);
  }
void iMesh_load ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const char *  name,
const char *  options,
int *  err,
int  name_len,
int  options_len 
)

Load a mesh from a file.

Load a mesh from a file. If entity set is specified, loaded mesh is added to that set; specify root set if that is not desired.

Parameters:
[in]instanceiMesh instance handle
[in]entity_set_handleSet to which loaded mesh will be added, otherwise root
[in]nameFile name from which mesh is to be loaded
[in]optionsPointer to implementation-specific options string (Option Strings)
[out]errReturned Error status (see iBase_ErrorType)
[in]name_lenLength of the file name character string (String Length Arguments)
[in]options_lenLength of the options character string (String Length Arguments)

Definition at line 314 of file iMesh_MOAB.cpp.

  {
      // get filename, option & null-terminate
    std::string filename(name, name_len);
    eatwhitespace(filename);

    std::string opts = filter_options(options, options+options_len);

    Range orig_ents;
    ErrorCode result = MOABI->get_entities_by_handle( 0, orig_ents );
    CHKERR(result,"Internal error");

    const EntityHandle* file_set = 0;
    if (handle != 0 /*root_set*/) {
      const iBase_EntitySetHandle* ptr = &handle;
      file_set = reinterpret_cast<const EntityHandle*>(ptr);
    }

    result = MOABI->load_file(filename.c_str(), file_set, opts.c_str());

    CHKERR(result, "iMesh_load:ERROR loading a mesh.");

      // create interior edges/faces if requested
    if (MBIMESHI->AdjTable[5] || MBIMESHI->AdjTable[10]) {
      Range set_ents;
      result = MOABI->get_entities_by_handle(0, set_ents);
      CHKERR(result,"");
      Range sets;
      result = MOABI->get_entities_by_type(0, MBENTITYSET, sets);
      CHKERR(result,"");
      set_ents = subtract( set_ents, sets );
      set_ents = subtract( set_ents, orig_ents );
      result = create_int_ents(MBIMESHI, set_ents, file_set);
      CHKERR(result,"");
    }
    RETURN(iBase_SUCCESS);
  }
void iMesh_newMesh ( const char *  options,
iMesh_Instance instance,
int *  err,
int  options_len 
)

Construct a new iMesh instance.

Parameters:
[in]optionsPointer to implementation-specific options string (Option Strings)
[in]instanceiMesh instance handle
[out]errReturned Error status (see iBase_ErrorType)
[in]options_lenLength of the character string pointed to by options (String Length Arguments)

Definition at line 267 of file iMesh_MOAB.cpp.

  {
    std::string tmp_options = filter_options(options, options+options_len);
    FileOptions opts(tmp_options.c_str());

    MBiMesh **mbi = reinterpret_cast<MBiMesh**>(instance);
    *mbi = NULL;

    ErrorCode result = opts.get_null_option("PARALLEL");
    if (MB_SUCCESS == result) {
#ifdef USE_MPI
      int flag = 1;
      int retval = MPI_Initialized(&flag);
      if (MPI_SUCCESS != retval || !flag) {
        int argc = 0;
        char **argv = NULL;

          // mpi not initialized yet - initialize here
        retval = MPI_Init(&argc, &argv);
      }
      *mbi = new MBiMesh(NULL);
#else
        //mError->set_last_error( "PARALLEL option not valid, this instance"
        //                        " compiled for serial execution.\n" );
      *err = (*mbi)->set_last_error(MB_NOT_IMPLEMENTED,
                                    "Not configured with parallel support");
      return;
#endif
    }
    else {
      *mbi = new MBiMesh(NULL);
    }
    if (NULL == *mbi) {
      *err = iBase_FAILURE;
      return;
    }

    *err = iBase_SUCCESS;
  }
void iMesh_save ( iMesh_Instance  instance,
const iBase_EntitySetHandle  entity_set_handle,
const char *  name,
const char *  options,
int *  err,
const int  name_len,
int  options_len 
)

Save a mesh to a file.

Save a mesh to a file. If entity set is specified, save only the mesh contained in that set.

Parameters:
[in]instanceiMesh instance handle
[in]entity_set_handleEntity set being saved
[in]nameFile name to which mesh is to be saved
[in]optionsPointer to implementation-specific options string (Option Strings)
[out]errReturned Error status (see iBase_ErrorType)
[in]name_lenLength of the file name character string (String Length Arguments)
[in]options_lenLength of the options character string (String Length Arguments)

Definition at line 355 of file iMesh_MOAB.cpp.

  {
      // get filename & attempt to NULL-terminate
    std::string filename( name, name_len );
    eatwhitespace(filename);
    std::string opts = filter_options(options, options+options_len);

    EntityHandle set = ENTITY_HANDLE(handle);
    ErrorCode result = MOABI->write_file(filename.c_str(), NULL, opts.c_str(),
                                       &set, 1);

    CHKERR(result, "iMesh_save:ERROR saving a mesh.");
    RETURN(iBase_SUCCESS);
  }
void iMesh_setGeometricDimension ( iMesh_Instance  instance,
int  geom_dim,
int *  err 
)

Set geometric dimension of vertex coordinates.

Set the geometric dimension of the mesh. Note: An application should not expect this function to succeed unless the mesh instance is empty. An empty mesh instance is any mesh instance in which there are no vertex entities.

Parameters:
[in]instanceiMesh instance handle
[in]geom_dimRequested geometric dimension.
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 388 of file iMesh_MOAB.cpp.

  {
    ErrorCode rval = MOABI->set_dimension(geom_dim);
    CHKERR(rval,"iMesh_setGeometricDimension: failed");

    RETURN(iBase_SUCCESS);
  }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines