[cig-commits] r17002 - in short/3D/PyLith/trunk/examples/meshing/surface_nurbs: . triangles

willic3 at geodynamics.org willic3 at geodynamics.org
Fri Jun 11 21:26:34 PDT 2010


Author: willic3
Date: 2010-06-11 21:26:34 -0700 (Fri, 11 Jun 2010)
New Revision: 17002

Added:
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/Makefile.am
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/README
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mkfacets.sh
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mksurface.jou
Modified:
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/Makefile.am
   short/3D/PyLith/trunk/examples/meshing/surface_nurbs/README
Log:
Added example showing how to create a NURBS surface from a triangulated
surface.



Modified: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/Makefile.am	2010-06-12 03:20:41 UTC (rev 17001)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/Makefile.am	2010-06-12 04:26:34 UTC (rev 17002)
@@ -12,7 +12,8 @@
 
 SUBDIRS = \
 	contours \
-	dem
+	dem \
+	triangles
 
 
 dist_noinst_DATA = \

Modified: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/README
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/README	2010-06-12 03:20:41 UTC (rev 17001)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/README	2010-06-12 04:26:34 UTC (rev 17002)
@@ -5,3 +5,6 @@
 
 dem - Example of creating a topographic surface using a grid of spline
       curves.
+
+triangles - Example of creating a NURBS surface from a triangulated
+            surface in Facets format.

Added: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/Makefile.am	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/Makefile.am	2010-06-12 04:26:34 UTC (rev 17002)
@@ -0,0 +1,20 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+dist_noinst_DATA = \
+	README \
+	mkfacets.sh \
+	mksurface.jou
+
+
+
+# End of file 

Added: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/README
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/README	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/README	2010-06-12 04:26:34 UTC (rev 17002)
@@ -0,0 +1,10 @@
+This is a simple example showing how to create a NURBS surface from a
+triangulated surface using Cubit. We use the same original data as we did
+for the dem example (coarsely-sampled DEM of Mt Ruapehu volcano, New
+Zealand). There are only two files in this directory in addition to this
+README. The first (mkfacets.sh) is a shell script to create a Facets file
+(readable by Cubit) from the DEM. We use the GMT 'triangulate' utility to
+perform this task. Once the Facets file has been created, we can then use
+the 'mksurface.jou' file within Cubit to create the NURBS surface. Note
+that it is first necessary to create a mapped mesh on the original surface,
+which means that the original triangulation is not really used.

Added: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mkfacets.sh
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mkfacets.sh	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mkfacets.sh	2010-06-12 04:26:34 UTC (rev 17002)
@@ -0,0 +1,28 @@
+#! /bin/sh
+# Shell script to create a triangulated surface in Facets format from a
+# set of points. The Facets file can be read by Cubit.
+# This script uses the GMT triangulate command, which invokes the triangle
+# meshing package if you have installed it.
+
+# Define filenames.
+vertfile=../dem/ruapehu-nzmg-1km.txt
+connectfile=ruapehu-nzmg-1km.connect
+outfile=ruapehu-nzmg-1km.fac
+vertidfile=ruapehu-nzmg-1km-id.vert
+connectidfile=ruapehu-nzmg-1km-id.connect
+
+# Triangulate the points to get connectivities.
+triangulate $vertfile -V > $connectfile
+
+# Count the number of vertices and cells to create a header.
+numverts=$(wc -l < $vertfile)
+numcells=$(wc -l < $connectfile)
+header="$numverts $numcells"
+
+# Create numbered versions of vertex and connectivity files (0-based).
+nl -p -v0 $vertfile > $vertidfile
+nl -p -v0 $connectfile > $connectidfile
+
+# Cat files together to create Facets file.
+echo $header > $outfile
+cat $vertidfile $connectidfile >> $outfile


Property changes on: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mkfacets.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mksurface.jou
===================================================================
--- short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mksurface.jou	                        (rev 0)
+++ short/3D/PyLith/trunk/examples/meshing/surface_nurbs/triangles/mksurface.jou	2010-06-12 04:26:34 UTC (rev 17002)
@@ -0,0 +1,26 @@
+reset
+# This is a simple Cubit journal file that creates a NURBS surface from a
+# triangulated surface. To do this, you must first import the triangulated
+# surface, create a mapped mesh on the surface, and then use the mapped
+# mesh to create a net surface. The resulting surface may then be exported
+# to an ACIS file.
+
+# Import the Facets file.
+import facets "ruapehu-nzmg-1km.fac" feature_angle 100 spline merge stitch
+
+# Create a mapped mesh, using a size of 4 km.
+surface 1 size 4000.0
+mesh surface 1
+
+# Smooth the mesh.
+set debug 91 on
+surface 1 smooth scheme condition number
+smooth surface 1
+
+# Create a net surface from the mapped mesh.
+create surface net from mapped surface 1 heal
+
+# Export the surface in binary ACIS format.
+set geometry engine acis
+export acis "ruapehu-nzmg-1km.sab" surface 2 binary overwrite
+



More information about the CIG-COMMITS mailing list