Skip to content

Commit

Permalink
Adress comment Timo and change int to size_t in changes from Geodynam…
Browse files Browse the repository at this point in the history
  • Loading branch information
MFraters committed Jun 8, 2024
1 parent 75a6018 commit a6787fe
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions source/world_builder/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ namespace WorldBuilder
MPI_Comm_rank(comm, &my_rank);
if (my_rank == 0)
{
uint64_t filesize;
int filesize;
std::ifstream filestream;
filestream.open(filename.c_str());
WBAssertThrow (filestream.is_open(), std::string("Could not open file <") + filename + ">.");
Expand Down Expand Up @@ -1217,8 +1217,8 @@ namespace WorldBuilder
}

data_string = datastream.str();
filesize = data_string.size();
WBAssertThrow(filesize < std::numeric_limits<uint64_t>::max(),
filesize = static_cast<int>(data_string.size());
WBAssertThrow(filesize < std::numeric_limits<int>::max(),
"File to large to be send with MPI.");

// Distribute data_size and data across processes
Expand All @@ -1227,7 +1227,7 @@ namespace WorldBuilder

// Receive and store data
ierr = MPI_Bcast(&data_string[0],
static_cast<int>(filesize),
filesize,
MPI_CHAR,
0,
comm);
Expand Down Expand Up @@ -1510,12 +1510,12 @@ namespace WorldBuilder
multiply_3x3_matrices(const std::array<std::array<double,3>,3> mat1, const std::array<std::array<double,3>,3> mat2)
{
std::array<std::array<double,3>,3> result;
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
for (size_t j = 0; j < 3; j++)
{
result[i][j] = 0;
for (int k = 0; k < 3; k++)
for (size_t k = 0; k < 3; k++)
{
result[i][j] += mat1[i][k] * mat2[k][j];
}
Expand Down

0 comments on commit a6787fe

Please sign in to comment.