From 77c63671c5e3b2d51c9ff22891dc1e64ffd9452f Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Thu, 4 Apr 2013 11:38:08 +0200 Subject: Requirements: Move location class to a separate file --- Carpet/Requirements/src/Requirements.cc | 29 ++--------------------------- Carpet/Requirements/src/location.cc | 13 +++++++++++++ Carpet/Requirements/src/location.hh | 30 ++++++++++++++++++++++++++++++ Carpet/Requirements/src/make.code.defn | 2 +- 4 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 Carpet/Requirements/src/location.cc create mode 100644 Carpet/Requirements/src/location.hh (limited to 'Carpet/Requirements') diff --git a/Carpet/Requirements/src/Requirements.cc b/Carpet/Requirements/src/Requirements.cc index 19a67f9fd..538c96188 100644 --- a/Carpet/Requirements/src/Requirements.cc +++ b/Carpet/Requirements/src/Requirements.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include using namespace std; @@ -53,33 +54,7 @@ namespace Requirements { bool there_was_an_error = false; bool there_was_a_warning = false; - // Struct defining a location of a grid point - struct location_t { - int it, vi, tl, rl, m; - char const* info; - location_t(): - it(-1), vi(-1), tl(-1), rl(-1), m(-1), info("") - {} - location_t(int _it, int _vi, int _tl, int _rl, int _m, char const* _info): - it(_it), vi(_vi), tl(_tl), rl(_rl), m(_m), info(_info) - {} - // Output helper - void output (ostream& os) const; - }; - - inline ostream& operator<< (ostream& os, const location_t& a) { - a.output(os); - return os; - } - - void location_t::output(ostream& os) const - { - os << "vi:" << vi << ",it:" << it << ", "; - os << "[rl:" << rl << ","; - os << "tl:" << tl << ","; - os << "m:" << m << "]"; - } - + // Represents which have valid information and which do not. // This will later be indexed by rl, map etc. // Currently only works with unigrid. diff --git a/Carpet/Requirements/src/location.cc b/Carpet/Requirements/src/location.cc new file mode 100644 index 000000000..d4c8aef4d --- /dev/null +++ b/Carpet/Requirements/src/location.cc @@ -0,0 +1,13 @@ +#include +#include + +namespace Requirements { + + void location_t::output(ostream& os) const + { + os << "vi:" << vi << ",it:" << it << ", "; + os << "[rl:" << rl << ","; + os << "tl:" << tl << ","; + os << "m:" << m << "]"; + } +} diff --git a/Carpet/Requirements/src/location.hh b/Carpet/Requirements/src/location.hh new file mode 100644 index 000000000..3ee79cd01 --- /dev/null +++ b/Carpet/Requirements/src/location.hh @@ -0,0 +1,30 @@ +#ifndef LOCATION_HH +#define LOCATION_HH + +#include + +namespace Requirements { + + using namespace std; + + // Struct defining a location of a grid point + struct location_t { + int it, vi, tl, rl, m; + char const* info; + location_t(): + it(-1), vi(-1), tl(-1), rl(-1), m(-1), info("") + {} + location_t(int _it, int _vi, int _tl, int _rl, int _m, char const* _info): + it(_it), vi(_vi), tl(_tl), rl(_rl), m(_m), info(_info) + {} + // Output helper + void output (ostream& os) const; + }; + + inline ostream& operator<< (ostream& os, const location_t& a) { + a.output(os); + return os; + } +} + +#endif diff --git a/Carpet/Requirements/src/make.code.defn b/Carpet/Requirements/src/make.code.defn index d2197a8d8..e9acc3f35 100644 --- a/Carpet/Requirements/src/make.code.defn +++ b/Carpet/Requirements/src/make.code.defn @@ -1,7 +1,7 @@ # Main make.code.defn file for thorn Requirements -*-Makefile-*- # Source files in this directory -SRCS = Requirements.cc clause.cc clauses.cc util.cc all_clauses.cc +SRCS = Requirements.cc clause.cc clauses.cc util.cc all_clauses.cc location.cc # Subdirectories containing source files SUBDIRS = -- cgit v1.2.3