@@ -167,6 +167,14 @@ void ArbLattice::readFromCxn(const std::string& cxn_path) {
167167 file >> grid_size;
168168 check_file_ok (" Failed to read section: GRID_SIZE" );
169169
170+ // Total region
171+ file >> word;
172+ check_file_ok (" Failed to read section header: TOTAL_REGION" );
173+ check_expected_word (" TOTAL_REGION" , word);
174+ int nx, ny, nz;
175+ file >> nx >> ny >> nz;
176+ check_file_ok (" Failed to read section: TOTAL_REGION" );
177+
170178 // Labels present in the .cxn file
171179 const auto labels = process_section (" NODE_LABELS" , [&file](size_t n_labels) {
172180 std::vector<std::string> retval (n_labels);
@@ -177,24 +185,30 @@ void ArbLattice::readFromCxn(const std::string& cxn_path) {
177185
178186 // Nodes header
179187 process_section (" NODES" , [&](size_t num_nodes_global) {
180- // Compute the current rank's offset and number of nodes to read
188+ // Compute the current ranks offset and number of nodes to read
181189 const auto chunk_offsets = computeInitialNodeDist (num_nodes_global, static_cast <size_t >(comm_size));
182190 const auto chunk_begin = static_cast <size_t >(chunk_offsets[comm_rank]), chunk_end = static_cast <size_t >(chunk_offsets[comm_rank + 1 ]);
183191 const auto num_nodes_local = chunk_end - chunk_begin;
184192
185193 connect = ArbLatticeConnectivity (chunk_begin, chunk_end, num_nodes_global, Q);
186194 connect.grid_size = grid_size;
195+ connect.nx = nx;
196+ connect.ny = ny;
197+ connect.nz = nz;
187198
188199 // Skip chunk_begin + 1 (header) newlines
189200 for (size_t i = 0 ; i != chunk_begin + 1 ; ++i) file.ignore (std::numeric_limits<std::streamsize>::max (), ' \n ' );
190- check_file_ok (" Failed to skip ahead to this rank's chunk" );
201+ check_file_ok (" Failed to skip ahead to this ranks chunk" );
191202
192203 // Parse node data
193204 std::vector<long > nbrs_in_file (q_provided.size ());
194205 for (size_t local_node_ind = 0 ; local_node_ind != num_nodes_local; ++local_node_ind) {
195206 // Read coords
196207 file >> connect.coord (0 , local_node_ind) >> connect.coord (1 , local_node_ind) >> connect.coord (2 , local_node_ind);
197208
209+ // Read cartesian index
210+ file >> connect.cartesian_ind (local_node_ind);
211+
198212 // Read neighbors, map to local (required) ones
199213 for (auto & nbr : nbrs_in_file) file >> nbr;
200214 size_t j = 0 ;
0 commit comments