Changeset 1656

Show
Ignore:
Timestamp:
03/13/08 16:27:32 (2 years ago)
Author:
tautges
Message:

Adding option string to newMesh call in partest to tell it to initialize in parallel; also adding parsing of that option in iMesh implementation.

Location:
MOAB/trunk/tools/iMesh
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp

    r1655 r1656  
    44#include "MBCN.hpp" 
    55#include "MeshTopoUtil.hpp" 
     6#include "FileOptions.hpp" 
     7 
     8#ifdef USE_MPI     
     9#include "mpi.h" 
     10#endif 
    611 
    712#include <iostream> 
     
    1318  bool haveDeletedEntities; 
    1419public: 
    15   MBiMesh() : haveDeletedEntities(false) {} 
     20  MBiMesh(int proc_rank = 0, int proc_size = 0)  
     21      : MBCore(proc_rank, proc_size), haveDeletedEntities(false) 
     22    {} 
     23 
    1624  virtual ~MBiMesh(); 
    1725  bool have_deleted_ents( bool reset ) { 
     
    233241                   iMesh_Instance *instance, int *err, int options_len)  
    234242{ 
    235   MBInterface* core = new MBiMesh(); 
     243  std::string tmp_options(options, options_len); 
     244  FileOptions opts(tmp_options.c_str()); 
     245 
     246  MBInterface* core; 
     247 
     248  MBErrorCode result = opts.get_null_option("PARALLEL"); 
     249  if (MB_SUCCESS == result) { 
     250#ifdef USE_MPI     
     251    int rank, size; 
     252    MPI_Comm_rank(MPI_COMM_WORLD, &rank);  
     253    MPI_Comm_size(MPI_COMM_WORLD, &size);  
     254    core = new MBiMesh(rank, size); 
     255#else 
     256    mError->set_last_error( "PARALLEL option not valid, this instance" 
     257                            " compiled for serial execution.\n" ); 
     258    *err = MB_NOT_IMPLEMENTED; 
     259    return; 
     260#endif 
     261  } 
     262  else core = new MBiMesh(); 
     263 
    236264  *instance = reinterpret_cast<iMesh_Instance>(core); 
    237265  if (0 == *instance) { 
  • MOAB/trunk/tools/iMesh/partest.cpp

    r1655 r1656  
    55 
    66 
    7 #define IMESH_ASSERT(ierr) if (ierr!=0) printf("imesh asser\n"); 
     7#define IMESH_ASSERT(ierr) if (ierr!=0) printf("imesh assert\n"); 
    88#define IMESH_NULL 0 
    99 
     
    1717 
    1818  imesh = IMESH_NULL; 
    19   iMesh_newMesh("", &imesh, &ierr, 0); 
     19  iMesh_newMesh("PARALLEL", &imesh, &ierr, 8); 
    2020  IMESH_ASSERT(ierr); 
    2121