moab
Vertex Entities

Functions

void iMesh_getVtxArrCoords (iMesh_Instance instance, const iBase_EntityHandle *vertex_handles, const int vertex_handles_size, const int storage_order, double **coords, int *coords_allocated, int *coords_size, int *err)
 Get coordinates of specified vertices.
void iMesh_setVtxArrCoords (iMesh_Instance instance, const iBase_EntityHandle *vertex_handles, const int vertex_handles_size, const int storage_order, const double *new_coords, const int new_coords_size, int *err)
 Set coordinates for an array of vertices.
void iMesh_createVtxArr (iMesh_Instance instance, const int num_verts, const int storage_order, const double *new_coords, const int new_coords_size, iBase_EntityHandle **new_vertex_handles, int *new_vertex_handles_allocated, int *new_vertex_handles_size, int *err)
 Create an array of new vertices at specified coordinates.
void iMesh_setVtxCoord (iMesh_Instance instance, iBase_EntityHandle vertex_handle, const double x, const double y, const double z, int *err)
void iMesh_createVtx (iMesh_Instance instance, const double x, const double y, const double z, iBase_EntityHandle *new_vertex_handle, int *err)
void iMesh_getVtxCoord (iMesh_Instance instance, const iBase_EntityHandle vertex_handle, double *x, double *y, double *z, int *err)

Function Documentation

void iMesh_createVtx ( iMesh_Instance  instance,
const double  x,
const double  y,
const double  z,
iBase_EntityHandle new_vertex_handle,
int *  err 
)

Create a new vertex at specified coordinates.

Parameters:
[in]instanceiMesh instance handle
[in]xx coordinate of new vertex
[in]yy coordinate of new vertex
[in]zz coordinate of new vertex
[out]new_vertex_handlePointer to new vertex handles returned from
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1835 of file iMesh_MOAB.cpp.

  {
    int dum = 1;
    const double xyz[3] = {x, y, z};
    int geom_dim;
    MOABI->get_dimension(geom_dim);
    iMesh_createVtxArr(instance, 1, iBase_BLOCKED,
                       xyz, geom_dim, &new_vertex_handle, &dum, &dum, err);
  }
void iMesh_createVtxArr ( iMesh_Instance  instance,
const int  num_verts,
const int  storage_order,
const double *  new_coords,
const int  new_coords_size,
iBase_EntityHandle **  new_vertex_handles,
int *  new_vertex_handles_allocated,
int *  new_vertex_handles_size,
int *  err 
)

Create an array of new vertices at specified coordinates.

Create an array of new vertices at specified coordinates. Value of storage_order must be either iBase_INTERLEAVED or iBase_BLOCKED.

Parameters:
[in]instanceiMesh instance handle
[in]num_vertsNumber of new vertices to be created
[in]storage_orderStorage order of coordinates in new_coords array (see iBase_StorageOrder)
[in]new_coordsArray of coordinates of new vertices. Should be G*num_verts in length where G is geometric dimension of the mesh.
[in]new_coords_sizeNumber of coordinates in new_coords array, should
[in,out]new_vertex_handlesPointer to array of new vertex handles Array pointer, allocated and occupied sizes argument trio)
[in,out]new_vertex_handles_allocatedPointer to allocated size of
[out]new_vertex_handles_sizePointer to occupied size of
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1352 of file iMesh_MOAB.cpp.

  {
    int geom_dim;
    MOABI->get_dimension(geom_dim);
    if (new_coords_size != geom_dim*num_verts) {
      ERROR(iBase_INVALID_ARGUMENT, "iMesh_createVtxArr: Didn't get the right # coordinates.");
    }

      // if there aren't any elements in the array, allocate it
    ALLOC_CHECK_ARRAY(new_vertex_handles, num_verts);

      // make the entities
    EntityHandle *new_verts = HANDLE_ARRAY_PTR(*new_vertex_handles);

    if (storage_order == iBase_INTERLEAVED) {
      if (3 == geom_dim) {
        for (int i = 0; i < num_verts; i++) {
          ErrorCode result = MOABI->create_vertex(&new_coords[3*i], new_verts[i]);
          CHKERR(result, "iMesh_createVtxArr: couldn't create vertex.");
        }
      }
      else {
        double tmp[3] = {0, 0, 0};
        for (int i = 0; i < num_verts; i++) {
          for (int j = 0; j < geom_dim; j++)
            tmp[j] = new_coords[geom_dim*i + j];
          ErrorCode result = MOABI->create_vertex(tmp, new_verts[i]);
          CHKERR(result, "iMesh_createVtxArr: couldn't create vertex.");
        }
      }
    }
    else {
      double tmp[3] = {0, 0, 0};
      for (int i = 0; i < num_verts; i++) {
        for (int j = 0; j < geom_dim; j++)
          tmp[j] = new_coords[j*num_verts + i];

        ErrorCode result = MOABI->create_vertex(tmp, new_verts[i]);
        CHKERR(result, "iMesh_createVtxArr: couldn't create vertex.");
      }
    }

    KEEP_ARRAY(new_vertex_handles);
    RETURN(iBase_SUCCESS);
  }
void iMesh_getVtxArrCoords ( iMesh_Instance  instance,
const iBase_EntityHandle vertex_handles,
const int  vertex_handles_size,
const int  storage_order,
double **  coords,
int *  coords_allocated,
int *  coords_size,
int *  err 
)

Get coordinates of specified vertices.

Get coordinates of specified vertices. Coordinates are returned in the storage order indicated by the storage_order argument.

Parameters:
[in]instanceiMesh instance handle
[in]vertex_handlesArray of mesh vertex handles whose coordinates are being requested
[in]vertex_handles_sizeNumber of vertices in vertex_handles array
[in]storage_orderRequested storage order of returned coordinates (see iBase_StorageOrder)
[in,out]coordsPointer to array of coordinates returned from function Array pointer, allocated and occupied sizes argument trio)
[in,out]coords_allocatedPointer to allocated size of coords array
[out]coords_sizePointer to occupied size of coords array
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 477 of file iMesh_MOAB.cpp.

  {
    int geom_dim;
    MOABI->get_dimension(geom_dim);

      // make sure we can hold them all
    ALLOC_CHECK_ARRAY(coords, geom_dim*vertex_handles_size);

      // now get all the coordinates
      // coords will come back interleaved by default
    ErrorCode result;
    if (storage_order == iBase_INTERLEAVED) {
      if (3 == geom_dim) {
        result = MOABI->get_coords(CONST_HANDLE_ARRAY_PTR(vertex_handles),
                                 vertex_handles_size, *coords);
      }
      else {
        std::vector<double> dum_coords(3*vertex_handles_size);
        result = MOABI->get_coords(CONST_HANDLE_ARRAY_PTR(vertex_handles),
                                 vertex_handles_size,
                                 &dum_coords[0]);

        for (int i = 0; i < vertex_handles_size; i++) {
          for (int j = 0; j < geom_dim; j++)
            (*coords)[geom_dim*i + j] = dum_coords[3*i + j];
        }
      }
    }
    else {
      std::vector<double> dum_coords(3*vertex_handles_size);
      result = MOABI->get_coords(CONST_HANDLE_ARRAY_PTR(vertex_handles),
                               vertex_handles_size,
                               &dum_coords[0]);
      CHKERR(result,"iMesh_getVtxArrCoords: problem getting vertex coords");

      for (int i = 0; i < vertex_handles_size; i++) {
        for (int j = 0; j < geom_dim; j++)
          (*coords)[i + vertex_handles_size*j] = dum_coords[3*i + j];
      }
    }

    KEEP_ARRAY(coords);
    RETURN(iBase_SUCCESS);
  }
void iMesh_getVtxCoord ( iMesh_Instance  instance,
const iBase_EntityHandle  vertex_handle,
double *  x,
double *  y,
double *  z,
int *  err 
)

Get coordinates of specified vertex.

