1
0
Fork 0

- add --shared-dir option to get ready for new tile matching

and make it easier to share work and data dirs on a server
This commit is contained in:
Peter Sadrozinski 2012-09-05 21:06:43 -04:00 committed by Christian Schmitt
parent 916544f4fe
commit 3b2dfba225
4 changed files with 25 additions and 10 deletions

View file

@ -1734,9 +1734,9 @@ void TGConstruct::CalcPointNormals( void )
void TGConstruct::LoadSharedEdgeData( void )
{
match.load_neighbor_shared( bucket, work_base );
match.load_neighbor_shared( bucket, share_base );
if ( useOwnSharedEdges ) {
match.load_missing_shared( bucket, work_base );
match.load_missing_shared( bucket, share_base );
}
match.add_shared_nodes( this );
}
@ -1749,7 +1749,7 @@ void TGConstruct::SaveSharedEdgeData( void )
if ( writeSharedEdges ) {
SG_LOG(SG_GENERAL, SG_ALERT, "write shared edges");
match.write_shared( bucket, work_base );
match.write_shared( bucket, share_base );
}
}

View file

@ -245,6 +245,7 @@ private:
// paths
std::string work_base;
std::string output_base;
std::string share_base;
std::vector<std::string> load_dirs;
@ -383,6 +384,8 @@ public:
inline void set_work_base( const std::string s ) { work_base = s; }
inline std::string get_output_base() const { return output_base; }
inline void set_output_base( const std::string s ) { output_base = s; }
inline std::string get_share_base() const { return share_base; }
inline void set_share_base( const std::string s ) { share_base = s; }
inline void set_load_dirs( const std::vector<std::string> ld ) { load_dirs = ld; }
// UK grid flag

View file

@ -156,6 +156,7 @@ static void usage( const string name ) {
int main(int argc, char **argv) {
string output_dir = ".";
string work_dir = ".";
string share_dir = "";
string cover = "";
string priorities_file = DEFAULT_PRIORITIES_FILE;
string usgs_map_file = DEFAULT_USGS_MAPFILE;
@ -198,6 +199,8 @@ int main(int argc, char **argv) {
output_dir = arg.substr(13);
} else if (arg.find("--work-dir=") == 0) {
work_dir = arg.substr(11);
} else if (arg.find("--share-dir=") == 0) {
share_dir = arg.substr(12);
} else if (arg.find("--tile-id=") == 0) {
tile_id = atol(arg.substr(10).c_str());
} else if (arg.find("--lon=") == 0) {
@ -235,8 +238,13 @@ int main(int argc, char **argv) {
}
}
if ( share_dir == "" ) {
share_dir = work_dir + "/Shared";
}
SG_LOG(SG_GENERAL, SG_ALERT, "Output directory is " << output_dir);
SG_LOG(SG_GENERAL, SG_ALERT, "Working directory is " << work_dir);
SG_LOG(SG_GENERAL, SG_ALERT, "Shared directory is " << share_dir);
if ( tile_id > 0 ) {
SG_LOG(SG_GENERAL, SG_ALERT, "Tile id is " << tile_id);
} else {
@ -274,6 +282,7 @@ int main(int argc, char **argv) {
c->set_cover( cover );
c->set_work_base( work_dir );
c->set_output_base( output_dir );
c->set_share_base( share_dir );
c->set_load_dirs( load_dirs );
c->set_useUKGrid( useUKgrid );
c->set_write_shared_edges( writeSharedEdges );
@ -302,6 +311,7 @@ int main(int argc, char **argv) {
c->set_cover( cover );
c->set_work_base( work_dir );
c->set_output_base( output_dir );
c->set_share_base( share_dir );
c->set_load_dirs( load_dirs );
c->set_useUKGrid( useUKgrid );
c->set_write_shared_edges( writeSharedEdges );
@ -335,6 +345,7 @@ int main(int argc, char **argv) {
c->set_cover( cover );
c->set_work_base( work_dir );
c->set_output_base( output_dir );
c->set_share_base( share_dir );
c->set_load_dirs( load_dirs );
c->set_useUKGrid( useUKgrid );
c->set_write_shared_edges( writeSharedEdges );
@ -363,6 +374,7 @@ int main(int argc, char **argv) {
c->set_cover( cover );
c->set_work_base( work_dir );
c->set_output_base( output_dir );
c->set_share_base( share_dir );
c->set_load_dirs( load_dirs );
c->set_useUKGrid( useUKgrid );
c->set_write_shared_edges( writeSharedEdges );

View file

@ -202,10 +202,10 @@ void TGMatch::load_shared( SGBucket b, string base, neighbor_type n ) {
// load any previously existing shared data from all neighbors (if
// shared data for a component exists set that components flag to true
void TGMatch::load_neighbor_shared( SGBucket b, string work ) {
void TGMatch::load_neighbor_shared( SGBucket b, string share_dir ) {
// cout << "Loading existing shared data from neighbor tiles" << endl;
string base = work + "/Shared/";
string base = share_dir + "/";
// start with all flags false
sw_flag = se_flag = ne_flag = nw_flag = false;
@ -272,8 +272,8 @@ void TGMatch::load_neighbor_shared( SGBucket b, string work ) {
}
// try to load any missing shared data from our own shared data file
void TGMatch::load_missing_shared( SGBucket b, string work ) {
string base = work + "/Shared/";
void TGMatch::load_missing_shared( SGBucket b, string share ) {
string base = share + "/";
if ( !nw_flag ) {
scan_share_file( base, b, NW_Corner, NW_Corner );
@ -505,10 +505,10 @@ void TGMatch::split_tile( SGBucket b, TGConstruct* c ) {
// write the new shared edge points, normals, and segments for this
// tile
void TGMatch::write_shared( SGBucket b, string base ) {
void TGMatch::write_shared( SGBucket b, string shared ) {
string dir = base + "/Shared/" + b.gen_base_path();
string file = dir + "/" + b.gen_index_str();
string dir = shared + "/" + b.gen_base_path();
string file = dir + "/" + b.gen_index_str();
SGPath sgp( dir );
sgp.append( "dummy" );