Mercurial > hg > aimc
changeset 160:747ba38b4b1b
- AIMCopy v5 for just smooth NAP features
- Reporting of all modules and versions
author | tomwalters |
---|---|
date | Sun, 11 Jul 2010 03:46:06 +0000 |
parents | 64c3f4e25877 |
children | 0420c86456c1 |
files | SConstruct src/Main/AIMCopy_SSI_Features_v3.cc src/Support/Module.cc src/Support/Module.h |
diffstat | 4 files changed, 40 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/SConstruct Mon Jun 07 08:38:21 2010 +0000 +++ b/SConstruct Sun Jul 11 03:46:06 2010 +0000 @@ -52,7 +52,7 @@ # File which contains main() #sources = common_sources + ['Main/AIMCopy_SSI_Features_v4_PZFC.cc'] -sources = common_sources + ['Main/aimc.cc'] +sources = common_sources + ['Main/AIMCopy_SSI_Features_v5_smooth_nap.cc'] # Test sources test_sources = ['Modules/Profile/ModuleSlice_unittest.cc'] @@ -79,7 +79,8 @@ # Build products location and executable name build_dir = os.path.join('build', target_platform + '-release') -target_executable = 'aimc' +#target_executable = 'aimc' +target_executable = 'AIMCopy' test_executable = 'aimc_tests' # Create build products directory if necessary
--- a/src/Main/AIMCopy_SSI_Features_v3.cc Mon Jun 07 08:38:21 2010 +0000 +++ b/src/Main/AIMCopy_SSI_Features_v3.cc Sun Jul 11 03:46:06 2010 +0000 @@ -71,7 +71,6 @@ string script_file; bool write_data = false; bool print_version = false; - bool load_params = false; string version_string( " AIM-C AIMCopy\n" @@ -108,7 +107,6 @@ return(-1); } config_file = argv[i]; - load_params = true; continue; } if (strcmp(argv[i],"-S") == 0) { @@ -140,12 +138,10 @@ aimc::Parameters params; - if (load_params) { - if (!params.Load(config_file.c_str())) { - aimc::LOG_ERROR(_T("Couldn't load parameters from file %s"), - config_file.c_str()); - return -1; - } + if (!params.Load(config_file.c_str())) { + aimc::LOG_ERROR(_T("Couldn't load parameters from file %s"), + config_file.c_str()); + return -1; } vector<pair<string, string> > file_list = aimc::FileList::Load(script_file); @@ -263,15 +259,15 @@ // aimc::LOG_INFO(_T("In: %s"), file_list[i].first.c_str()); aimc::LOG_INFO(_T("Out: %s"), file_list[i].second.c_str()); - string filename = file_list[i].second + "slice_1_no_cutoff"; + string filename = file_list[i].second + ".slice_1_no_cutoff"; output_ssi_slice1_no_cutoff.OpenFile(filename.c_str(), 10.0f); - filename = file_list[i].second + "ssi_profile_no_cutoff"; + filename = file_list[i].second + ".ssi_profile_no_cutoff"; output_ssi_all_no_cutoff.OpenFile(filename.c_str(), 10.0f); - filename = file_list[i].second + "slice_1_cutoff"; + filename = file_list[i].second + ".slice_1_cutoff"; output_ssi_slice1_cutoff.OpenFile(filename.c_str(), 10.0f); - filename = file_list[i].second + "ssi_profile_cutoff"; + filename = file_list[i].second + ".ssi_profile_cutoff"; output_ssi_all_cutoff.OpenFile(filename.c_str(), 10.0f); - filename = file_list[i].second + "smooth_nap_profile"; + filename = file_list[i].second + ".smooth_nap_profile"; nap_out.OpenFile(filename.c_str(), 10.0f); if (input.LoadFile(file_list[i].first.c_str())) {
--- a/src/Support/Module.cc Mon Jun 07 08:38:21 2010 +0000 +++ b/src/Support/Module.cc Sun Jul 11 03:46:06 2010 +0000 @@ -31,7 +31,6 @@ namespace aimc { using std::pair; using std::ostream; -using std::endl; Module::Module(Parameters *parameters) { initialized_ = false; targets_.clear(); @@ -40,19 +39,13 @@ module_type_ = "MODULE TYPE NOT SET"; module_description_ = "MODULE DESCRIPTION NOT SET"; module_version_ = "MODULE VERSION NOT SET"; - instance_name_ = ""; - done_ = false; }; Module::~Module() { }; -bool Module::Initialize(const SignalBank &input, - Parameters *global_parameters) { - if (global_parameters == NULL) { - return false; - } - global_parameters_ = global_parameters; +bool Module::Initialize(const SignalBank &input) { + // LOG_INFO_NN(_T("-> %s "), module_identifier_.c_str()); // Validate the input if (!input.Validate()) { LOG_ERROR(_T("Input SignalBank not valid")); @@ -64,7 +57,7 @@ return false; } // If the module has an output bank, then we can set up the targets - // of this module. + // of this module.. if (output_.initialized()) { // Check that the output SignalBank has been set up correctly if (!output_.Validate()) { @@ -79,10 +72,12 @@ // this is not checked. set<Module*>::const_iterator it; for (it = targets_.begin(); it != targets_.end(); ++it) { - //if (!(*it)->initialized()) - if (!(*it)->Initialize(output_, global_parameters_)) + if (!(*it)->initialized()) + if (!(*it)->Initialize(output_)) return false; } + } else { + // LOG_INFO(_T("|")); } initialized_ = true; return true; @@ -92,6 +87,7 @@ if (!initialized_) return; + // LOG_INFO("Resetting module %s", module_identifier_.c_str()); ResetInternal(); // Iterate through all the targets of this module, resetting @@ -106,22 +102,12 @@ } bool Module::AddTarget(Module* target_module) { - bool result = false; if (target_module) { pair<set<Module*>::iterator, bool> ret; ret = targets_.insert(target_module); - result = ret.second; - if (result) { - if (initialized_) { - if (output_.initialized()) { - if (!target_module->initialized()) { - target_module->Initialize(output_, global_parameters_); - } - } - } - } + return ret.second; } - return result; + return false; } bool Module::RemoveTarget(Module* target_module) { @@ -147,37 +133,26 @@ } } -void Module::PrintTargetsForDot(ostream &out) { - //string parameters_string = parameters_->WriteString(); - out << " " << instance_name() << " [shape = none, margin = 0, label = <" << endl; - out << " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\"> " << endl; - out << " <TR><TD>" << instance_name() << "</TD></TR><TR><TD>" << id(); - out << "</TD></TR></TABLE>>]" << ";" << endl; - // <TD><TR>" << parameters_string << "</TD></TR> - set<Module*>::const_iterator it; - for (it = targets_.begin(); it != targets_.end(); ++it) { - out << " " << instance_name() << " -> " << (*it)->instance_name() << ";" << endl; - (*it)->PrintTargetsForDot(out); +void Module::PrintTargets(ostream &out) { + out << id(); + if (targets_.size() > 0) { + out << "->("; + set<Module*>::const_iterator it; + for (it = targets_.begin(); it != targets_.end(); ++it) { + (*it)->PrintTargets(out); + if (targets_.size() > 1) { + out << ","; + } + } + out << ")"; } } -void Module::PrintTargets(ostream &out) { +void Module::PrintVersions(ostream &out) { + out << version() << "\n"; set<Module*>::const_iterator it; for (it = targets_.begin(); it != targets_.end(); ++it) { - out << " " << instance_name() << " -> " << (*it)->instance_name() << ";" << endl; - (*it)->PrintTargets(out); - } -} - -void Module::PrintConfiguration(ostream &out) { - out << "# " << id() << endl; - out << "# " << instance_name() << endl; - out << "# " << version() << endl; - string parameters_string = parameters_->WriteString(); - out << parameters_string << endl; - set<Module*>::const_iterator it; - for (it = targets_.begin(); it != targets_.end(); ++it) { - (*it)->PrintConfiguration(out); + (*it)->PrintVersions(out); } } } // namespace aimc
--- a/src/Support/Module.h Mon Jun 07 08:38:21 2010 +0000 +++ b/src/Support/Module.h Sun Jul 11 03:46:06 2010 +0000 @@ -101,14 +101,8 @@ * override the default Initialize function. When creating a new module, do * not create a new version of Initialize uness you're sure you know what * you're doing! - * - * global_parameters stores things like the input filename, output filenames - * and any other metadata that modules might want to share. If present, it - * is propagated to all children. These parameters are mutable and may - * change. */ - virtual bool Initialize(const SignalBank &input, - Parameters *global_parameters); + virtual bool Initialize(const SignalBank &input); /*! \brief Returns true if the module has been correctly initialized * \return true if module has been initialized, false otherwise @@ -168,8 +162,8 @@ const SignalBank* GetOutputBank() const; void PrintTargets(ostream &out); - void PrintTargetsForDot(ostream &out); - void PrintConfiguration(ostream &out); + + void PrintVersions(ostream &out); string version() const { return module_version_; @@ -186,18 +180,6 @@ string type() const { return module_type_; } - - bool done() { - return done_; - } - - void set_instance_name(string instance_name) { - instance_name_ = instance_name; - } - - string instance_name() { - return instance_name_; - } protected: void PushOutput(); @@ -207,18 +189,14 @@ virtual bool InitializeInternal(const SignalBank &input) = 0; bool initialized_; - bool done_; set<Module*> targets_; SignalBank output_; Parameters* parameters_; - Parameters* global_parameters_; string module_identifier_; string module_type_; string module_description_; string module_version_; - - string instance_name_; private: DISALLOW_COPY_AND_ASSIGN(Module);