Parameters:
[in]instanceiMesh instance handle
[in]vertex_handleMesh vertex being queried
[out]xPointer to x coordinate returned from function
[out]yPointer to y coordinate returned from function
[out]zPointer to z coordinate returned from function
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 2333 of file iMesh_MOAB.cpp.

  {
    int order = iBase_BLOCKED;
    double xyz[3] = {0}, *tmp_xyz = xyz;
    int dum = 3;

    iMesh_getVtxArrCoords(instance,
                          &vertex_handle, 1, order,
                          &tmp_xyz, &dum, &dum, err);
    if (iBase_SUCCESS == *err) {
      *x = xyz[0]; *y = xyz[1]; *z = xyz[2];
    }
  }
void iMesh_setVtxArrCoords ( iMesh_Instance  instance,
const iBase_EntityHandle vertex_handles,
const int  vertex_handles_size,
const int  storage_order,
const double *  new_coords,
const int  new_coords_size,
int *  err 
)

Set coordinates for an array of vertices.

Set coordinates for an array of vertices. Specified storage order must be either iBase_INTERLEAVED or iBase_BLOCKED, and indicates order of x, y, and z coordinates in coordinate array.

Parameters:
[in]instanceiMesh instance handle
[in]vertex_handlesArray of vertex handles
[in]vertex_handles_sizeNumber of vertex handles in array
[in]storage_orderStorage order of coordinates in coordinate array
[in]new_coordsCoordinate array
[in]new_coords_sizeSize of coordinate array; should be
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1304 of file iMesh_MOAB.cpp.

  {
    CHKENUM(storage_order, iBase_StorageOrder, iBase_INVALID_ARGUMENT);

    int geom_dim;
    MOABI->get_dimension(geom_dim);
    if (new_coords_size != geom_dim*vertex_handles_size) {
      ERROR(iBase_INVALID_ARGUMENT, "iMesh_setVtxArrCoords: Didn't get the right # coordinates.");
    }

    ErrorCode result = MB_SUCCESS, tmp_result;
    if (storage_order == iBase_INTERLEAVED) {
      if (3 == geom_dim) {
        result = MOABI->set_coords(CONST_HANDLE_ARRAY_PTR(vertex_handles),
                                 vertex_handles_size, new_coords);
      }
      else {
        const EntityHandle *verts = CONST_HANDLE_ARRAY_PTR(vertex_handles);
        double dummy[3] = {0, 0, 0};
        for (int i = 0; i < vertex_handles_size; i++) {
          for (int j = 0; j < geom_dim; j++)
            dummy[j] = new_coords[geom_dim*i + j];
          tmp_result = MOABI->set_coords(&verts[i], 1, dummy);
          if (MB_SUCCESS != tmp_result) result = tmp_result;
        }
      }
    }
    else {
      const EntityHandle *verts = CONST_HANDLE_ARRAY_PTR(vertex_handles);
      double dummy[3] = {0, 0, 0};
      for (int i = 0; i < vertex_handles_size; i++) {
        for (int j = 0; j < geom_dim; j++)
          dummy[j] = new_coords[i + vertex_handles_size*j];
        tmp_result = MOABI->set_coords(&verts[i], 1, dummy);
        if (MB_SUCCESS != tmp_result) result = tmp_result;
      }
    }

    CHKERR(result, "iMesh_setVtxArrCoords: problem setting coordinates.");

    RETURN(iBase_SUCCESS);
  }
void iMesh_setVtxCoord ( iMesh_Instance  instance,
iBase_EntityHandle  vertex_handle,
const double  x,
const double  y,
const double  z,
int *  err 
)

Set coordinates for a vertex.

Parameters:
[in]instanceiMesh instance handle
[in]vertex_handlevertex handle being set
[in]xx coordinate being set
[in]yy coordinate being set
[in]zz coordinate being set
[out]errReturned Error status (see iBase_ErrorType)

Definition at line 1821 of file iMesh_MOAB.cpp.

  {
    const double xyz[3] = {x, y, z};
    int geom_dim;
    MOABI->get_dimension(geom_dim);

    iMesh_setVtxArrCoords(instance, &vertex_handle, 1, iBase_BLOCKED,
                          xyz, geom_dim, err);
  }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines