Skip to content

Commit a29b11d

Browse files
authored
Merge pull request #17 from MikeHeiber/bugfix-tomogram-import-mixed-phase
Tomogram Import Bugfix and Compiler Warning Cleanup
2 parents 74bc697 + 51da0c3 commit a29b11d

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Added
1414
- README.md - Link to JOSS paper
15+
- Morphology (executeIsingSwapping) - Cast return of distance function to an int to prevent compiler warning
16+
- Morphology (importTomogramMorphologyFile) - Cast return of ifstream's tellg function to an int to prevent compiler warning
17+
- Utils (vector_which_median) - Cast return of distance function to int to prevent compiler warning
1518

1619
### Changed
1720
- Doxyfile - Updated file input and output paths to relative paths
1821
- Version - Updated Current_version namespace variable to v4.0.1
1922
- Updated Doxygen documentation
23+
- Morphology (calculatePathDistances) - Moved declaration of local z variable near it's first use to prevent potential conflict with other z variable used in a subsequent loop
24+
- main.cpp (main) - Imported morphology filenames now use main's reusable filename string variable
2025

2126
### Fixed
2227
- Morphology (importTomogramMorphologyFile) - Corrected error loading xml metadata files on Windows by telling the fopen function to open the file as a binary file
2328
- Morphology (importTomogramMorphologyFile) - Corrected miscalculation of the extracted sublattice dimensions that was causing some tomogram files not to be imported
29+
- Parameters (importParameters) - Corrected problem importing the Mixed_frac parameter from the parameter file as an integer instead of a double
2430

2531
## [v4.0.0] - 2018-11-29 - Final Release
2632

src/Morphology.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ namespace Ising_OPV {
10471047
}
10481048

10491049
bool Morphology::calculatePathDistances(vector<float>& path_distances) {
1050-
int z;
10511050
Coords coords;
10521051
long int current_index;
10531052
long int neighbor_index;
@@ -1092,6 +1091,7 @@ namespace Ising_OPV {
10921091
}
10931092
}
10941093
// The pathfinding algorithm is performed for one domain type at a time.
1094+
int z;
10951095
for (int n = 0; n < 2; n++) {
10961096
// Use Dijkstra's algorithm to fill in the remaining path distance data.
10971097
cout << ID << ": Executing Dijkstra's algorithm to calculate shortest paths through domain type " << (int)Site_types[n] << ".\n";
@@ -1562,7 +1562,7 @@ namespace Ising_OPV {
15621562
}
15631563
});
15641564
// Select random dissimilar neighbor site
1565-
uniform_int_distribution<int> dist(0, distance(neighbors.begin(), it) - 1);
1565+
uniform_int_distribution<int> dist(0, (int)distance(neighbors.begin(), it) - 1);
15661566
auto selected_it = neighbors.begin();
15671567
advance(selected_it, dist(gen));
15681568
neighbor_site_index = *selected_it;
@@ -1915,7 +1915,7 @@ namespace Ising_OPV {
19151915
throw runtime_error("Error! Tomogram binary RAW file could not be opened.");
19161916
}
19171917
data_file.seekg(0, data_file.end);
1918-
int N_bytes = data_file.tellg();
1918+
int N_bytes = (int)data_file.tellg();
19191919
data_file.seekg(0, data_file.beg);
19201920
vector<float> data_vec;
19211921
if (data_format.compare("8 bit") == 0) {

src/Parameters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ namespace Ising_OPV {
431431
// Error_found = true;
432432
//}
433433
//i++;
434-
Mixed_frac = atoi(stringvars[i].c_str());
434+
Mixed_frac = atof(stringvars[i].c_str());
435435
i++;
436436
Mixed_conc = atof(stringvars[i].c_str());
437437
i++;

src/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ namespace Ising_OPV {
404404
diff[i] = fabs(data[i] - median);
405405
}
406406
auto it = min_element(diff.begin(), diff.end());
407-
return distance(diff.begin(), it);
407+
return (int)distance(diff.begin(), it);
408408
}
409409
}
410410

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main(int argc, char * argv[]) {
136136
MPI_Barrier(MPI_COMM_WORLD);
137137
}
138138
if (parameters.Enable_import_morphologies || parameters.Enable_import_tomogram) {
139-
string filename = "morphology_" + to_string(procid) + ".txt";
139+
filename = "morphology_" + to_string(procid) + ".txt";
140140
cout << procid << ": Opening morphology file " << filename << endl;
141141
morphology_input_file.open(filename);
142142
if (morphology_input_file.is_open()) {

0 commit comments

Comments
 (0)