Commit e6416c5d authored by vijaysm's avatar vijaysm
Browse files

Rename imoab to iMOAB for consistency and namespace routine names.

- Fix targets and linkage to library
- Expand protos for all functions defined
parent 76dd2fec
This diff is collapsed.
# MOAB_DIR points to top-level install dir, below which MOAB's lib/ and include/ are located
MOAB_BUILD_DIR := /homes/iulian/source/MOAB14
MOAB_DIR := /homes/iulian/lib/moab14
MOAB_DIR := /usr/software/moab/dev/feature_check
ifneq ($(wildcard ${MOAB_DIR}/lib/moab.make),)
include ${MOAB_DIR}/lib/moab.make
......@@ -10,18 +10,16 @@ include ${MOAB_BUILD_DIR}/moab.make
include ${MOAB_BUILD_DIR}/itaps/imesh/iMesh-Defs.inc
endif
.SUFFIXES: .o .cpp .F90
.SUFFIXES: .o .cpp
all: libiMOAB
HelloMOAB: HelloMOAB.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ${MOAB_LIBS_LINK}
libiMOAB: iMOAB.o
${AR} rcs libiMOAB.a $<
clean:
rm -rf *.o *.mod *.h5m ${ALLEXAMPLES}
rm -rf *.o *.h5m
.cpp.o:
${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
.F90.o:
${IMESH_FC} ${FCFLAGS} ${IMESH_FCFLAGS} ${MOAB_CPPFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
This diff is collapsed.
This diff is collapsed.
#include "mpi.h"
#include "../src/moab/imoab.h"
#include "moab/iMOAB.h"
// for malloc, free:
#include <stdlib.h>
#include <string.h>
......@@ -21,11 +21,11 @@ int main(int argc, char * argv[])
if (argc>1)
filen = argv[1];
ErrCode rc = iMOABInitialize(argc, argv);
ErrCode rc = iMOAB_Initialize(argc, argv);
CHECKRC(rc, "failed to initialize MOAB");
int num_global_vertices=0, num_global_elements=0, num_dimension=0, num_parts=0;
rc = ReadHeaderInfo ( filen, &num_global_vertices, &num_global_elements, &num_dimension,
rc = iMOAB_ReadHeaderInfo ( filen, &num_global_vertices, &num_global_elements, &num_dimension,
&num_parts, (int)strlen(filen) );
CHECKRC(rc, "failed to read header info");
......@@ -37,46 +37,32 @@ int main(int argc, char * argv[])
}
int appID;
iMOAB_AppID pid=&appID;
rc = RegisterApplication( "PROTEUS", &comm, pid);
rc = iMOAB_RegisterApplication( "PROTEUS", &comm, pid);
CHECKRC(rc, "failed to register application");
char *read_opts="PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;PARALLEL_RESOLVE_SHARED_ENTS";
int num_ghost_layers=1;
rc = LoadMesh( pid, filen, read_opts, &num_ghost_layers, strlen(filen), strlen(read_opts) );
rc = iMOAB_LoadMesh( pid, filen, read_opts, &num_ghost_layers, strlen(filen), strlen(read_opts) );
CHECKRC(rc, "failed to load mesh");
// nverts[0]: number of local vertices (used to represent initial partition, before ghosting
// in moab terminology, nverts[0] has owned and shared vertices on the interfaces
// some of the shared vertices could be actually owned by another task
// nverts[1]: number of ghost vertices, appear after ghosting
// nverts[2]: total number of vertices, local + ghost
// we do not have that problem / terminology for elements
// elements are either owned (local, in the initial partition) or ghosted
// nblocks as the number of material sets( visible blocks) is different
// blocks[0] represent number of blocks completely owned by current partition
// blocks[1] is number of blocks with at least one ghost element in it
// blocks[2] is the total number of blocks visible on current rank
// any of the blocks [0] or blocks[1] can be 0
int nverts[3], nelem[3], nblocks[3], nsbc[3], ndbc[3];
rc = GetMeshInfo( pid, nverts, nelem, nblocks, nsbc, ndbc);
rc = iMOAB_GetMeshInfo( pid, nverts, nelem, nblocks, nsbc, ndbc);
CHECKRC(rc, "failed to get mesh info");
iMOAB_GlobalID * vGlobalID = (iMOAB_GlobalID*)malloc(nverts[2]*sizeof(iMOAB_GlobalID)) ;
rc = GetVertexID(pid, &nverts[2], vGlobalID);
rc = iMOAB_GetVertexID(pid, &nverts[2], vGlobalID);
CHECKRC(rc, "failed to get vertex id info");
int * vranks = (int*)malloc(nverts[2]*sizeof(int));
rc =GetVertexOwnership(pid, &nverts[2], vranks );
rc = iMOAB_GetVertexOwnership(pid, &nverts[2], vranks );
CHECKRC(rc, "failed to get vertex ranks");
double * coords = (double*) malloc(3*nverts[2]*sizeof(double));
int size_coords= 3*nverts[2];
rc = GetVisibleVerticesCoordinates( pid, &size_coords, coords);
rc = iMOAB_GetVisibleVerticesCoordinates( pid, &size_coords, coords);
CHECKRC(rc, "failed to get coordinates");
iMOAB_GlobalID * gbIDs = (iMOAB_GlobalID*) malloc(nblocks[2]*sizeof(iMOAB_GlobalID));
rc = GetBlockID(pid, &nblocks[2], gbIDs);
rc = iMOAB_GetBlockID(pid, &nblocks[2], gbIDs);
CHECKRC(rc, "failed to get block info");
/* the 2 tags used in this example exist in the file, already */
......@@ -84,15 +70,15 @@ int main(int argc, char * argv[])
int entTypes[2] = {0, 1}; /* first is on vertex, second is on elements; */
int tagTypes[2] = { DENSE_INTEGER, DENSE_DOUBLE } ;
int num_components = 1;
rc = DefineTagStorage(pid, "INTFIELD", &tagTypes[0], &num_components, &tagIndex[0], strlen("INTFIELD") );
rc = iMOAB_DefineTagStorage(pid, "INTFIELD", &tagTypes[0], &num_components, &tagIndex[0], strlen("INTFIELD") );
CHECKRC(rc, "failed to get tag INTFIELD ");
rc = DefineTagStorage(pid, "DFIELD", &tagTypes[1], &num_components, &tagIndex[1], strlen("DFIELD") );
rc = iMOAB_DefineTagStorage(pid, "DFIELD", &tagTypes[1], &num_components, &tagIndex[1], strlen("DFIELD") );
CHECKRC(rc, "failed to get tag DFIELD ");
// synchronize one of the tags only, just to see what happens
int num_tags_to_sync=1;
rc = SynchronizeTags(pid, &num_tags_to_sync, &tagIndex[0], &tagTypes[0] );
rc = iMOAB_SynchronizeTags(pid, &num_tags_to_sync, &tagIndex[0], &tagTypes[0] );
CHECKRC(rc, "failed to sync tag INTFIELD ");
for (int irank=0; irank<nprocs; irank++)
......@@ -119,7 +105,7 @@ int main(int argc, char * argv[])
iMOAB_GlobalID * element_global_IDs = (iMOAB_GlobalID*)malloc(nelem[2]*sizeof(iMOAB_GlobalID));
iMOAB_GlobalID * block_IDs = (iMOAB_GlobalID*)malloc(nelem[2]*sizeof(iMOAB_GlobalID));
int * ranks = (int*)malloc(nelem[2]*sizeof(int));
rc = GetVisibleElementsInfo(pid, &nelem[2], element_global_IDs, ranks, block_IDs);
rc = iMOAB_GetVisibleElementsInfo(pid, &nelem[2], element_global_IDs, ranks, block_IDs);
CHECKRC(rc, "failed to get all elem info");
for (int i=0; i<nelem[2]; i++)
printf(" element local id: %3d, global ID: %3d rank:%d block ID: %2d \n", i, element_global_IDs[i],
......@@ -132,7 +118,7 @@ int main(int argc, char * argv[])
int conn[27];
int nv = 27;
int eindex = 0;
rc = GetElementConnectivity(pid, &eindex, &nv, conn);
rc = iMOAB_GetElementConnectivity(pid, &eindex, &nv, conn);
CHECKRC(rc, "failed to get first element connectivity");
printf(" conn for first element: \n");
for (int i=0; i<nv; i++)
......@@ -143,7 +129,7 @@ int main(int argc, char * argv[])
int local_index = 0; // test element with local index 0
int num_adjacent_elements = 10; // we can have maximum 6 actually
iMOAB_LocalID adjacent_element_IDs[10];
rc =GetNeighborElements(pid, &local_index, &num_adjacent_elements, adjacent_element_IDs);
rc = iMOAB_GetNeighborElements(pid, &local_index, &num_adjacent_elements, adjacent_element_IDs);
CHECKRC(rc, "failed to get first element neighbors");
printf(" neighbors for first element:\n");
for (int i=0; i<num_adjacent_elements; i++)
......@@ -157,21 +143,21 @@ int main(int argc, char * argv[])
{
printf(" block index: %3d, block ID: %3d \n", i, gbIDs[i] );
int vertices_per_element, num_elements_in_block;
rc = GetBlockInfo(pid, &gbIDs[i] , &vertices_per_element, &num_elements_in_block);
rc = iMOAB_GetBlockInfo(pid, &gbIDs[i] , &vertices_per_element, &num_elements_in_block);
CHECKRC(rc, "failed to elem block info");
printf(" has %4d elements with %d vertices per element\n", num_elements_in_block, vertices_per_element);
int size_conn= num_elements_in_block*vertices_per_element;
iMOAB_LocalID * element_connectivity = (iMOAB_LocalID*) malloc (sizeof(iMOAB_LocalID)*size_conn);
rc = GetBlockElementConnectivities(pid, &gbIDs[i], &size_conn, element_connectivity);
rc = iMOAB_GetBlockElementConnectivities(pid, &gbIDs[i], &size_conn, element_connectivity);
CHECKRC(rc, "failed to get block elem connectivity");
int * element_ownership = (int*) malloc (sizeof(int)*num_elements_in_block);
rc = GetElementOwnership(pid, &gbIDs[i], &num_elements_in_block, element_ownership);
rc = iMOAB_GetElementOwnership(pid, &gbIDs[i], &num_elements_in_block, element_ownership);
CHECKRC(rc, "failed to get block elem ownership");
iMOAB_GlobalID* global_element_ID = (iMOAB_GlobalID*)malloc(sizeof(iMOAB_GlobalID)*num_elements_in_block);
iMOAB_LocalID* local_element_ID =(iMOAB_LocalID*)malloc(sizeof(iMOAB_LocalID)*num_elements_in_block);
rc = GetElementID(pid, &gbIDs[i], &num_elements_in_block, global_element_ID, local_element_ID);
rc = iMOAB_GetElementID(pid, &gbIDs[i], &num_elements_in_block, global_element_ID, local_element_ID);
CHECKRC(rc, "failed to get block elem IDs");
for (int j=0; j< num_elements_in_block; j++)
{
......@@ -189,7 +175,7 @@ int main(int argc, char * argv[])
* query int tag values on vertices
*/
int * int_tag_vals = (int *) malloc (sizeof(int) * nverts[2]); // for all visible vertices on the rank
rc = GetIntTagStorage(pid, "INTFIELD", &nverts[2], &entTypes[0],
rc = iMOAB_GetIntTagStorage(pid, "INTFIELD", &nverts[2], &entTypes[0],
int_tag_vals, strlen("INTFIELD"));
CHECKRC(rc, "failed to get INTFIELD tag");
printf("INTFIELD tag values:\n");
......@@ -206,7 +192,7 @@ int main(int argc, char * argv[])
* query double tag values on elements
*/
double * double_tag_vals = (double *) malloc (sizeof(double) * nelem[2]); // for all visible elements on the rank
rc = GetDoubleTagStorage(pid, "DFIELD", &nelem[2], &entTypes[1],
rc = iMOAB_GetDoubleTagStorage(pid, "DFIELD", &nelem[2], &entTypes[1],
double_tag_vals, strlen("DFIELD"));
CHECKRC(rc, "failed to get DFIELD tag");
printf("DFIELD tag values: (not exchanged) \n");
......@@ -223,7 +209,7 @@ int main(int argc, char * argv[])
iMOAB_LocalID * surfBC_ID = (iMOAB_LocalID*) malloc (sizeof(iMOAB_LocalID)*nsbc[2]);
int * ref_surf = (int *) malloc (sizeof(int)*nsbc[2]);
int * bc_value = (int *) malloc (sizeof(int)*nsbc[2]);
rc = GetPointerToSurfaceBC(pid, &nsbc[2], surfBC_ID, ref_surf, bc_value);
rc = iMOAB_GetPointerToSurfaceBC(pid, &nsbc[2], surfBC_ID, ref_surf, bc_value);
CHECKRC(rc, "failed to get surf boundary conditions");
printf(" Surface boundary conditions:\n");
for (int i=0; i<nsbc[2]; i++)
......@@ -236,7 +222,7 @@ int main(int argc, char * argv[])
/* query vertex BCs */
iMOAB_LocalID * vertBC_ID = (iMOAB_LocalID*) malloc (sizeof(iMOAB_LocalID)*ndbc[2]);
int * vertBC_value = (int *) malloc (sizeof(int)*ndbc[2]);
rc = GetPointerToVertexBC(pid, &ndbc[2], vertBC_ID, vertBC_value);
rc = iMOAB_GetPointerToVertexBC(pid, &ndbc[2], vertBC_ID, vertBC_value);
CHECKRC(rc, "failed to get vertex boundary conditions");
printf(" Vertex boundary conditions:\n");
for (int i=0; i<ndbc[2]; i++)
......@@ -255,13 +241,13 @@ int main(int argc, char * argv[])
free (vranks);
char outputFile[] = "fnew.h5m";
char writeOptions[] ="PARALLEL=WRITE_PART";
rc = WriteMesh(pid, outputFile, writeOptions,
rc = iMOAB_WriteMesh(pid, outputFile, writeOptions,
strlen(outputFile), strlen(writeOptions) );
rc = DeregisterApplication(pid);
rc = iMOAB_DeregisterApplication(pid);
CHECKRC(rc, "failed to de-register application");
rc = iMOABFinalize();
rc = iMOAB_Finalize();
CHECKRC(rc, "failed to finalize MOAB");
MPI_Finalize();
......
......@@ -19,15 +19,16 @@ c find out MY process ID, and how many processes were started.
end if
ierr = iMOABInitializeFortran()
ierr = iMOAB_InitializeFortran()
appname = 'PROTEUS'
ierr = RegisterFortranApplication(appname, MPI_COMM_WORLD, pid)
ierr = iMOAB_RegisterFortranApplication(appname, MPI_COMM_WORLD,
& pid)
ierr = DeregisterApplication(pid)
ierr = iMOAB_DeregisterApplication(pid)
ierr = iMOABFinalize()
ierr = iMOAB_Finalize()
call MPI_FINALIZE ( ierr )
......
# MOAB_DIR points to top-level install dir, below which MOAB's lib/ and include/ are located
MOAB_BUILD_DIR := /homes/iulian/source/MOAB14
#MOAB_BUILD_DIR := /home/iulian/source/MOAB14
MOAB_DIR := /homes/iulian/lib/moab14
#MOAB_DIR := /home/iulian/lib/parallel/moab14
ifneq ($(wildcard ${MOAB_DIR}/lib/moab.make),)
include ${MOAB_DIR}/lib/moab.make
include ${MOAB_DIR}/lib/iMesh-Defs.inc
else
include ${MOAB_BUILD_DIR}/moab.make
include ${MOAB_BUILD_DIR}/itaps/imesh/iMesh-Defs.inc
endif
.SUFFIXES: .o .cpp .F90
driver: driver.o ../src/imoab.o ${MOAB_LIBDIR}/libMOAB.la
${MOAB_CXX} -o $@ $< ../src/imoab.o ${MOAB_LIBS_LINK}
fex: fex.o ../src/imoab.o ${MOAB_LIBDIR}/libMOAB.la
${IMESH_FC} -o $@ $< ../src/imoab.o ${MOAB_LIBS_LINK} -lstdc++
fex.o: fex.F
mpif77 ${FCFLAGS} -c $<
clean:
rm -rf *.o *.mod *.h5m ${ALLEXAMPLES}
.cpp.o:
${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
.c.o:
${MOAB_CXX} ${CXXFLAGS} ${MOAB_CXXFLAGS} ${MOAB_CPPFLAGS} ${MOAB_INCLUDES} -DMESH_DIR=\"${MESH_DIR}\" -c $<
.F90.o:
${IMESH_FC} ${FCFLAGS} ${IMESH_FCFLAGS} ${MOAB_CPPFLAGS} ${IMESH_INCLUDES} ${IMESH_FCDEFS} -DMESH_DIR=\"${MESH_DIR}\" -c $<
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment