[cig-commits] r13938 - in short/3D/PyLith/branches/pylith-swig/libsrc: . meshio

brad at geodynamics.org brad at geodynamics.org
Fri Jan 23 16:23:48 PST 2009


Author: brad
Date: 2009-01-23 16:23:48 -0800 (Fri, 23 Jan 2009)
New Revision: 13938

Added:
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.hh
Modified:
   short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
Log:
Moved extra routines to new objects.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-01-24 00:22:57 UTC (rev 13937)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-01-24 00:23:48 UTC (rev 13938)
@@ -85,6 +85,7 @@
 	meshio/MeshIO.cc \
 	meshio/MeshIOAscii.cc \
 	meshio/MeshIOLagrit.cc \
+	meshio/MeshBuilder.cc \
 	meshio/OutputManager.cc \
 	meshio/OutputSolnSubset.cc \
 	meshio/PsetFile.cc \
@@ -92,6 +93,7 @@
 	meshio/PsetFileBinary.cc \
 	meshio/VertexFilter.cc \
 	meshio/VertexFilterVecNorm.cc \
+	meshio/UCDFaultFile.cc \
 	topology/Distributor.cc \
 	topology/Field.cc \
 	topology/FieldUniform.cc \

Added: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc	2009-01-24 00:23:48 UTC (rev 13938)
@@ -0,0 +1,296 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "MeshBuilder.hh" // implementation of class methods
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/utils/array.hh" // USES double_array, int_array
+
+#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
+
+#include "Selection.hh" // USES boundary()
+
+#include <cassert> // USES assert()
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+// Set vertices and cells in mesh.
+void
+pylith::meshio::MeshBuilder::buildMesh(topology::Mesh* mesh,
+				       double_array* coordinates,
+				       const int numVertices,
+				       const int spaceDim,
+				       const int_array& cells,
+				       const int numCells,
+				       const int numCorners,
+				       const int meshDim,
+				       const bool interpolate,
+				       const spatialdata::units::Nondimensional& normalizer)
+{ // buildMesh
+  assert(0 != mesh);
+
+  assert(0 != coordinates);
+  MPI_Comm comm = mesh->comm();
+  int dim = meshDim;
+  int rank = 0;
+
+  { // Check to make sure every vertex is in at least one cell.
+    // This is required by Sieve
+    std::vector<bool> vertexInCell(numVertices, false);
+    const int size = cells.size();
+    for (int i=0; i < size; ++i)
+      vertexInCell[cells[i]] = true;
+    int count = 0;
+    for (int i=0; i < numVertices; ++i)
+      if (!vertexInCell[i])
+	++count;
+    if (count > 0) {
+      std::ostringstream msg;
+      msg << "Mesh contains " << count
+	  << " vertices that are not in any cells.";
+      throw std::runtime_error(msg.str());
+    } // if
+  } // check
+
+  MPI_Bcast(&dim, 1, MPI_INT, 0, comm);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
+  assert(!sieveMesh.isNull());
+
+  ALE::Obj<SieveMesh::sieve_type> sieve = 
+    new SieveMesh::sieve_type(mesh->comm());
+  sieveMesh->setSieve(sieve);
+
+  MPI_Comm_rank(comm, &rank);
+  // Memory debugging
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.setDebug(mesh->debug()/2);
+
+  logger.stagePush("MeshCreation");
+  if (0 == rank) {
+    assert(coordinates->size() == numVertices*spaceDim);
+    assert(cells.size() == numCells*numCorners);
+    if (!interpolate) {
+      // Create the ISieve
+      sieve->setChart(SieveMesh::sieve_type::chart_type(0, 
+							numCells+numVertices));
+      // Set cone and support sizes
+      for(int c = 0; c < numCells; ++c) {sieve->setConeSize(c, numCorners);}
+      sieve->symmetrizeSizes(numCells, numCorners, 
+			     const_cast<int*>(&cells[0]), numCells);
+      // Allocate point storage
+      sieve->allocate();
+      // Fill up cones
+      int *cone  = new int[numCorners];
+      int *coneO = new int[numCorners];
+      for(int v = 0; v < numCorners; ++v) {coneO[v] = 1;}
+      for(int c = 0; c < numCells; ++c) {
+        for(int v = 0; v < numCorners; ++v)
+	  cone[v] = cells[c*numCorners+v]+numCells;
+        sieve->setCone(cone, c);
+        sieve->setConeOrientation(coneO, c);
+      } // for
+      delete [] cone;
+      // Symmetrize to fill up supports
+      sieve->symmetrize();
+    } else {
+      // Same old thing
+      ALE::Obj<ALE::Mesh::sieve_type> s =
+	new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+
+      ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, meshDim, 
+                                                  numCells, 
+                                                  const_cast<int*>(&cells[0]), 
+                                                  numVertices, 
+                                                  interpolate,
+                                                  numCorners);
+      std::map<ALE::Mesh::point_type,ALE::Mesh::point_type> renumbering;
+      ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
+    } // if/else
+    logger.stagePop();
+    logger.stagePush("MeshStratification");
+    if (!interpolate) {
+      // Optimized stratification
+      const ALE::Obj<SieveMesh::label_type>& height = 
+	sieveMesh->createLabel("height");
+      const ALE::Obj<SieveMesh::label_type>& depth =
+	sieveMesh->createLabel("depth");
+
+#ifdef IMESH_NEW_LABELS
+      height->setChart(sieveMesh->getSieve()->getChart());
+      depth->setChart(sieveMesh->getSieve()->getChart());
+      for(int c = 0; c < numCells+numVertices; ++c) {
+        height->setConeSize(c, 1);
+        depth->setConeSize(c, 1);
+      }
+      if (numCells+numVertices)
+	height->setSupportSize(0, numCells+numVertices);
+      if (numCells+numVertices)
+	depth->setSupportSize(0, numCells+numVertices);
+      height->allocate();
+      depth->allocate();
+#endif
+      for(int c = 0; c < numCells; ++c) {
+        height->setCone(0, c);
+        depth->setCone(1, c);
+      } // for
+      for(int v = numCells; v < numCells+numVertices; ++v) {
+        height->setCone(1, v);
+        depth->setCone(0, v);
+      } // for
+#ifdef IMESH_NEW_LABELS
+      height->recalculateLabel();
+      depth->recalculateLabel();
+#endif
+      sieveMesh->setHeight(1);
+      sieveMesh->setDepth(1);
+    } else {
+      sieveMesh->stratify();
+    } // if/else
+    logger.stagePop();
+  } else {
+    logger.stagePush("MeshStratification");
+    sieveMesh->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
+    sieveMesh->getSieve()->allocate();
+    sieveMesh->stratify();
+    logger.stagePop();
+  } // if/else
+
+#if defined(ALE_MEM_LOGGING)
+  std::cout
+    << std::endl
+    << "MeshCreation " << logger.getNumAllocations("MeshCreation")
+    << " allocations " << logger.getAllocationTotal("MeshCreation")
+    << " bytes" << std::endl
+    
+    << "MeshCreation " << logger.getNumDeallocations("MeshCreation")
+    << " deallocations " << logger.getDeallocationTotal("MeshCreation")
+    << " bytes" << std::endl
+    
+    << "MeshStratification " << logger.getNumAllocations("MeshStratification")
+    << " allocations " << logger.getAllocationTotal("MeshStratification")
+    << " bytes" << std::endl
+    
+    << "MeshStratification " << logger.getNumDeallocations("MeshStratification")
+    << " deallocations " << logger.getDeallocationTotal("MeshStratification")
+    << " bytes" << std::endl << std::endl;
+#endif
+
+  const double lengthScale = normalizer.lengthScale();
+  normalizer.nondimensionalize(&(*coordinates)[0], coordinates->size(),
+			       lengthScale);
+
+  ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
+						 &(*coordinates)[0]);
+} // buildMesh
+
+// ----------------------------------------------------------------------
+// Set vertices and cells for fault mesh.
+void
+pylith::meshio::MeshBuilder::buildFaultMesh(const ALE::Obj<SieveMesh>& fault,
+					    ALE::Obj<ALE::Mesh>& faultBd,
+					    const double_array& coordinates,
+					    const int numVertices,
+					    const int spaceDim,
+					    const int_array& cells,
+					    const int numCells,
+					    const int numCorners,
+					    const int firstCell,
+					    const int_array& faceCells,
+					    const int meshDim)
+{ // buildFaultMesh
+  MPI_Comm comm = PETSC_COMM_WORLD;
+  int dim  = meshDim;
+  int rank = 0;
+
+  assert(!fault.isNull());
+
+  ALE::Obj<SieveMesh::sieve_type> sieve = 
+    new SieveMesh::sieve_type(fault->comm());
+  fault->setDebug(fault->debug());
+  fault->setSieve(sieve);
+
+  MPI_Comm_rank(comm, &rank);
+  // Memory debugging
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.setDebug(fault->debug()/2);
+
+  logger.stagePush("FaultCreation");
+  if (0 == rank) {
+    assert(coordinates.size() == numVertices*spaceDim);
+    assert(cells.size() == numCells*numCorners);
+    ALE::Obj<ALE::Mesh::sieve_type> s = 
+      new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+    
+    ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, meshDim, 
+						numCells, 
+						const_cast<int*>(&cells[0]), 
+						numVertices, 
+						true,
+						numCorners,
+						0,
+						fault->getArrowSection("orientation"),
+						firstCell);
+    
+    // Add in cells
+    for(int c = 0; c < numCells; ++c) {
+      s->addArrow(c+firstCell, faceCells[c*2+0]);
+      s->addArrow(c+firstCell, faceCells[c*2+1]);
+    } // for
+    
+    ALE::Mesh::renumbering_type& renumbering = fault->getRenumbering();
+    ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering, false);
+    ALE::ISieveConverter::convertOrientation(*s, *sieve, renumbering,
+				fault->getArrowSection("orientation").ptr());
+    
+    Obj<ALE::Mesh> tmpMesh = 
+      new ALE::Mesh(fault->comm(), dim, fault->debug());
+    faultBd = ALE::Selection<ALE::Mesh>::boundary(tmpMesh);
+
+    logger.stagePop();
+    logger.stagePush("FaultStratification");
+    fault->stratify();
+    logger.stagePop();
+  } else {
+    logger.stagePush("FaultStratification");
+    fault->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
+    fault->getSieve()->allocate();
+    fault->stratify();
+    logger.stagePop();
+  } // if/else
+
+#if defined(ALE_MEM_LOGGING)
+  std::cout
+    << std::endl
+    << "FaultCreation " << logger.getNumAllocations("FaultCreation")
+    << " allocations " << logger.getAllocationTotal("FaultCreation")
+    << " bytes" << std::endl
+    
+    << "FaultCreation " << logger.getNumDeallocations("FaultCreation")
+    << " deallocations " << logger.getDeallocationTotal("FaultCreation")
+    << " bytes" << std::endl
+    
+    << "FaultStratification " << logger.getNumAllocations("FaultStratification")
+    << " allocations " << logger.getAllocationTotal("FaultStratification")
+    << " bytes" << std::endl
+    
+    << "FaultStratification " << logger.getNumDeallocations("FaultStratification")
+    << " deallocations " << logger.getDeallocationTotal("FaultStratification")
+    << " bytes" << std::endl << std::endl;
+#endif
+
+} // buildFaultMesh
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh	2009-01-24 00:23:48 UTC (rev 13938)
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_meshbuilder_hh)
+#define pylith_meshio_meshbuilder_hh
+
+// Include directives ---------------------------------------------------
+#include "pylith/utils/arrayfwd.hh" // USES double_array, int_array,
+                                    // string_vector
+
+#define NEWPYLITHMESH 1 
+#include "pylith/utils/sievetypes.hh" // USES Obj, PETSc Mesh
+
+// Forward declarations -------------------------------------------------
+namespace pylith {
+  namespace meshio {
+    class MeshBuilder;
+  } // meshio
+
+  namespace topology {
+    class Mesh;
+  } // meshio
+} // pylith
+
+namespace spatialdata {
+  namespace units {
+    class Nondimensional; // USES Nondimensional
+  } // units
+} // spatialdata
+
+// MeshBuilder ----------------------------------------------------------
+class pylith::meshio::MeshBuilder
+{ // MeshBuilder
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+  /** Build mesh topology and set vertex coordinates.
+   *
+   * All mesh information must use zero based indices. In other words,
+   * the lowest index MUST be 0 not 1.
+   *
+   * @param mesh PyLith finite-element mesh.
+   * @param coordinates Array of coordinates of vertices.
+   * @param numVertices Number of vertices.
+   * @param spaceDim Dimension of vector space for vertex coordinates.
+   * @param cells Array of indices of vertices in cells (first index is 0).
+   * @param numCells Number of cells.
+   * @param numCorners Number of vertices per cell.
+   * @param meshDim Dimension of cells in mesh.
+   */
+  static
+  void buildMesh(topology::Mesh* mesh,
+		 double_array* coordinates,
+		 const int numVertices,
+		 const int spaceDim,
+		 const int_array& cells,
+		 const int numCells,
+		 const int numCorners,
+		 const int meshDim,
+		 const bool interpolate,
+		 const spatialdata::units::Nondimensional& normalizer);
+
+  /** Build fault mesh topology.
+   *
+   * All mesh information must use zero based indices. In other words,
+   * the lowest index MUST be 0 not 1.
+   *
+   * @param fault PETSc mesh for fault.
+   * @param faultBd PETSc mesh for fault boundary.
+   * @param coordinates Array of coordinates of vertices.
+   * @param numVertices Number of vertices.
+   * @param spaceDim Dimension of vector space for vertex coordinates.
+   * @param cells Array of indices of vertices in cells (first index is 0).
+   * @param numCells Number of cells.
+   * @param numCorners Number of vertices per cell.
+   * @param firstCell Label of first cell.
+   * @param cells Array of indices of vertices for fault surface cells
+   * (first index is 0).
+   * @param meshDim Dimension of cells in mesh.
+   */
+  static
+  void buildFaultMesh(const ALE::Obj<SieveMesh>& fault,
+		      ALE::Obj<ALE::Mesh>& faultBd,
+		      const double_array& coordinates,
+		      const int numVertices,
+		      const int spaceDim,
+		      const int_array& cells,
+		      const int numCells,
+		      const int numCorners,
+		      const int firstCell,
+		      const int_array& faceCells,
+		      const int meshDim);
+
+
+}; // MeshBuilder
+
+#endif // pylith_meshio_meshbuilder_hh
+
+// End of file 
+
+

Added: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.cc	2009-01-24 00:23:48 UTC (rev 13938)
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "UCDFaultFile.hh" // implementation of class methods
+
+#include "MeshBuilder.hh" // USES MeshBuilder
+
+#include "pylith/utils/array.hh" // USES double_array, int_array
+
+#include <petsc.h> // USES MPI_Comm
+
+#include <cassert> // USES assert()
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+void
+pylith::meshio::UCDFaultFile::read(const char* filename,
+				   const ALE::Obj<SieveMesh>& mesh, 
+				   const ALE::Obj<SieveMesh>& fault, 
+				   ALE::Obj<ALE::Mesh>& faultBd)
+{ // read
+  int faultDim = 2;
+  int fSpaceDim = 0;
+  int numFVertices = 0;
+  int numFCells = 0;
+  int numFCorners = 0;
+  double_array fCoordinates;
+  int_array fCells;
+  int_array fMaterialIds;
+  int_array faceCells;
+  int_array vertexIDs;
+  
+  if (!fault->commRank()) {
+    std::ifstream fin(filename, std::ios::in);
+    if (!(fin.is_open() && fin.good())) {
+      std::ostringstream msg;
+      msg << "Could not open ASCII INP file '" << filename << "' for reading.";
+      throw std::runtime_error(msg.str());
+    } // if
+    int numNodeData, numCellData, numModelData;
+
+    fSpaceDim = 3;
+
+    // Section 1: <num_nodes> <num_cells> <num_ndata> <num_cdata> <num_mdata>
+    fin >> numFVertices;
+    fin >> numFCells;
+    fin >> numNodeData;
+    fin >> numCellData;
+    fin >> numModelData;
+    // Section 2: <node_id 1> <x> <y> <z>
+    fCoordinates.resize(numFVertices * fSpaceDim);
+    for(int v = 0; v < numFVertices; ++v) {
+      int id;
+      fin >> id;
+      for(int d = 0; d < fSpaceDim; ++d)
+        fin >> fCoordinates[v*fSpaceDim + d];
+    } // for
+
+    // Section 3: <cell_id 1> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n> 
+    fMaterialIds.resize(numFCells);
+    for(int c = 0; c < numFCells; ++c) {
+      std::string cellType = "";
+      int cellID = 0;
+      
+      fin >> cellID;
+      fin >> fMaterialIds[c];
+      fin >> cellType;
+      if (cellType == "tri") {
+        numFCorners = 3;
+      } else if (cellType == "quad") {
+        numFCorners = 4;
+      } else {
+        std::ostringstream msg;
+        msg << "Unknown cell type " << cellType << "while reading INP file.";
+        throw std::runtime_error(msg.str());
+      } // if/else
+      if (c == 0) fCells.resize(numFCells*numFCorners);
+      for(int i = 0; i < numFCorners; ++i)
+	fin >> fCells[c*numFCorners+i];
+    } // for
+
+    // Section 4: <num_comp for node data> <size comp 1> <size comp 2>...<size comp n>
+    int numComponents, totalSize;
+
+    fin >> numComponents;
+    totalSize = 0;
+    for(int i = 0; i < numComponents; ++i) {
+      int compSize;
+      fin >> compSize;
+      totalSize += compSize;
+    } // for
+    // Section 5: <node_comp_label 1> , <units_label 1>
+    for(int c = 0; c < numComponents; ++c) {
+      std::string label, typeName;
+
+      fin >> label;
+      fin >> typeName;
+    } // for
+
+    // Section 6: <node_id 1> <node_data 1> ... <node_data num_ndata>
+    vertexIDs.resize(numFVertices);
+    for(int v = 0; v < numFVertices; ++v) {
+      int id;
+      double dummy;
+
+      fin >> id;
+      fin >> vertexIDs[v]; // global node number
+      fin >> dummy; // components of normal at vertices
+      fin >> dummy;
+      fin >> dummy;
+    } // for
+
+    // Section 7: <num_comp for cell's data> <size comp 1> <size comp 2>...<size comp n>
+    fin >> numComponents;
+    totalSize = 0;
+    for(int i = 0; i < numComponents; ++i) {
+      int compSize;
+      fin >> compSize;
+      totalSize += compSize;
+    }
+
+    // Section 8: <cell_component_label 1> , <units_label 1> 
+    for(int c = 0; c < numComponents; ++c) {
+      std::string label, typeName;
+
+      fin >> label;
+      fin >> typeName;
+    } // for
+
+    // Section 9: <cell_id 1> <cell_data 1> ... <cell_data num_cdata> 
+    faceCells.resize(numFCells*2);
+    for(int c = 0; c < numFCells; ++c) {
+      int id, faultId;
+
+      fin >> id;
+      fin >> faceCells[c*2+0]; // Cell numbers in global mesh on either side of fault
+      fin >> faceCells[c*2+1];
+      fin >> faultId;
+    } // for
+
+    // Determine the number of cells
+    //   Only do this once since we add cohesive cells after that
+    static int numCells = -1;
+
+    if (numCells == -1) {numCells = mesh->heightStratum(0)->size();}
+
+    // Renumber vertices and use zero based indices
+    // UCD file has one-based indices for both vertexIDs and fCells
+    //   Also, vertex numbers are offset by the number of cells
+    for(int c = 0; c < numFCells; ++c)
+      for(int corner = 0; corner < numFCorners; ++corner)
+        fCells[c*numFCorners+corner] = 
+	  vertexIDs[fCells[c*numFCorners+corner]-1] - 1 + numCells;
+
+    // Switch to zero based index for global cell numbering
+    for (int c=0; c < numFCells; ++c)
+      for (int i=0; i < 2; ++i)
+	faceCells[c*2+i] -= 1;
+  } // if
+
+  const int firstFaultCell = 
+    mesh->getSieve()->getBaseSize() + mesh->getSieve()->getCapSize();
+  MeshBuilder::buildFaultMesh(fault, faultBd, 
+			      fCoordinates, numFVertices, fSpaceDim, fCells, 
+			      numFCells, numFCorners, firstFaultCell, 
+			      faceCells, faultDim);
+} // read
+
+
+// End of file
+

