[cig-commits] r7180 - in mc/3D/CitcomS/branches/v2.2: lib tests
visual
tan2 at geodynamics.org
tan2 at geodynamics.org
Tue Jun 12 17:02:03 PDT 2007
Author: tan2
Date: 2007-06-12 17:02:02 -0700 (Tue, 12 Jun 2007)
New Revision: 7180
Added:
mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.py
mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.py
Removed:
mc/3D/CitcomS/branches/v2.2/tests/asap.py
mc/3D/CitcomS/branches/v2.2/tests/hrothgar.py
mc/3D/CitcomS/branches/v2.2/visual/batchpaste.sh
mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.sh
mc/3D/CitcomS/branches/v2.2/visual/execpaste.py
mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.sh
Modified:
mc/3D/CitcomS/branches/v2.2/lib/Tracer_setup.c
mc/3D/CitcomS/branches/v2.2/tests/Makefile.am
mc/3D/CitcomS/branches/v2.2/visual/Makefile.am
mc/3D/CitcomS/branches/v2.2/visual/autocombine.py
mc/3D/CitcomS/branches/v2.2/visual/batchcombine.py
mc/3D/CitcomS/branches/v2.2/visual/combine.py
Log:
Merging r6509-6850 from trunk
Modified: mc/3D/CitcomS/branches/v2.2/lib/Tracer_setup.c
===================================================================
--- mc/3D/CitcomS/branches/v2.2/lib/Tracer_setup.c 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/lib/Tracer_setup.c 2007-06-13 00:02:02 UTC (rev 7180)
@@ -682,23 +682,37 @@
double x,y,z;
double theta,phi,rad;
- double dmin,dmax;
+ double xmin,xmax,ymin,ymax,zmin,zmax;
double random1,random2,random3;
allocate_tracer_arrays(E,j,tracers_cap);
+ /* Finding the min/max of the cartesian coordinates. */
+ /* One must loop over E->X to find the min/max, since the 8 corner */
+ /* nodes may not be the min/max. */
+ xmin = ymin = zmin = E->sphere.ro;
+ xmax = ymax = zmax = -E->sphere.ro;
+ for (kk=1; kk<=E->lmesh.nno; kk++) {
+ x = E->x[j][1][kk];
+ y = E->x[j][2][kk];
+ z = E->x[j][3][kk];
+ xmin = ((xmin < x) ? xmin : x);
+ xmax = ((xmax > x) ? xmax : x);
+ ymin = ((ymin < y) ? ymin : y);
+ ymax = ((ymax > y) ? ymax : y);
+ zmin = ((zmin < z) ? zmin : z);
+ zmax = ((zmax > z) ? zmax : z);
+ }
+
/* Tracers are placed randomly in cap */
/* (intentionally using rand() instead of srand() )*/
- dmin=-1.0*E->sphere.ro;
- dmax=E->sphere.ro;
-
while (E->trace.ntracers[j]<tracers_cap) {
number_of_tries++;
- max_tries=500*tracers_cap;
+ max_tries=100*tracers_cap;
if (number_of_tries>max_tries) {
fprintf(E->trace.fpt,"Error(make_tracer_array)-too many tries?\n");
@@ -712,9 +726,9 @@
random2=(1.0*rand())/(1.0*RAND_MAX);
random3=(1.0*rand())/(1.0*RAND_MAX);
- x=dmin+random1*(dmax-dmin);
- y=dmin+random2*(dmax-dmin);
- z=dmin+random3*(dmax-dmin);
+ x=xmin+random1*(xmax-xmin);
+ y=ymin+random2*(ymax-ymin);
+ z=zmin+random3*(zmax-zmin);
/* first check if within shell */
Modified: mc/3D/CitcomS/branches/v2.2/tests/Makefile.am
===================================================================
--- mc/3D/CitcomS/branches/v2.2/tests/Makefile.am 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/tests/Makefile.am 2007-06-13 00:02:02 UTC (rev 7180)
@@ -25,9 +25,7 @@
EXTRA_DIST = \
array2d.cc \
- asap.py \
exchange.py \
- hrothgar.py \
signon.py \
test1.sh \
test2.sh \
Deleted: mc/3D/CitcomS/branches/v2.2/tests/asap.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/tests/asap.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/tests/asap.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
-# Copyright (C) 2002-2005, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-import journal
-
-
-# the required component factory
-def staging():
-
- info = journal.debug("staging")
- info.log("instantiating application launcher")
-
- from mpi.StagingMPICH import StagingMPICH
- stager = StagingMPICH()
-
- # initialize using the local default values
- props = stager.properties
- props.nodes = 4
- props.nodegen = "a%03d"
- props.nodelist = "[51-60]"
-
- # return the component
- return stager
-
-
-# version
-__id__ = "$Id$"
-
-# End of file
Deleted: mc/3D/CitcomS/branches/v2.2/tests/hrothgar.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/tests/hrothgar.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/tests/hrothgar.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
-# Copyright (C) 2002-2005, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-import journal
-
-
-# the required component factory
-def staging():
-
- info = journal.debug("staging")
- info.log("instantiating application launcher")
-
- from mpi.LauncherMPICH import LauncherMPICH
- stager = LauncherMPICH()
-
- # initialize using the local values
- stager.inventory.nodegen = "n%03d"
- stager.inventory.nodes = 12
- stager.inventory.nodelist = [101,102,103,104,105,106]
- return stager
-
-
-# version
-# $Id$
-
-# End of file
Modified: mc/3D/CitcomS/branches/v2.2/visual/Makefile.am
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/Makefile.am 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/Makefile.am 2007-06-13 00:02:02 UTC (rev 7180)
@@ -35,15 +35,13 @@
mayavi2_citcoms_display.py \
autocombine.py \
batchcombine.py \
- batchpaste.sh \
batchsurf.py \
citcoms_datadir \
combine.py \
combinesurf.py \
- dxgeneral.sh \
+ dxgeneral.py \
dxgeneralsurf.sh \
estimate_size.py \
- execpaste.py \
getcoord.sh \
getlog.sh \
getsurf.sh \
@@ -51,7 +49,7 @@
miff2avi \
miff2mpg \
parser.py \
- pasteCitcomData.sh \
+ pasteCitcomData.py \
plot_annulus.py \
plot_layer.py \
zslice.py
Modified: mc/3D/CitcomS/branches/v2.2/visual/autocombine.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/autocombine.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/autocombine.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -33,6 +33,7 @@
# default values for CitcomS input
defaults = {'output_format': 'ascii',
+ 'output_optional': 'surf,botm',
'nprocx': 1,
'nprocy': 1,
'nprocz': 1,
@@ -40,6 +41,24 @@
'nodey': 9,
'nodez': 9}
+
+
+def normalize_optional(output_optional):
+ fields = []
+
+ for opt in output_optional.split(','):
+ ## remove the leading/trailing whitespaces
+ opt = opt.strip()
+
+ ## retain fields that are node-based
+ if opt in ('pressure', 'stress', 'comp_nd'):
+ fields.append(opt)
+
+
+ return ','.join(fields)
+
+
+
if __name__ == '__main__':
import sys
@@ -67,6 +86,9 @@
"(output_format=%s)" % output_format
sys.exit(1)
+ output_optional = parser.getstr('output_optional')
+ optional_fields = normalize_optional(output_optional)
+
nodex = parser.getint('nodex')
nodey = parser.getint('nodey')
nodez = parser.getint('nodez')
@@ -76,12 +98,13 @@
nprocz = parser.getint('nprocz')
totalnodes = nprocx * nprocy * nprocz * ncap
- nodelist = bc.machinefile2nodes(machinefile, totalnodes)
+ nodelist = bc.machinefile2nodelist(machinefile, totalnodes)
for timestep in timesteps:
- bc.combine(nodelist, datadir, datafile, timestep,
- nodex, nodey, nodez,
- ncap, nprocx, nprocy, nprocz)
+ bc.batchcombine(nodelist, datadir, datafile, timestep,
+ nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz,
+ optional_fields)
Modified: mc/3D/CitcomS/branches/v2.2/visual/batchcombine.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/batchcombine.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/batchcombine.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -35,7 +35,17 @@
def machinefile2nodes(machinefile, totalnodes):
+ nodelist = machinefile2nodelist(machinefile, totalnodes)
+ nodes = nodelist2nodes(nodelist)
+ return nodes
+
+
+def machinefile2nodelist(machinefile, totalnodes):
+ '''Read the machinefile to get a list of machine names. If machinefile
+ is not readable, treat it as a string containing the machine names.
+ Return the list of machine names. The length of the list is totalnodes.
+ '''
try:
nodelist = file(machinefile).readlines()
except IOError:
@@ -51,40 +61,80 @@
else:
raise ValueError, 'incorrect machinefile size'
+ return nodelist
+
+
+
+def nodelist2nodes(nodelist):
# generate a string of machine names
- nodes = ''
- for node in nodelist:
- nodes += '%s ' % node.strip()
+ nodes = ' '.join([x.strip() for x in nodelist])
return nodes
-def combine(nodes, datadir, datafile, timestep, nodex, nodey, nodez,
- ncap, nprocx, nprocy, nprocz):
+def batchpaste(datadir, datafile, opts, timestep, nodes):
+ from socket import gethostname
+ hostname = gethostname()
+
import os
+ cwd = os.getcwd()
+ for rank, node in enumerate(nodes):
+ if node == 'localhost' or node == hostname:
+ # local paste
+ import pasteCitcomData
+ pasteCitcomData.run(datadir, datafile, opts, rank, timestep, cwd)
+
+ else:
+ # remote paste
+
+ # replace 'rsh' with 'ssh' if necessary
+ remote_shell = 'rsh'
+
+ cmd = '%(remote_shell)s %(node)s pasteCitcomData.py %(datadir)s %(datafile)s %(opts)s %(rank)d %(timestep)d %(cwd)s' % vars()
+ os.system(cmd)
+
+ return
+
+
+
+def batchcombine(nodes, datadir, datafile, timestep, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz, optional_fields):
# paste
- cmd = 'batchpaste.sh %(datadir)s %(datafile)s %(timestep)d %(nodes)s' \
- % vars()
- print cmd
- os.system(cmd)
+ opts0 = 'coord,velo,visc'
+ opts1 = optional_fields
+ batchpaste(datadir, datafile, opts0, timestep, nodes)
+ batchpaste(datadir, datafile, opts1, timestep, nodes)
+
# combine
- cmd = 'combine.py %(datafile)s %(timestep)d %(nodex)d %(nodey)d %(nodez)d %(ncap)d %(nprocx)d %(nprocy)d %(nprocz)d' % vars()
- print cmd
- os.system(cmd)
+ import combine
+ combine.combine(datafile, opts0, timestep, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz)
+ combine.combine(datafile, opts1, timestep, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz)
- # delete
- cmd = 'rm %(datafile)s.[0-9]*.%(timestep)d' % vars()
- print cmd
- os.system(cmd)
+ # delete pasted files
+ import glob
+ filenames = glob.glob('%(datafile)s.*.%(timestep)d.pasted' % vars())
+ import os
+ for filename in filenames:
+ os.remove(filename)
+
+
# create .general file
- cmd = 'dxgeneral.sh %(datafile)s.cap*.%(timestep)d' % vars()
- print cmd
- os.system(cmd)
+ import dxgeneral
+ combined_files0 = []
+ combined_files1 = []
+ for cap in range(ncap):
+ combined_files0.append('%(datafile)s.cap%(cap)02d.%(timestep)d' % vars())
+ combined_files1.append('%(datafile)s.opt%(cap)02d.%(timestep)d' % vars())
+ dxgeneral.write(opts0, combined_files0)
+ dxgeneral.write(opts1, combined_files1)
+
return
@@ -110,10 +160,10 @@
nprocz = int(sys.argv[11])
totalnodes = nprocx * nprocy * nprocz * ncap
- nodelist = machinefile2nodes(machinefile, totalnodes)
+ nodelist = machinefile2nodelist(machinefile, totalnodes)
- combine(nodelist, datadir, datafile, timestep, nodex, nodey, nodez,
- ncap, nprocx, nprocy, nprocz)
+ batchcombine(nodelist, datadir, datafile, timestep, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz)
Deleted: mc/3D/CitcomS/branches/v2.2/visual/batchpaste.sh
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/batchpaste.sh 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/batchpaste.sh 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,62 +0,0 @@
-#!/bin/sh
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
-# Copyright (C) 2002-2005, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# Run 'pasteCitcomData.sh' in a batch process
-#
-# Requirement: 1) current working directory must be mounted on master_ip too.
-# 2) the list of ip has the same order as the MPI machinefile
-
-if [ -z $4 ]; then
- echo "Usage:" `basename $0` datadir datafile timestep ip1 [ip2 ... ]
- exit
-fi
-
-paste_exe=`which execpaste.py`
-cwd=`pwd`
-datadir=$1
-datafile=$2
-timestep=$3
-rank=0
-
-while [ x"$4" != "x" ]
-do
- cmd_paste="$paste_exe $datadir $datafile $rank $timestep $cwd"
- if [ x"$4" = x"$HOSTNAME" -o $4 = "localhost" ]; then
- $cmd_paste
- else
- rsh $4 "$cmd_paste"
- fi
-
- shift
- rank=$(($rank+1))
-done
-
-
-# version
-# $Id$
-
-# End of file
Modified: mc/3D/CitcomS/branches/v2.2/visual/combine.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/combine.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/combine.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -35,26 +35,38 @@
class Combine(object):
- def __init__(self, grid):
+ def __init__(self, nodex, nodey, nodez, nprocx, nprocy, nprocz):
+ self.nodex = nodex
+ self.nodey = nodey
+ self.nodez = nodez
+
+ self.nprocx = nprocx
+ self.nprocy = nprocy
+ self.nprocz = nprocz
+
# data storage
- self.saved = range(grid['nox'] * grid['noy'] * grid['noz'])
+ self.saved = range(nodex * nodey * nodez)
return
- def readData(self, filename):
+ def readData(self, filename, headlines=1):
fp = file(filename, 'r')
- header = fp.readline()
- #print header
+
+ # discard the header
+ for i in range(headlines):
+ header = fp.readline()
+ #print header
+
return fp.readlines()
- def join(self, data, me, grid, cap):
+ def join(self, data, me):
# processor geometry
- nprocx = int(cap['nprocx'])
- nprocy = int(cap['nprocy'])
- nprocz = int(cap['nprocz'])
+ nprocx = self.nprocx
+ nprocy = self.nprocy
+ nprocz = self.nprocz
mylocz = me % nprocz
mylocx = ((me - mylocz) / nprocz) % nprocx
@@ -62,26 +74,26 @@
#print me, mylocx, mylocy, mylocz
# mesh geometry
- nox = int(grid['nox'])
- noy = int(grid['noy'])
- noz = int(grid['noz'])
+ nodex = self.nodex
+ nodey = self.nodey
+ nodez = self.nodez
- mynox = 1 + (nox-1)/nprocx
- mynoy = 1 + (noy-1)/nprocy
- mynoz = 1 + (noz-1)/nprocz
+ mynodex = 1 + (nodex-1)/nprocx
+ mynodey = 1 + (nodey-1)/nprocy
+ mynodez = 1 + (nodez-1)/nprocz
- if not len(data) == mynox * mynoy * mynoz:
- raise ValueError, "data size"
+ if not len(data) == mynodex * mynodey * mynodez:
+ raise ValueError, "incorrect data size"
- mynxs = (mynox - 1) * mylocx
- mynys = (mynoy - 1) * mylocy
- mynzs = (mynoz - 1) * mylocz
+ mynxs = (mynodex - 1) * mylocx
+ mynys = (mynodey - 1) * mylocy
+ mynzs = (mynodez - 1) * mylocz
n = 0
- for i in range(mynys, mynys+mynoy):
- for j in range(mynxs, mynxs + mynox):
- for k in range(mynzs, mynzs + mynoz):
- m = k + j * noz + i * nox * noz
+ for i in range(mynys, mynys+mynodey):
+ for j in range(mynxs, mynxs + mynodex):
+ for k in range(mynzs, mynzs + mynodez):
+ m = k + j * nodez + i * nodex * nodez
self.saved[m] = data[n]
n += 1
@@ -89,9 +101,9 @@
- def write(self, filename, grid):
+ def write(self, filename):
fp = file(filename, 'w')
- header = '%d x %d x %d\n' % (grid['nox'], grid['noy'], grid['noz'])
+ header = '%d x %d x %d\n' % (self.nodex, self.nodey, self.nodez)
#print header
fp.write(header)
fp.writelines(self.saved)
@@ -99,6 +111,30 @@
+##############################################
+
+
+def combine(prefix, opts, step, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz):
+ nproc_per_cap = nprocx * nprocy * nprocz
+ for i in range(ncap):
+ cb = Combine(nodex, nodey, nodez, nprocx, nprocy, nprocz)
+ for n in range(i * nproc_per_cap, (i+1) * nproc_per_cap):
+ filename = '%s.%s.%d.%d.pasted' % (prefix, opts, n, step)
+ print 'reading', filename
+ data = cb.readData(filename, 0)
+ cb.join(data, n)
+
+ if opts == 'coord,velo,visc':
+ filename = '%s.cap%02d.%d' % (prefix, i, step)
+ else:
+ filename = '%s.opt%02d.%d' % (prefix, i, step)
+
+ print 'writing', filename
+ cb.write(filename)
+
+
+
if __name__ == '__main__':
import sys
@@ -110,31 +146,19 @@
prefix = sys.argv[1]
step = int(sys.argv[2])
- grid = {}
- grid['nox'] = int(sys.argv[3])
- grid['noy'] = int(sys.argv[4])
- grid['noz'] = int(sys.argv[5])
+ nodex = int(sys.argv[3])
+ nodey = int(sys.argv[4])
+ nodez = int(sys.argv[5])
ncap = int(sys.argv[6])
- cap = {}
- cap['nprocx'] = int(sys.argv[7])
- cap['nprocy'] = int(sys.argv[8])
- cap['nprocz'] = int(sys.argv[9])
+ nprocx = int(sys.argv[7])
+ nprocy = int(sys.argv[8])
+ nprocz = int(sys.argv[9])
- nproc_per_cap = cap['nprocx'] * cap['nprocy'] * cap['nprocz']
- for i in range(ncap):
- cb = Combine(grid)
- for n in range(i * nproc_per_cap, (i+1) * nproc_per_cap):
- filename = '%s.%d.%d' % (prefix, n, step)
- print 'reading', filename
- data = cb.readData(filename)
- cb.join(data, n, grid, cap)
+ combine(prefix, step, nodex, nodey, nodez,
+ ncap, nprocx, nprocy, nprocz)
- filename = '%s.cap%02d.%d' % (prefix, i, step)
- print 'writing', filename
- cb.write(filename, grid)
-
# version
# $Id$
Copied: mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.py (from rev 6850, mc/3D/CitcomS/trunk/visual/dxgeneral.py)
Deleted: mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.sh
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.sh 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/dxgeneral.sh 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,66 +0,0 @@
-#!/bin/sh
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
-# Copyright (C) 2002-2005, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# Create OpenDX .general file for combined Citcom Data
-#
-
-if [ -z $1 ]; then
- echo " usage:" `basename $0` file1 [file2 ...]
- exit
-fi
-
-
-for i; do
-
- if [ ! -f $i ]; then
- echo file \'$1\' not exist
- exit
- fi
-
- echo processing $i ...
- output=$i.general
- grid=`head -n 1 $i | awk '{print $3, $2, $1, $4, $5}'`
-
- echo file = $i > $output
- echo grid = $grid >> $output
- echo format = ascii >> $output
- echo interleaving = field >> $output
- echo majority = row >> $output
- echo header = lines 1 >> $output
- echo field = locations, velocity, temperature, viscosity >> $output
- echo structure = 3-vector, 3-vector, scalar, scalar >> $output
- echo type = float, float, float, float >> $output
- echo >> $output
- echo end >> $output
-
-done
-
-
-# version
-# $Id$
-
-# End of file
Deleted: mc/3D/CitcomS/branches/v2.2/visual/execpaste.py
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/execpaste.py 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/execpaste.py 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan
-# Copyright (C) 2006, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-"""Execute pasteCitcomData.sh to retrieve the pasted data
-
-Usage: execpaste.py datadir datafile processor_rank timestep save_dir
-
-datadir: same input parameter for CitcomS
-datafile: same input parameter for CitcomS
-processor_rank: MPI rank of current processor
-timestep: timestep to retrieve
-save_dir: which directory to save the retrieved data
-"""
-
-import sys
-
-if len(sys.argv) != 6:
- print __doc__
- sys.exit()
-
-datadir = sys.argv[1]
-datafile = sys.argv[2]
-rank = sys.argv[3]
-timestep = sys.argv[4]
-save_dir = sys.argv[5]
-
-import os
-paste_exe = "pasteCitcomData.sh"
-
-
-## expand datadir
-s = "%HOSTNAME"
-try:
- datadir.index(s)
-except: pass
-else:
- from socket import gethostname
- datadir = datadir.replace(s, gethostname())
-
-s = "%RANK"
-try:
- datadir.index(s)
-except: pass
-else:
- datadir = datadir.replace(s, rank)
-
-if datadir == "%DATADIR":
- fp = os.popen("citcoms_datadir", "r")
- datadir = fp.readline().strip()
- fp.close()
-
-
-## run paste_exe and copy the pasted data to save_dir
-os.chdir(datadir)
-cmd = """
-%(paste_exe)s %(datafile)s %(rank)s %(timestep)s && \
-cp %(datafile)s.%(rank)s.%(timestep)s %(save_dir)s
-""" % vars()
-os.system(cmd)
-
-
-# version
-# $Id$
-
-# End of file
Copied: mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.py (from rev 6850, mc/3D/CitcomS/trunk/visual/pasteCitcomData.py)
Deleted: mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.sh
===================================================================
--- mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.sh 2007-06-12 23:49:07 UTC (rev 7179)
+++ mc/3D/CitcomS/branches/v2.2/visual/pasteCitcomData.sh 2007-06-13 00:02:02 UTC (rev 7180)
@@ -1,53 +0,0 @@
-#!/bin/sh
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#<LicenseText>
-#
-# CitcomS.py by Eh Tan, Eun-seo Choi, and Pururav Thoutireddy.
-# Copyright (C) 2002-2005, California Institute of Technology.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#</LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# Gather Citcom data (coordinate, velocity, temperature, viscosity) of current
-# processor into a single file.
-
-if [ -z $3 ]; then
- echo " usage:" `basename $0` datafile processor_rank timestep
- exit
-fi
-
-datafile=$1
-rank=$2
-step=$3
-
-line=`cat $datafile.velo.$rank.$step | wc -l`
-#echo $line
-line=$(($line - 1))
-#echo $line
-
-tail -n $line $datafile.velo.$rank.$step \
- | paste -d' ' $datafile.coord.$rank - $datafile.visc.$rank.$step \
- > $datafile.$rank.$step
-
-
-# version
-# $Id$
-
-# End of file
More information about the cig-commits
mailing list