aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOBasic
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2005-12-21 14:24:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2005-12-21 14:24:00 +0000
commit6592bec0050ebbebc1c3c5168ef2d34969f6c920 (patch)
treedf65194cea01ae7c789f8e79c8a8899028909ada /Carpet/CarpetIOBasic
parenta96a13a9a13f5e4cae25fa3445f515a037f21c54 (diff)
CarpetIOBasic: A new thorn that replaces IOBasic for Carpet
darcs-hash:20051221142410-dae7b-eb542dc795db5f794f9f2db0a82971eb8b63e659.gz
Diffstat (limited to 'Carpet/CarpetIOBasic')
-rw-r--r--Carpet/CarpetIOBasic/COPYING341
-rw-r--r--Carpet/CarpetIOBasic/README8
-rw-r--r--Carpet/CarpetIOBasic/configuration.ccl5
-rw-r--r--Carpet/CarpetIOBasic/doc/documentation.tex144
-rw-r--r--Carpet/CarpetIOBasic/interface.ccl11
-rw-r--r--Carpet/CarpetIOBasic/param.ccl51
-rw-r--r--Carpet/CarpetIOBasic/schedule.ccl15
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc700
-rw-r--r--Carpet/CarpetIOBasic/src/make.code.defn8
9 files changed, 1283 insertions, 0 deletions
diff --git a/Carpet/CarpetIOBasic/COPYING b/Carpet/CarpetIOBasic/COPYING
new file mode 100644
index 000000000..1942c4334
--- /dev/null
+++ b/Carpet/CarpetIOBasic/COPYING
@@ -0,0 +1,341 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330
+ Boston, MA 02111-1307, USA.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Carpet/CarpetIOBasic/README b/Carpet/CarpetIOBasic/README
new file mode 100644
index 000000000..a0b0fa1f2
--- /dev/null
+++ b/Carpet/CarpetIOBasic/README
@@ -0,0 +1,8 @@
+Cactus Code Thorn CarpetIOBasic
+Thorn Author(s) : Erik Schnetter <schnetter@cct.lsu.edu>
+Thorn Maintainer(s) : Erik Schnetter <schnetter@cct.lsu.edu>
+--------------------------------------------------------------------------
+
+Purpose of the thorn:
+
+This thorn provides info output for Carpet.
diff --git a/Carpet/CarpetIOBasic/configuration.ccl b/Carpet/CarpetIOBasic/configuration.ccl
new file mode 100644
index 000000000..da6707df5
--- /dev/null
+++ b/Carpet/CarpetIOBasic/configuration.ccl
@@ -0,0 +1,5 @@
+# Configuration definitions for thorn CarpetIOBasic
+
+REQUIRES Carpet CarpetLib IOUtil
+
+REQUIRES THORNS: Carpet CarpetLib IOUtil
diff --git a/Carpet/CarpetIOBasic/doc/documentation.tex b/Carpet/CarpetIOBasic/doc/documentation.tex
new file mode 100644
index 000000000..ba9b1d859
--- /dev/null
+++ b/Carpet/CarpetIOBasic/doc/documentation.tex
@@ -0,0 +1,144 @@
+% *======================================================================*
+% Cactus Thorn template for ThornGuide documentation
+% Author: Ian Kelley
+% Date: Sun Jun 02, 2002
+% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $
+%
+% Thorn documentation in the latex file doc/documentation.tex
+% will be included in ThornGuides built with the Cactus make system.
+% The scripts employed by the make system automatically include
+% pages about variables, parameters and scheduling parsed from the
+% relevant thorn CCL files.
+%
+% This template contains guidelines which help to assure that your
+% documentation will be correctly added to ThornGuides. More
+% information is available in the Cactus UsersGuide.
+%
+% Guidelines:
+% - Do not change anything before the line
+% % START CACTUS THORNGUIDE",
+% except for filling in the title, author, date, etc. fields.
+% - Each of these fields should only be on ONE line.
+% - Author names should be separated with a \\ or a comma.
+% - You can define your own macros, but they must appear after
+% the START CACTUS THORNGUIDE line, and must not redefine standard
+% latex commands.
+% - To avoid name clashes with other thorns, 'labels', 'citations',
+% 'references', and 'image' names should conform to the following
+% convention:
+% ARRANGEMENT_THORN_LABEL
+% For example, an image wave.eps in the arrangement CactusWave and
+% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps
+% - Graphics should only be included using the graphicx package.
+% More specifically, with the "\includegraphics" command. Do
+% not specify any graphic file extensions in your .tex file. This
+% will allow us to create a PDF version of the ThornGuide
+% via pdflatex.
+% - References should be included with the latex "\bibitem" command.
+% - Use \begin{abstract}...\end{abstract} instead of \abstract{...}
+% - Do not use \appendix, instead include any appendices you need as
+% standard sections.
+% - For the benefit of our Perl scripts, and for future extensions,
+% please use simple latex.
+%
+% *======================================================================*
+%
+% Example of including a graphic image:
+% \begin{figure}[ht]
+% \begin{center}
+% \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}
+% \end{center}
+% \caption{Illustration of this and that}
+% \label{MyArrangement_MyThorn_MyLabel}
+% \end{figure}
+%
+% Example of using a label:
+% \label{MyArrangement_MyThorn_MyLabel}
+%
+% Example of a citation:
+% \cite{MyArrangement_MyThorn_Author99}
+%
+% Example of including a reference
+% \bibitem{MyArrangement_MyThorn_Author99}
+% {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999),
+% 1--16. {\tt http://www.nowhere.com/}}
+%
+% *======================================================================*
+
+% If you are using CVS use this line to give version information
+% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $
+
+\documentclass{article}
+
+% Use the Cactus ThornGuide style file
+% (Automatically used from Cactus distribution, if you have a
+% thorn without the Cactus Flesh download this from the Cactus
+% homepage at www.cactuscode.org)
+\usepackage{../../../../doc/latex/cactus}
+
+\begin{document}
+
+% The author of the documentation
+\author{Erik Schnetter \textless schnetter@cct.lsu.edu\textgreater}
+
+% The title of the document (not necessarily the name of the Thorn)
+\title{CarpetIOBasic}
+
+% the date your document was last changed, if your document is in CVS,
+% please use:
+% \date{$ $Date: 2004/01/07 20:12:39 $ $}
+\date{December 20 2005}
+
+\maketitle
+
+% Do not delete next line
+% START CACTUS THORNGUIDE
+
+% Add all definitions used in this documentation here
+% \def\mydef etc
+
+% Add an abstract for this thorn's documentation
+\begin{abstract}
+
+\end{abstract}
+
+% The following sections are suggestive only.
+% Remove them or add your own.
+
+\section{Introduction}
+
+\section{Physical System}
+
+\section{Numerical Implementation}
+
+\section{Using This Thorn}
+
+\subsection{Obtaining This Thorn}
+
+\subsection{Basic Usage}
+
+\subsection{Special Behaviour}
+
+\subsection{Interaction With Other Thorns}
+
+\subsection{Examples}
+
+\subsection{Support and Feedback}
+
+\section{History}
+
+\subsection{Thorn Source Code}
+
+\subsection{Thorn Documentation}
+
+\subsection{Acknowledgements}
+
+
+\begin{thebibliography}{9}
+
+\end{thebibliography}
+
+% Do not delete next line
+% END CACTUS THORNGUIDE
+
+\end{document}
diff --git a/Carpet/CarpetIOBasic/interface.ccl b/Carpet/CarpetIOBasic/interface.ccl
new file mode 100644
index 000000000..f78b46d71
--- /dev/null
+++ b/Carpet/CarpetIOBasic/interface.ccl
@@ -0,0 +1,11 @@
+# Interface definition for thorn CarpetIOBasic
+
+IMPLEMENTS: IOBasic
+
+INHERITS: IO
+
+CCTK_INT last_output_iteration TYPE=scalar
+CCTK_REAL last_output_time TYPE=scalar
+CCTK_INT this_iteration TYPE=scalar
+
+USES INCLUDE HEADER: carpet_typecase.hh
diff --git a/Carpet/CarpetIOBasic/param.ccl b/Carpet/CarpetIOBasic/param.ccl
new file mode 100644
index 000000000..e77339d19
--- /dev/null
+++ b/Carpet/CarpetIOBasic/param.ccl
@@ -0,0 +1,51 @@
+# Parameter definitions for thorn CarpetIOBasic
+
+
+
+shares: IO
+
+USES KEYWORD out_criterion
+USES CCTK_INT out_every
+USES CCTK_REAL out_dt
+
+USES BOOLEAN strict_io_parameter_check
+
+
+
+private:
+
+
+
+CCTK_STRING outInfo_vars "Variables to output in scalar form" STEERABLE = ALWAYS
+{
+ "" :: "A regex which matches everything"
+} ""
+
+CCTK_STRING outInfo_reductions "List of reductions to output in scalar form" STEERABLE = ALWAYS
+{
+ "" :: "A regex which matches everything"
+} "minimum maximum"
+
+
+
+KEYWORD outInfo_criterion "Criterion to select scalar output intervals, overrides out_every" STEERABLE = ALWAYS
+{
+ "never" :: "Never output"
+ "iteration" :: "Output every so many iterations"
+ "time" :: "Output every that much coordinate time"
+} "iteration"
+
+CCTK_INT outInfo_every "How often to do scalar output, overrides IO::out_every" STEERABLE = ALWAYS
+{
+ 1:* :: "Output every so many time steps"
+ -1:0 :: "No output"
+ -2 :: "Default to IO::out_every"
+} -2
+
+REAL outInfo_dt "How often to do scalar output, overrides out_dt" STEERABLE = ALWAYS
+{
+ (0:* :: "In intervals of that much coordinate time"
+ 0 :: "As often as possible"
+ -1 :: "Disable output"
+ -2 :: "Default to IO::out_dt"
+} -2
diff --git a/Carpet/CarpetIOBasic/schedule.ccl b/Carpet/CarpetIOBasic/schedule.ccl
new file mode 100644
index 000000000..77e139a69
--- /dev/null
+++ b/Carpet/CarpetIOBasic/schedule.ccl
@@ -0,0 +1,15 @@
+# Schedule definitions for thorn CarpetIOBasic
+
+storage: last_output_iteration last_output_time this_iteration
+
+schedule CarpetIOBasicStartup at STARTUP after IOUtil_Startup
+{
+ LANG: C
+ OPTIONS: global
+} "Startup routine"
+
+schedule CarpetIOBasicInit at BASEGRID
+{
+ LANG: C
+ OPTIONS: global
+} "Initialisation routine"
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
new file mode 100644
index 000000000..9fa5803b6
--- /dev/null
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -0,0 +1,700 @@
+#include <algorithm>
+#include <cassert>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+#include <cctype>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <list>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
+#include "cctk_Parameters.h"
+
+#include "CactusBase/IOUtil/src/ioGH.h"
+#include "CactusBase/IOUtil/src/ioutil_Utils.h"
+
+#include "carpet.hh"
+
+
+
+// That's a hack
+namespace Carpet {
+ void UnsupportedVarType (const int vindex);
+}
+
+
+
+namespace CarpetIOBasic {
+
+ using namespace std;
+ using namespace Carpet;
+
+
+
+ // Output field widths and precisions
+ int const iter_width = 9;
+ int const time_width = 9;
+ int const time_prec = 3;
+
+ int const int_width = 11;
+ int const real_width = 13;
+ int const real_prec = 6;
+
+
+
+ // Definition of local types
+ struct info {
+ string reduction;
+ int handle;
+ };
+
+
+ // Registered functions
+ void* SetupGH (tFleshConfig* fc, int convLevel, cGH* cctkGH);
+ int OutputGH (const cGH* cctkGH);
+
+ // Internal functions
+ bool TimeToOutput (const cGH* cctkGH);
+ void OutputHeader (const cGH* cctkGH);
+ void OutputVar (const cGH* cctkGH, int vindex);
+ void CheckSteerableParameters (const cGH * cctkGH);
+
+ void
+ ExamineVariable (int vindex, bool & isint, int & numcomps, bool & isscalar);
+ vector<string> ParseReductions (char const * credlist);
+
+
+
+ // Definition of members
+ int output_count;
+ int last_output;
+
+ /* CarpetBasic GH extension structure */
+ struct
+ {
+ /* list of variables to output */
+ char *out_vars;
+
+ /* stop on I/O parameter parsing errors ? */
+ int stop_on_parse_errors;
+
+ /* I/O request description list (for all variables) */
+ ioRequest **requests;
+ } IOparameters;
+
+
+
+ // Special output routines for complex numbers
+
+#ifdef HAVE_CCTK_COMPLEX8
+ ostream& operator<< (ostream& os, const CCTK_COMPLEX8& val)
+ {
+ int const w = os.width();
+ os << CCTK_Cmplx8Real(val);
+ os << " ";
+ os.width(w);
+ os << CCTK_Cmplx8Imag(val);
+ return os;
+ }
+#endif
+
+#ifdef HAVE_CCTK_COMPLEX16
+ ostream& operator<< (ostream& os, const CCTK_COMPLEX16& val)
+ {
+ int const w = os.width();
+ os << CCTK_Cmplx16Real(val);
+ os << " ";
+ os.width(w);
+ os << CCTK_Cmplx16Imag(val);
+ return os;
+ }
+#endif
+
+#ifdef HAVE_CCTK_COMPLEX32
+ ostream& operator<< (ostream& os, const CCTK_COMPLEX32& val)
+ {
+ int const w = os.width();
+ os << CCTK_Cmplx32Real(val);
+ os << " ";
+ os.width(w);
+ os << CCTK_Cmplx32Imag(val);
+ return os;
+ }
+#endif
+
+
+
+ extern "C" void
+ CarpetIOBasicStartup ()
+ {
+ CCTK_RegisterBanner ("AMR info I/O provided by CarpetIOBasic");
+
+ int GHExtension = CCTK_RegisterGHExtension("CarpetIOBasic");
+ CCTK_RegisterGHExtensionSetupGH (GHExtension, SetupGH);
+
+ int IOMethod = CCTK_RegisterIOMethod ("CarpetIOBasic");
+ CCTK_RegisterIOMethodOutputGH (IOMethod, OutputGH);
+ }
+
+
+
+ extern "C" void
+ CarpetIOBasicInit (CCTK_ARGUMENTS)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+
+ *this_iteration = 0;
+ *last_output_iteration = 0;
+ *last_output_time = cctkGH->cctk_time;
+ }
+
+
+
+ void*
+ SetupGH (tFleshConfig* const fc, int const convLevel, cGH* const cctkGH)
+ {
+ DECLARE_CCTK_PARAMETERS;
+ const void *dummy;
+
+ dummy = &fc;
+ dummy = &convLevel;
+ dummy = &cctkGH;
+ dummy = &dummy;
+
+ // Truncate all files if this is not a restart
+ const int numvars = CCTK_NumVars ();
+ output_count = 0;
+
+ // No iterations have yet been output
+ last_output = -1;
+
+ IOparameters.requests = (ioRequest **) calloc (numvars, sizeof(ioRequest*));
+ IOparameters.out_vars = strdup ("");
+
+ // initial I/O parameter check
+ IOparameters.stop_on_parse_errors = strict_io_parameter_check;
+ CheckSteerableParameters (cctkGH);
+ IOparameters.stop_on_parse_errors = 0;
+
+ // We register only once, ergo we get only one handle. We store
+ // that statically, so there is no need to pass anything to
+ // Cactus.
+ return NULL;
+ }
+
+
+
+ int
+ OutputGH (const cGH * const cctkGH)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ if (TimeToOutput (cctkGH)) {
+
+ int oldprec;
+ ios_base::fmtflags oldflags;
+ if (CCTK_MyProc(cctkGH) == 0) {
+ oldprec = cout.precision();
+ oldflags = cout.flags();
+ }
+
+ if (output_count ++ % 20 == 0) {
+ // Print the header
+ OutputHeader (cctkGH);
+ }
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+ cout << setw(iter_width) << setfill(' ') << cctk_iteration
+ << " "
+ << setw(time_width) << setfill(' ')
+ << fixed << setprecision(time_prec) << cctk_time;
+ }
+
+ int const numvars = CCTK_NumVars();
+ for (int vindex=0; vindex<numvars; ++vindex) {
+ if (IOparameters.requests[vindex]) {
+ OutputVar (cctkGH, vindex);
+ }
+ }
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+ cout << endl << flush;
+ }
+
+ last_output = cctk_iteration;
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+ cout.precision (oldprec);
+ cout.setf (oldflags);
+ }
+
+ } // if time to output
+
+ return 0;
+ }
+
+
+
+ void
+ OutputHeader (const cGH * const cctkGH)
+ {
+ DECLARE_CCTK_PARAMETERS;
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+
+ // Find the set of desired reductions
+ vector<string> const reductions = ParseReductions (outInfo_reductions);
+ int const numreds = reductions.size();
+
+ int const numvars = CCTK_NumVars();
+
+ // The header consists of four lines:
+ // pass 0: print separator
+ // pass 1: print variable name
+ // pass 2: print reduction operation
+ // pass 3: print separator
+ for (int pass=0; pass<4; ++pass) {
+
+ // Print iteration and time
+ switch (pass) {
+ case 0:
+ case 3:
+ cout << "-------------------";
+ break;
+ case 1:
+ cout << "Iteration Time";
+ break;
+ case 2:
+ cout << " ";
+ break;
+ default:
+ assert (0);
+ }
+
+ // Loop over all variables that should be output
+ for (int vindex=0; vindex<numvars; ++vindex) {
+ if (IOparameters.requests[vindex]) {
+
+ bool isint;
+ int numcomps;
+ bool isscalar;
+ ExamineVariable (vindex, isint, numcomps, isscalar);
+
+ char * cfullname = CCTK_FullName (vindex);
+ string const fullname (cfullname);
+ free (cfullname);
+
+ // Print a vertical separator
+ switch (pass) {
+ case 0:
+ case 3:
+ cout << "--";
+ break;
+ case 1:
+ case 2:
+ cout << " |";
+ break;
+ default:
+ assert (0);
+ }
+
+ int const width = isint ? int_width : real_width;
+
+ int const mynumreds = isscalar ? 1 : numreds;
+
+ // Print the entry
+ switch (pass) {
+ case 0:
+ case 3:
+ {
+ size_t const numchars = (width+1)*numcomps*numreds;
+ cout << setw(numchars) << setfill('-') << "";
+ }
+ break;
+ case 1:
+ {
+ size_t const numchars = (width+1)*numcomps*numreds-1;
+ if (fullname.length() > numchars) {
+ int begin = fullname.length() - (numchars-1);
+ cout << " *" << fullname.substr(begin);
+ } else {
+ cout << " " << setw(numchars) << setfill(' ') << fullname;
+ }
+ }
+ break;
+ case 2:
+ if (isscalar) {
+ int const numchars = (width+1)*numcomps;
+ cout << setw(numchars) << setfill(' ') << "";
+ } else {
+ for (int red=0; red<mynumreds; ++red) {
+ int const numchars = (width+1)*numcomps-1;
+ cout << " " << setw(numchars) << setfill(' ')
+ << reductions.at(red).substr(0,numchars);
+ }
+ }
+ break;
+ default:
+ assert (0);
+ }
+
+ } // if want output
+ } // for vindex
+
+ cout << endl;
+
+ } // pass
+
+ } // if on root processor
+ }
+
+
+
+ void
+ OutputVar (const cGH * const cctkGH,
+ int const n)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ assert (is_level_mode());
+
+ const int group = CCTK_GroupIndexFromVarI (n);
+ assert (group>=0 and group<(int)Carpet::arrdata.size());
+ const int n0 = CCTK_FirstVarIndexI(group);
+ assert (n0>=0 and n0<CCTK_NumVars());
+ const int var = n - n0;
+ assert (var>=0 and var<CCTK_NumVarsInGroupI(group));
+ const int num_tl = CCTK_NumTimeLevelsFromVarI(n);
+ assert (num_tl>=1);
+
+ // Check for storage
+ if (not CCTK_QueryGroupStorageI(cctkGH, group)) {
+ char * fullname = CCTK_FullName (n);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot output variable \"%s\" because it has no storage",
+ fullname);
+ free (fullname);
+ }
+
+ assert (do_global_mode);
+
+ const int vartype = CCTK_VarTypeI(n);
+ assert (vartype >= 0);
+
+ // Get grid hierarchy extentsion from IOUtil
+ const ioGH * const iogh = (const ioGH *)CCTK_GHExtension (cctkGH, "IO");
+ assert (iogh);
+
+ // Find the set of desired reductions
+ vector<string> const reductionstrings
+ = ParseReductions (outInfo_reductions);
+ list<info> reductions;
+ for (vector<string>::const_iterator ireduction = reductionstrings.begin();
+ ireduction != reductionstrings.end();
+ ++ireduction)
+ {
+ int const handle = CCTK_ReductionHandle ((*ireduction).c_str());
+ if (handle < 0) {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Reduction operator \"%s\" does not exist (maybe there is no reduction thorn active?)",
+ (*ireduction).c_str());
+ } else {
+ info i;
+ i.reduction = * ireduction;
+ i.handle = handle;
+ reductions.push_back (i);
+ }
+ }
+
+ bool isint;
+ int numcomps;
+ bool isscalar;
+ ExamineVariable (n, isint, numcomps, isscalar);
+
+ // Output in global mode
+ BEGIN_GLOBAL_MODE(cctkGH) {
+
+ // Print vertical separator
+ if (CCTK_MyProc(cctkGH) == 0) {
+ cout << " |";
+ }
+
+ if (isscalar) {
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+
+ cout << " ";
+ if (isint) {
+ cout << setw(int_width);
+ } else {
+ cout << setw(real_width) << fixed << setprecision(real_prec);
+ }
+
+ void const * const vardataptr = CCTK_VarDataPtrI (cctkGH, 0, n);
+ assert (vardataptr);
+
+ switch (vartype) {
+#define TYPECASE(N,T) \
+ case N: \
+ cout << * static_cast <T const *> (vardataptr); \
+ break;
+#include "carpet_typecase.hh"
+#undef TYPECASE
+ default:
+ UnsupportedVarType (n);
+ }
+
+ } // if on root processor
+
+ } else {
+
+ for (list<info>::const_iterator ireduction = reductions.begin();
+ ireduction != reductions.end();
+ ++ireduction)
+ {
+ string const reduction = ireduction->reduction;
+
+ int const handle = ireduction->handle;
+
+ union {
+#define TYPECASE(N,T) T var_##T;
+#include "carpet_typecase.hh"
+#undef TYPECASE
+ } result;
+
+ int const ierr
+ = CCTK_Reduce (cctkGH, 0, handle, 1, vartype, &result, 1, n);
+ assert (not ierr);
+
+ if (CCTK_MyProc(cctkGH) == 0) {
+
+ cout << " ";
+ if (isint) {
+ cout << setw(int_width);
+ } else {
+ cout << setw(real_width) << fixed << setprecision(real_prec);
+ }
+
+ switch (vartype) {
+#define TYPECASE(N,T) \
+ case N: \
+ cout << result.var_##T; \
+ break;
+#include "carpet_typecase.hh"
+#undef TYPECASE
+ default:
+ UnsupportedVarType (n);
+ }
+
+ } // if on root processor
+
+ } // for reductions
+
+ } // not isscalar
+
+ } END_GLOBAL_MODE;
+ }
+
+
+
+ bool
+ TimeToOutput (const cGH * const cctkGH)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ if (not do_global_mode) return false;
+
+ CheckSteerableParameters (cctkGH);
+
+ // check if output for any variable was requested
+ bool do_output = false;
+ int const numvars = CCTK_NumVars();
+ for (int vindex=0; vindex<numvars; ++vindex) {
+ do_output = do_output or IOparameters.requests[vindex];
+ }
+ if (not do_output) return false;
+
+ // check whether to output at this iteration
+ bool output_this_iteration;
+
+ const char* myoutcriterion = outInfo_criterion;
+ if (CCTK_EQUALS(myoutcriterion, "default")) {
+ myoutcriterion = out_criterion;
+ }
+
+ if (CCTK_EQUALS (myoutcriterion, "never")) {
+
+ // Never output
+ output_this_iteration = false;
+
+ } else if (CCTK_EQUALS (myoutcriterion, "iteration")) {
+
+ int myoutevery = outInfo_every;
+ if (myoutevery == -2) {
+ myoutevery = out_every;
+ }
+ if (myoutevery <= 0) {
+ // output is disabled
+ output_this_iteration = false;
+ } else if (cctk_iteration == *this_iteration) {
+ // we already decided to output this iteration
+ output_this_iteration = true;
+ } else if (cctk_iteration >= *last_output_iteration + myoutevery) {
+ // it is time for the next output
+ output_this_iteration = true;
+ *last_output_iteration = cctk_iteration;
+ *this_iteration = cctk_iteration;
+ } else {
+ // we want no output at this iteration
+ output_this_iteration = false;
+ }
+
+ } else if (CCTK_EQUALS (myoutcriterion, "time")) {
+
+ CCTK_REAL myoutdt = outInfo_dt;
+ if (myoutdt == -2) {
+ myoutdt = out_dt;
+ }
+ if (myoutdt < 0) {
+ // output is disabled
+ output_this_iteration = false;
+ } else if (myoutdt == 0) {
+ // output all iterations
+ output_this_iteration = true;
+ } else if (cctk_iteration == *this_iteration) {
+ // we already decided to output this iteration
+ output_this_iteration = true;
+ } else if (cctk_time / cctk_delta_time
+ >= (*last_output_time + myoutdt) / cctk_delta_time - 1.0e-12) {
+ // it is time for the next output
+ output_this_iteration = true;
+ *last_output_time = cctk_time;
+ *this_iteration = cctk_iteration;
+ } else {
+ // we want no output at this iteration
+ output_this_iteration = false;
+ }
+
+ } else {
+
+ assert (0);
+
+ } // select output criterion
+
+ if (not output_this_iteration) return false;
+
+
+
+ assert (last_output != cctk_iteration);
+
+ assert (last_output < cctk_iteration);
+
+ // Should be output during this iteration
+ return true;
+ }
+
+
+
+ void
+ CheckSteerableParameters (const cGH *const cctkGH)
+ {
+ DECLARE_CCTK_PARAMETERS;
+
+ // re-parse the 'IOBasic::outInfo_vars' parameter if it has changed
+ if (strcmp (outInfo_vars, IOparameters.out_vars)) {
+ IOUtil_ParseVarsForOutput (cctkGH, CCTK_THORNSTRING,
+ "IOBasic::outInfo_vars",
+ IOparameters.stop_on_parse_errors,
+ outInfo_vars, -1, IOparameters.requests);
+
+ // save the last setting of 'IOBasic::outInfo_vars' parameter
+ free (IOparameters.out_vars);
+ IOparameters.out_vars = strdup (outInfo_vars);
+ }
+ }
+
+
+
+ // Parse the set of reductions
+ vector<string>
+ ParseReductions (char const * const credlist)
+ {
+ string const redlist (credlist);
+ vector<string> reductions;
+ string::const_iterator p = redlist.begin();
+ while (p!=redlist.end()) {
+ // Skip white space
+ while (p!=redlist.end() and isspace(*p)) ++p;
+ // Exit if end of reductions is reached
+ if (p==redlist.end()) break;
+ // Mark beginning of reduction entry
+ string::const_iterator const start = p;
+ // Walk over reduction entry
+ while (p!=redlist.end() and not isspace(*p)) ++p;
+ // Mark end of reduction entry
+ string::const_iterator const end = p;
+ // Remember reduction
+ string const reduction (start, end);
+ reductions.push_back (reduction);
+ }
+ return reductions;
+ }
+
+
+
+ void
+ ExamineVariable (int const vindex,
+ bool & isint, int & numcomps, bool & isscalar)
+ {
+ switch (CCTK_VarTypeI (vindex)) {
+ case CCTK_VARIABLE_BYTE:
+ case CCTK_VARIABLE_INT:
+ case CCTK_VARIABLE_INT1:
+ case CCTK_VARIABLE_INT2:
+ case CCTK_VARIABLE_INT4:
+ case CCTK_VARIABLE_INT8:
+ isint = true;
+ numcomps = 1;
+ break;
+ case CCTK_VARIABLE_REAL:
+ case CCTK_VARIABLE_REAL4:
+ case CCTK_VARIABLE_REAL8:
+ case CCTK_VARIABLE_REAL16:
+ isint = false;
+ numcomps = 1;
+ break;
+ case CCTK_VARIABLE_COMPLEX:
+ case CCTK_VARIABLE_COMPLEX8:
+ case CCTK_VARIABLE_COMPLEX16:
+ case CCTK_VARIABLE_COMPLEX32:
+ isint = false;
+ numcomps = 2;
+ break;
+ default:
+ assert (0);
+ }
+
+ switch (CCTK_GroupTypeFromVarI (vindex)) {
+ case CCTK_SCALAR:
+ isscalar = true;
+ break;
+ case CCTK_ARRAY:
+ case CCTK_GF:
+ isscalar = false;
+ break;
+ default:
+ assert (0);
+ }
+ }
+
+} // namespace CarpetIOBasic
diff --git a/Carpet/CarpetIOBasic/src/make.code.defn b/Carpet/CarpetIOBasic/src/make.code.defn
new file mode 100644
index 000000000..606bbea29
--- /dev/null
+++ b/Carpet/CarpetIOBasic/src/make.code.defn
@@ -0,0 +1,8 @@
+# Main make.code.defn file for thorn CarpetIOBasic
+# $Header:$
+
+# Source files in this directory
+SRCS = iobasic.cc
+
+# Subdirectories containing source files
+SUBDIRS =