/[escript]/branches/more_shared_ptrs_from_1812/finley/src/CPPAdapter/MeshAdapterFactory.cpp
ViewVC logotype

Diff of /branches/more_shared_ptrs_from_1812/finley/src/CPPAdapter/MeshAdapterFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/finley/src/CPPAdapter/MeshAdapterFactory.cpp revision 1776 by ksteube, Tue Sep 9 06:03:53 2008 UTC branches/more_shared_ptrs_from_1812/finley/src/CPPAdapter/MeshAdapterFactory.cpp revision 1821 by jfenwick, Wed Oct 1 04:46:59 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  #ifdef PASO_MPI  #ifdef PASO_MPI
16  #include <mpi.h>  #include <mpi.h>
# Line 49  namespace finley { Line 48  namespace finley {
48    }    }
49  #endif  #endif
50    
51    AbstractContinuousDomain* loadMesh(const std::string& fileName)  //   AbstractContinuousDomain* loadMesh(const std::string& fileName)
52      Domain_ptr loadMesh(const std::string& fileName)
53    {    {
54  #ifdef USE_NETCDF  #ifdef USE_NETCDF
55      bool optimize=FALSE; // Don't optimize since this would cause problems with Data().dump()      bool optimize=FALSE; // Don't optimize since this would cause problems with Data().dump()
# Line 466  namespace finley { Line 466  namespace finley {
466      TMPMEMFREE(fName);      TMPMEMFREE(fName);
467    
468      blocktimer_increment("LoadMesh()", blocktimer_start);      blocktimer_increment("LoadMesh()", blocktimer_start);
469      return temp;      return temp->getPtr();
470  #else  #else
471      throw DataException("Error - loadMesh: is not compiled with NetCFD. Please contact your installation manager.");      throw DataException("Error - loadMesh: is not compiled with NetCFD. Please contact your installation manager.");
472  #endif /* USE_NETCDF */  #endif /* USE_NETCDF */
473    }    }
474    
475    AbstractContinuousDomain* readMesh(const std::string& fileName,    Domain_ptr readMesh(const std::string& fileName,
                      int integrationOrder,  
                                      int reducedIntegrationOrder,  
                                      int optimize)  
   {  
     //  
     // create a copy of the filename to overcome the non-constness of call  
     // to Finley_Mesh_read  
     Finley_Mesh* fMesh=0;  
     // Win32 refactor  
     if( fileName.size() == 0 )  
     {  
        throw DataException("Null file name!");  
     }  
   
     char *fName = TMPMEMALLOC(fileName.size()+1,char);  
       
     strcpy(fName,fileName.c_str());  
     double blocktimer_start = blocktimer_time();  
   
     fMesh=Finley_Mesh_read(fName,integrationOrder, reducedIntegrationOrder, (optimize ? TRUE : FALSE));  
     checkFinleyError();  
     AbstractContinuousDomain* temp=new MeshAdapter(fMesh);  
       
     /* win32 refactor */  
     TMPMEMFREE(fName);  
       
     blocktimer_increment("ReadMesh()", blocktimer_start);  
     return temp;  
   }  
   
   AbstractContinuousDomain* readMeshMPI(const std::string& fileName,  
476                       int integrationOrder,                       int integrationOrder,
477                                       int reducedIntegrationOrder,                                       int reducedIntegrationOrder,
478                                       int optimize)                                       int optimize)
# Line 531  namespace finley { Line 500  namespace finley {
500      TMPMEMFREE(fName);      TMPMEMFREE(fName);
501            
502      blocktimer_increment("ReadMesh()", blocktimer_start);      blocktimer_increment("ReadMesh()", blocktimer_start);
503      return temp;      return temp->getPtr();
504    }    }
505    
506    AbstractContinuousDomain* readGmsh(const std::string& fileName,    Domain_ptr readGmsh(const std::string& fileName,
507                                       int numDim,                                       int numDim,
508                                       int integrationOrder,                                       int integrationOrder,
509                                       int reducedIntegrationOrder,                                       int reducedIntegrationOrder,
# Line 563  namespace finley { Line 532  namespace finley {
532      TMPMEMFREE(fName);      TMPMEMFREE(fName);
533            
534      blocktimer_increment("ReadGmsh()", blocktimer_start);      blocktimer_increment("ReadGmsh()", blocktimer_start);
535      return temp;      return temp->getPtr();
536    }    }
537    
538    AbstractContinuousDomain* brick(int n0,int n1,int n2,int order,  /*  AbstractContinuousDomain* brick(int n0,int n1,int n2,int order,*/
539      Domain_ptr brick(int n0,int n1,int n2,int order,
540              double l0,double l1,double l2,              double l0,double l1,double l2,
541              int periodic0,int periodic1,              int periodic0,int periodic1,
542              int periodic2,              int periodic2,
# Line 600  namespace finley { Line 570  namespace finley {
570      // Convert any finley errors into a C++ exception      // Convert any finley errors into a C++ exception
571      checkFinleyError();      checkFinleyError();
572      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
573      return temp;      return temp->getPtr();
574    }    }
575    AbstractContinuousDomain*  rectangle(int n0,int n1,int order,  
576    /*  AbstractContinuousDomain*  rectangle(int n0,int n1,int order,*/
577      Domain_ptr  rectangle(int n0,int n1,int order,
578              double l0, double l1,              double l0, double l1,
579              int periodic0,int periodic1,              int periodic0,int periodic1,
580              int integrationOrder,              int integrationOrder,
# Line 633  namespace finley { Line 605  namespace finley {
605      // Convert any finley errors into a C++ exception      // Convert any finley errors into a C++ exception
606      checkFinleyError();      checkFinleyError();
607      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
608      return temp;      return temp->getPtr();
609    }    }
610    
611    AbstractContinuousDomain* meshMerge(const boost::python::list& meshList)    Domain_ptr meshMerge(const boost::python::list& meshList)
612    {    {
613      Finley_Mesh* fMesh=0;      Finley_Mesh* fMesh=0;
614      //      //
# Line 657  namespace finley { Line 629  namespace finley {
629      checkFinleyError();      checkFinleyError();
630      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);      AbstractContinuousDomain* temp=new MeshAdapter(fMesh);
631    
632      return temp;      return temp->getPtr();
633    }    }
634    AbstractContinuousDomain*  glueFaces(const boost::python::list& meshList,  
635      Domain_ptr  glueFaces(const boost::python::list& meshList,
636                                     double safety_factor,                                     double safety_factor,
637                             double tolerance,                             double tolerance,
638                                         int optimize)                                         int optimize)
# Line 667  namespace finley { Line 640  namespace finley {
640      Finley_Mesh* fMesh=0;      Finley_Mesh* fMesh=0;
641      //      //
642      // merge the meshes:      // merge the meshes:
643      AbstractContinuousDomain* merged_meshes=meshMerge(meshList);      Domain_ptr merged_meshes=meshMerge(meshList);
644    
645      //      //
646      // glue the faces:      // glue the faces:
647      const MeshAdapter* merged_finley_meshes=static_cast<const MeshAdapter*>(merged_meshes);      const MeshAdapter* merged_finley_meshes=dynamic_cast<const MeshAdapter*>(merged_meshes.get());
648      fMesh=merged_finley_meshes->getFinley_Mesh();      fMesh=merged_finley_meshes->getFinley_Mesh();
649      Finley_Mesh_glueFaces(fMesh,safety_factor,tolerance,(optimize ? TRUE : FALSE));      Finley_Mesh_glueFaces(fMesh,safety_factor,tolerance,(optimize ? TRUE : FALSE));
650    
651      //      //
652      // Convert any finley errors into a C++ exception      // Convert any finley errors into a C++ exception
653      checkFinleyError();      checkFinleyError();
654      return merged_meshes;      return merged_meshes->getPtr();
655    }    }
656    AbstractContinuousDomain*  joinFaces(const boost::python::list& meshList,    Domain_ptr  joinFaces(const boost::python::list& meshList,
657              double safety_factor,              double safety_factor,
658              double tolerance,              double tolerance,
659                          int optimize)                          int optimize)
# Line 687  namespace finley { Line 661  namespace finley {
661      Finley_Mesh* fMesh=0;      Finley_Mesh* fMesh=0;
662      //      //
663      // merge the meshes:      // merge the meshes:
664      AbstractContinuousDomain* merged_meshes=meshMerge(meshList);      Domain_ptr merged_meshes=meshMerge(meshList);
665      //      //
666      // join the faces:      // join the faces:
667      const MeshAdapter* merged_finley_meshes=static_cast<const MeshAdapter*>(merged_meshes);      const MeshAdapter* merged_finley_meshes=static_cast<const MeshAdapter*>(merged_meshes.get());
668      fMesh=merged_finley_meshes->getFinley_Mesh();      fMesh=merged_finley_meshes->getFinley_Mesh();
669      Finley_Mesh_joinFaces(fMesh,safety_factor,tolerance, (optimize ? TRUE : FALSE));      Finley_Mesh_joinFaces(fMesh,safety_factor,tolerance, (optimize ? TRUE : FALSE));
670      //      //
671      // Convert any finley errors into a C++ exception      // Convert any finley errors into a C++ exception
672      checkFinleyError();      checkFinleyError();
673      return merged_meshes;      return merged_meshes->getPtr();
674    }    }
675    
676    // end of namespace    // end of namespace

Legend:
Removed from v.1776  
changed lines
  Added in v.1821

  ViewVC Help
Powered by ViewVC 1.1.26