Added: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/UCDFaultFile.hh	2009-01-24 00:23:48 UTC (rev 13938)
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/meshio/UCDFaultFile.hh
+ *
+ * @brief C++ object for reading a fault mesh from a UCD file.
+ *
+ * Temporary fix for getting a fault mesh information into
+ * PyLith. Using a fault mesh permits cells to have more than one face
+ * on the fault surface. Supporting information also provides the
+ * orientation of the fault surface, eliminating the need to determine
+ * it from the faces/vertices alone.
+ */
+
+#if !defined(pylith_meshio_ucdfaultfile_hh)
+#define pylith_meshio_ucdfaultfile_hh
+
+// Include directives ---------------------------------------------------
+#define NEWPYLITHMESH 1 
+#include "pylith/utils/sievetypes.hh" // USES SieveMesh, ALE::Mesh
+
+// Forward declarations -------------------------------------------------
+namespace pylith {
+  namespace meshio {
+    class UCDFaultFile;
+
+    class TestFaultFile; // unit testing
+  } // meshio
+} // pylith
+
+// MeshIOLagrit ---------------------------------------------------------
+class pylith::meshio::UCDFaultFile
+{ // UCDFaultFile
+  friend class TestUCDFaultFile; // unit testing
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+  static
+  void read(const char* filename,
+	    const ALE::Obj<SieveMesh>& mesh,
+	    const ALE::Obj<SieveMesh>& fault,
+	    ALE::Obj<ALE::Mesh>& faultBd);
+
+}; // UCDFaultFile
+
+#endif // pylith_meshio_ucdfaultfile_hh
+
+
+// End of file



More information about the CIG-COMMITS mailing list