Skip to content

Commit 22d2d0c

Browse files
committed
try fix windows bug 0016...
1 parent 0a945ad commit 22d2d0c

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

source/world_builder/parameters.cc

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -794,40 +794,41 @@ namespace WorldBuilder
794794
constexpr int n1 = 40; //962;
795795
constexpr int n_layers = 9;
796796

797-
float depth_data[n1 * n_layers];
798-
char tessfile[255];
797+
float depth_data[n1 * n_layers] = {0};
798+
std::cout << depth_data[0] << std::endl;
799+
/*char tessfile[255];
799800
snprintf(tessfile, 254, "%s/litho_depth_data.bin", litho_1_0_path.c_str());
800-
/*
801-
FILE *fptrb = nullptr;
802-
if ((fptrb = fopen(tessfile, "rb")) == nullptr)
803-
{
804-
WBAssertThrow(false, "ERROR: Could not open file " << tessfile);
805-
}
806-
const size_t ret_code = fread(&depth_data, sizeof(float), n1 * n_layers, fptrb);
807-
WBAssertThrow(ret_code == n1 * n_layers, "Error in reading the Litho1.0 data.");
808-
fclose(fptrb);
809-
810-
snprintf(tessfile, 254, "%s/Icosahedron_Level7_LatLon_mod.txt",
811-
litho_1_0_path.c_str());
812-
FILE *fp = nullptr;
813-
if ((fp = fopen(tessfile, "r")) == nullptr)
814-
{
815-
WBAssertThrow(false, "ERROR: Could not open file " << tessfile);
816-
}
817801
818-
size_t counter_location_data = 0;
819-
float latitude, glatitude, longitude = 0;
820-
while (fscanf(fp, "%f %f %f", &latitude, &glatitude, &longitude) != EOF)
821-
{
822-
const size_t global_index = (counter_location_data/2)*n_layers+static_cast<size_t> (layer_type);
823-
result.first.emplace_back(depth_data[global_index]);
824-
result.second.emplace_back(longitude * Consts::PI / 180.);
825-
result.second.emplace_back(latitude * Consts::PI / 180.);
826-
counter_location_data += 2;
827-
}
802+
FILE *fptrb = nullptr;
803+
if ((fptrb = fopen(tessfile, "rb")) == nullptr)
804+
{
805+
WBAssertThrow(false, "ERROR: Could not open file " << tessfile);
806+
}
807+
const size_t ret_code = fread(&depth_data, sizeof(float), n1 * n_layers, fptrb);
808+
WBAssertThrow(ret_code == n1 * n_layers, "Error in reading the Litho1.0 data.");
809+
fclose(fptrb);
810+
811+
snprintf(tessfile, 254, "%s/Icosahedron_Level7_LatLon_mod.txt",
812+
litho_1_0_path.c_str());
813+
FILE *fp = nullptr;
814+
if ((fp = fopen(tessfile, "r")) == nullptr)
815+
{
816+
WBAssertThrow(false, "ERROR: Could not open file " << tessfile);
817+
}
818+
819+
size_t counter_location_data = 0;
820+
float latitude, glatitude, longitude = 0;
821+
while (fscanf(fp, "%f %f %f", &latitude, &glatitude, &longitude) != EOF)
822+
{
823+
const size_t global_index = (counter_location_data/2)*n_layers+static_cast<size_t> (layer_type);
824+
result.first.emplace_back(depth_data[global_index]);
825+
result.second.emplace_back(longitude * Consts::PI / 180.);
826+
result.second.emplace_back(latitude * Consts::PI / 180.);
827+
counter_location_data += 2;
828+
}
828829
829-
fclose(fp);
830-
*/
830+
fclose(fp);
831+
*/
831832
}
832833
else
833834
{

0 commit comments

Comments
 (0)