moab
iMesh_MOAB.hpp File Reference
#include "iMesh.h"
#include "MBiMesh.hpp"
#include "moab/Forward.hpp"
#include <cstring>
#include <cstdlib>
#include <cstdio>

Go to the source code of this file.

Classes

class  iMeshArrayManager

Defines

#define PP_CAT_(a, b)   a ## b
#define PP_CAT(a, b)   PP_CAT_(a,b)
#define RETURN(CODE)
#define ERROR(CODE, MSG)
#define CHKERR(CODE, MSG)
#define CHKENUM(VAL, TYPE, ERR)
#define CHKTAGTYPE(TAG, TYPE)
#define CHKNONEMPTY()
#define ALLOC_CHECK_ARRAY(array, this_size)
#define ALLOC_CHECK_TAG_ARRAY(array, this_size)
#define KEEP_ARRAY(array)   array ## _manager .keep_array()
#define ALLOC_CHECK_ARRAY_NOFAIL(array, this_size)   ALLOC_CHECK_ARRAY(array, this_size); KEEP_ARRAY(array)

Functions

static bool iMesh_isError (int code)
static bool iMesh_isError (ErrorCode code)
int compare_no_case (const char *str1, const char *str2, size_t n)
std::string filter_options (const char *begin, const char *end)

Variables

const iMesh_EntityTopology tstt_topology_table [MBMAXTYPE+1]
const iBase_EntityType tstt_type_table [MBMAXTYPE+1]
const EntityType mb_topology_table [MBMAXTYPE+1]
const DataType mb_data_type_table [iBase_TagValueType_MAX+1]
const iBase_TagValueType tstt_data_type_table [MB_MAX_DATA_TYPE+1]
const iBase_ErrorType iBase_ERROR_MAP [MB_FAILURE+1]

Define Documentation

#define ALLOC_CHECK_ARRAY (   array,
  this_size 
)
Value:
iMeshArrayManager array ## _manager ( instance, reinterpret_cast<void**>(array), *(array ## _allocated), *(array ## _size), this_size, sizeof(**array), err ); \
  if (iBase_SUCCESS != *err) return

Definition at line 94 of file iMesh_MOAB.hpp.

#define ALLOC_CHECK_ARRAY_NOFAIL (   array,
  this_size 
)    ALLOC_CHECK_ARRAY(array, this_size); KEEP_ARRAY(array)

Definition at line 107 of file iMesh_MOAB.hpp.

#define ALLOC_CHECK_TAG_ARRAY (   array,
  this_size 
)
Value:
iMeshArrayManager array ## _manager ( instance, reinterpret_cast<void**>(array), *(array ## _allocated), *(array ## _size), this_size, 1, err ); \
  if (iBase_SUCCESS != *err) return

Definition at line 98 of file iMesh_MOAB.hpp.

#define CHKENUM (   VAL,
  TYPE,
  ERR 
)
Value:
do {                                                                 \
    if ((VAL) < PP_CAT(TYPE, _MIN) || (VAL) > PP_CAT(TYPE, _MAX))      \
      ERROR((ERR), "Invalid enumeration value");                       \
  } while(false)

Definition at line 59 of file iMesh_MOAB.hpp.

#define CHKERR (   CODE,
  MSG 
)
Value:
do {                                                                 \
    if (iMesh_isError((CODE)))                                         \
      ERROR((CODE),(MSG));                                             \
  } while(false)

Definition at line 53 of file iMesh_MOAB.hpp.

#define CHKNONEMPTY ( )
Value:
do {                                                                 \
    int count, result;                                                 \
    iMesh_getNumOfType(instance, 0, iBase_ALL_TYPES, &count, &result); \
    CHKERR(result, "Couldn't get number of entities");                 \
    if (count == 0)                                                    \
      ERROR(iBase_INVALID_ENTITY_HANDLE,                               \
            "Invalid entity handle: mesh is empty");                   \
  } while(false)

Definition at line 81 of file iMesh_MOAB.hpp.

#define CHKTAGTYPE (   TAG,
  TYPE 
)
Value:
do {                                                                 \
    int type, result;                                                  \
    iMesh_getTagType(instance, (TAG), &type, &result);                 \
    CHKERR(result, "Couldn't get tag data type");                      \
    if ((type == iBase_ENTITY_HANDLE &&                                \
         (TYPE) == iBase_ENTITY_SET_HANDLE) ||                         \
        (type == iBase_ENTITY_SET_HANDLE &&                            \
         (TYPE) == iBase_ENTITY_HANDLE))                               \
      break;                                                           \
    if (type != (TYPE))                                                \
      ERROR(iBase_INVALID_TAG_HANDLE, "Invalid tag data type");        \
  } while(false)

Definition at line 67 of file iMesh_MOAB.hpp.

#define ERROR (   CODE,
  MSG 
)
Value:
do {                                                                 \
    *err = MBIMESHI->set_last_error((CODE), (MSG));                    \
    return;                                                            \
  } while(false)

Definition at line 47 of file iMesh_MOAB.hpp.

#define KEEP_ARRAY (   array)    array ## _manager .keep_array()

Definition at line 102 of file iMesh_MOAB.hpp.

#define PP_CAT (   a,
 
)    PP_CAT_(a,b)

Definition at line 39 of file iMesh_MOAB.hpp.

#define PP_CAT_ (   a,
 
)    a ## b

Definition at line 38 of file iMesh_MOAB.hpp.

#define RETURN (   CODE)
Value:
do {                                                                 \
    *err = MBIMESHI->set_last_error((CODE), "");                       \
    return;                                                            \
  } while(false)

Definition at line 41 of file iMesh_MOAB.hpp.


Function Documentation

int compare_no_case ( const char *  str1,
const char *  str2,
size_t  n 
) [inline]

Definition at line 157 of file iMesh_MOAB.hpp.

                                                                         {
   for (size_t i = 1; i != n && *str1 && toupper(*str1) == toupper(*str2);
        ++i, ++str1, ++str2);
   return toupper(*str2) - toupper(*str1);
}
std::string filter_options ( const char *  begin,
const char *  end 
) [inline]

Definition at line 164 of file iMesh_MOAB.hpp.

{
  const char *opt_begin = begin;
  const char *opt_end   = begin;

  std::string filtered;
  bool first = true;

  while (opt_end != end) {
    opt_end = std::find(opt_begin, end, ' ');

    if (opt_end-opt_begin >= 5 && compare_no_case(opt_begin, "moab:", 5) == 0) {
      if (!first)
        filtered.push_back(';');
      first = false;
      filtered.append(opt_begin+5, opt_end);
    }

    opt_begin = opt_end+1;
  }
  return filtered;
}
static bool iMesh_isError ( int  code) [inline, static]

Definition at line 33 of file iMesh_MOAB.hpp.

  { return (iBase_SUCCESS != code); }
static bool iMesh_isError ( ErrorCode  code) [inline, static]

Definition at line 35 of file iMesh_MOAB.hpp.

  { return (MB_SUCCESS != code); }

Variable Documentation

Definition at line 29 of file iMesh_MOAB.hpp.

const EntityType mb_topology_table[MBMAXTYPE+1]

Definition at line 84 of file iMesh_MOAB.cpp.

Definition at line 48 of file iMesh_MOAB.cpp.

Definition at line 66 of file iMesh_MOAB.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines