From 4a0fb8cd3485dd9d8a86a1a33d45056cf3be204b Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 13 Jul 2000 07:21:15 +0000 Subject: [PATCH] r146: *** empty log message *** --- src/Makefile.nt | 53 ------------------------- src/mpiworld.cpp | 84 ---------------------------------------- tools/mpiworld.cpp | 2 +- tools/sample-ctsim.sh.in | 41 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 138 deletions(-) delete mode 100644 src/Makefile.nt delete mode 100644 src/mpiworld.cpp create mode 100755 tools/sample-ctsim.sh.in diff --git a/src/Makefile.nt b/src/Makefile.nt deleted file mode 100644 index 8237a41..0000000 --- a/src/Makefile.nt +++ /dev/null @@ -1,53 +0,0 @@ -# Makefile for libk - -!include - -CC=cl -LD=link -CFLAGS=-O -nologo -I..\include -I..\getopt -DHAVE_GETOPT_H -LDFLAGS=..\getopt\getopt.lib ..\libkmath\libkmath.lib ..\libcio\libcio.lib ..\libgraph\libgraph.lib ..\libezplot\libezplot.lib ..\libir\libir.lib ..\libk\libk.lib -O=.obj - -# variables -OBJ1 = ctrec$(O) phm2rs$(O) phm2if$(O) rs2if$(O) if-1$(O) if-2$(O) if2img$(O) ifinfo$(O) - -all: ctrec.exe phm2rs.exe phm2if.exe rs2if.exe if-1.exe if-2.exe if2img.exe ifinfo.exe - -.obj: .c - $(CC) -c $(cvarsdll) $(CFLAGS) $*.c - -.obj: .cpp - $(CC) -c $(cvarsdll) $(CFLAGS) $*.cpp - - -ctrec.exe: ctrec.obj - link ctrec.obj $(LDFLAGS) - -phm2rs.exe: phm2rs.obj - link phm2rs.obj $(LDFLAGS) - -phm2if.exe: phm2if.obj - link phm2if.obj $(LDFLAGS) - -rs2if.exe: rs2if.obj - link rs2if.obj $(LDFLAGS) - -if-1.exe: if-1.obj - link if-1.obj $(LDFLAGS) - -if-2.exe: if-2.obj - link if-2.obj $(LDFLAGS) - -ifinfo.exe: ifinfo.obj - link ifinfo.obj $(LDFLAGS) - -if2img.exe: if2img.obj - link if2img.obj $(LDFLAGS) - -clean: - echo dummy > a.obj - echo dummy > a.exe - echo dummy > a.lib - del *.obj - del *.exe - del *.lib diff --git a/src/mpiworld.cpp b/src/mpiworld.cpp deleted file mode 100644 index 3b4b993..0000000 --- a/src/mpiworld.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** -** FILE IDENTIFICATION -** -** Name: mpiworld.cpp -** Purpose: MPI Support class -** Programmer: Kevin Rosenberg -** Date Started: June 2000 -** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: mpiworld.cpp,v 1.2 2000/06/22 10:17:28 kevin Exp $ -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** 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 -******************************************************************************/ - -#include -#include - - -MPIWorld::MPIWorld (int& argc, char**& argv) -{ - MPI::Init (argc, argv); - m_comm = MPI::COMM_WORLD.Dup(); - m_nProcessors = m_comm.Get_size(); - m_myRank = m_comm.Get_rank(); - m_vLocalWorkUnits.reserve (m_nProcessors); - m_vStartWorkUnit.reserve (m_nProcessors); - m_vEndWorkUnit.reserve (m_nProcessors); -} - - -void -MPIWorld::setTotalWorkUnits(int totalWorkUnits) -{ - if (m_nProcessors < 1) - return; - - int baseLocalWorkUnits = totalWorkUnits / m_nProcessors; - int remainderWorkUnits = totalWorkUnits % m_nProcessors; - - int currWorkUnits = 0; - for (int iProc = 0; iProc < m_nProcessors; iProc++) { - m_vLocalWorkUnits[iProc] = baseLocalWorkUnits; - if (iProc < remainderWorkUnits) - m_vLocalWorkUnits[iProc]++; - - m_vStartWorkUnit[iProc] = currWorkUnits; - m_vEndWorkUnit[iProc] = m_vStartWorkUnit[iProc] + m_vLocalWorkUnits[iProc] - 1; - - currWorkUnits += m_vLocalWorkUnits[iProc]; - } - -} - -void -MPIWorld::BcastString (string& str) -{ - int len; - - if (m_myRank == 0) - len = str.length(); - m_comm.Bcast (&len, 1, MPI::INT, 0); - char buf [ len + 1]; - - if (m_myRank == 0) - strcpy (buf, str.c_str()); - - m_comm.Bcast (buf, len + 1, MPI::CHAR, 0); - - if (m_myRank > 0) - str = buf; -} diff --git a/tools/mpiworld.cpp b/tools/mpiworld.cpp index 87c9a93..39d09a1 100644 --- a/tools/mpiworld.cpp +++ b/tools/mpiworld.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: mpiworld.cpp,v 1.1 2000/07/13 07:01:35 kevin Exp $ +** $Id: mpiworld.cpp,v 1.2 2000/07/13 07:17:25 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as diff --git a/tools/sample-ctsim.sh.in b/tools/sample-ctsim.sh.in new file mode 100755 index 0000000..1277641 --- /dev/null +++ b/tools/sample-ctsim.sh.in @@ -0,0 +1,41 @@ +#!/bin/sh + +if test "$1" != "" ; then + bin=$1 +else + bin="@prefix@/bin/" +fi + +if test "$1" = "clean" ; then + rm -f sample-phm.png sample-phm16.png sample-phm.if sample-pj.pj sample-pj.if sample-pj.png sample-pj16.png sample-rec.if sample-rec.png sample-rec16.png + exit +fi + +# Generate phantom image + +${bin}phm2if sample-phm.if 256 256 --nsample 2 --phantom herman +if [ -f sample-phm.if ] ; then + ${bin}if2img sample-phm.if sample-phm.png --format png + ${bin}if2img sample-phm.if sample-phm16.png --format png16 +fi + +# Simulate CT data collection and generate raysum sinugram for display +${bin}phm2pj sample-pj.pj 367 320 --nray 2 --phantom herman +if [ -f sample-pj.pj ]; then + ${bin}pj2if sample-pj.pj sample-pj.if +fi +if [ -f sample-pj.if ]; then + ${bin}if2img sample-pj.if sample-pj.png --format png + ${bin}if2img sample-pj.if sample-pj16.png --format png16 +fi + +# Reconstruct raysums and generate image for display +${bin}pjrec sample-pj.pj sample-rec.if 256 256 +if [ -f sample-rec.if ]; then + ${bin}if2img sample-rec.if sample-rec.png --format png + ${bin}if2img sample-rec.if sample-rec16.png --format png16 + + ${bin}if-2 sample-phm.if sample-rec.if --comp +fi + +# Files sample-phm.png, sample-pj.png, and sample-rec.png are ready for display -- 2.34.1