| 99 | } |
| 100 | |
| 101 | void |
| 102 | BARef::define (std::istream& is, int& ndims) |
| 103 | { |
| 104 | // |
| 105 | // TODO -- completely remove the fiction of a hash value. |
| 106 | // |
| 107 | BL_ASSERT(m_abox.empty()); |
| 108 | int maxbox; |
| 109 | ULong tmphash; |
| 110 | is.ignore(bl_ignore_max, '(') >> maxbox >> tmphash; |
| 111 | AMREX_ASSERT(maxbox >= 0 && maxbox < std::numeric_limits<int>::max()); |
| 112 | resize(maxbox); |
| 113 | auto pos = is.tellg(); |
| 114 | { |
| 115 | ndims = AMREX_SPACEDIM; |
| 116 | char c1, c2; |
| 117 | int itmp; |
| 118 | is >> std::ws >> c1 >> std::ws >> c2; |
| 119 | if (c1 == '(' && c2 == '(') { |
| 120 | is >> itmp; |
| 121 | ndims = 1; |
| 122 | #if (AMREX_SPACEDIM >= 2) |
| 123 | is >> std::ws; |
| 124 | int ic = is.peek(); |
| 125 | if (ic == static_cast<int>(',')) { |
| 126 | is.ignore(BL_IGNORE_MAX, ','); |
| 127 | is >> itmp; |
| 128 | ++ndims; |
| 129 | #if (AMREX_SPACEDIM == 3) |
| 130 | is >> std::ws; |
| 131 | ic = is.peek(); |
| 132 | if (ic == static_cast<int>(',')) { |
| 133 | ++ndims; |
| 134 | } |
| 135 | #endif |
| 136 | } |
| 137 | #endif |
| 138 | } |
| 139 | } |
| 140 | is.seekg(pos, std::ios_base::beg); |
| 141 | for (auto& b : m_abox) { |
| 142 | is >> b; |
| 143 | } |
| 144 | is.ignore(bl_ignore_max, ')'); |
| 145 | if (is.fail()) { |
| 146 | amrex::Error("BoxArray::define(istream&) failed"); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | void |
| 151 | BARef::define (const Box& bx) |