generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parallel run with one proc w/o partition file
- Loading branch information
Showing
4 changed files
with
116 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef PARTITION_DATA_H | ||
#define PARTITION_DATA_H | ||
|
||
using Tuple = std::tuple<int, std::string, std::string, std::string>; | ||
|
||
struct PartitionData | ||
{ | ||
int mpi_world_rank; | ||
std::unordered_set<std::string> catchment_ids; | ||
std::unordered_set<std::string> nexus_ids; | ||
std::vector<Tuple> remote_connections; | ||
}; | ||
|
||
#endif //PARTITION_DATA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef PARTITION_ONE_H | ||
#define PARTITION_ONE_H | ||
|
||
#ifdef NGEN_MPI_ACTIVE | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
#include <unordered_set> | ||
#include <FeatureBuilder.hpp> | ||
#include "features/Features.hpp" | ||
#include <FeatureCollection.hpp> | ||
#include "Partition_Data.hpp" | ||
|
||
class Partition_One { | ||
|
||
public: | ||
Partition_One() {}; | ||
|
||
void generate_partition(geojson::GeoJSON& catchment_collection) | ||
{ | ||
int counter = 0; | ||
for(auto& feature: *catchment_collection) | ||
{ | ||
std::string cat_id = feature->get_id(); | ||
catchment_ids.emplace(cat_id); | ||
std::string nex_id = feature->get_property("toid").as_string(); | ||
nexus_ids.emplace(nex_id); | ||
counter++; | ||
} | ||
std::cout << "counter = " << counter << std::endl; | ||
} | ||
|
||
virtual ~Partition_One(){}; | ||
|
||
PartitionData partition_data; | ||
|
||
private: | ||
int mpi_world_rank; | ||
std::unordered_set<std::string> catchment_ids; | ||
std::unordered_set<std::string> nexus_ids; | ||
std::vector<Tuple> remote_connections; | ||
}; | ||
|
||
#endif // NGEN_MPI_ACTIVE | ||
#endif // PARTITION_ONE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters