#include "iwinfo.hh" //#define IWAVE_VERBOSE size_t pow2(int n) { size_t m = 1; while (n>0) { m *=2; n--; } return m; } int IWaveInfo::get_num_fields() const { int num=0; while ((get_iwave_fields()[num].field != "") && num= IWAVEMAXDATA) { RVLException e; e<<"Error: get_num_fields\n"; e<<" over limit for number - probably left off last entry with field=\"\"\n"; throw e; } return num; } int IWaveInfo::get_num_iokeys() const { int num=0; while ((get_iwave_iokeys()[num].keyword != "") && num= IWAVEMAXDATA) { RVLException e; e<<"Error: get_num_iokeys\n"; e<<" over limit for number - probably left off last entry with keyword=\"\"\n"; throw e; } return num; } // NOTE: legit return values are non-negative int IWaveInfo::get_property_iokeys(std::string keyword, std::string property) const { try { for (int i=0; i & tr,int order, bool fwd, IWaveInfo const & ic) { // loop over 0,...order, adj flag #ifdef IWAVE_VERBOSE cerr<<"IOTask constructor input\n"; cerr<<"order="<rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } // active output only in comp 2^order-1 else { for (int i=0;iiwaveindex = pow2(n-1); std::stringstream t; t<keyword = ic.get_iwave_iokeys()[i].keyword + "_d"+t.str(); p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } if (!(ic.get_iwave_iokeys()[i].input) && ic.get_iwave_iokeys()[i].active) { TASK_RELN * p = new TASK_RELN; p->iwaveindex = pow2(n)-1; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } } } // adjoint branch else { // order 0 doesn't make sense for adjoint // 16.02.16: nah-ah - this is the source branch if (order==0) { for (int i=0;iiwaveindex = 0; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } // linear input turns into output if (ic.get_iwave_iokeys()[i].input && (ic.get_iwave_iokeys()[i].active>1)) { TASK_RELN * p = new TASK_RELN; p->iwaveindex = 0; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = 0; //ic.get_iwave_iokeys()[i].input; tr.push_back(p); } // active output turns into input if (!(ic.get_iwave_iokeys()[i].input) && ic.get_iwave_iokeys()[i].active) { TASK_RELN * p = new TASK_RELN; p->iwaveindex = 0; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = 1;// ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } else { for (int n = 0; n<=order; n++) { if (n==0) { // all inputs kept for n=0, also all passive outputs for (int i=0;iiwaveindex = 0; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } else if (0iwaveindex = pow2(n-1); std::ostringstream t; t<keyword = ic.get_iwave_iokeys()[i].keyword + "_d"+t.str(); p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } // active output only in comp = order else { // only active inputs; keywords altered for (int i=0;iiwaveindex = pow2(n-1); std::ostringstream t; t<keyword = ic.get_iwave_iokeys()[i].keyword + "_b"+t.str(); p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = !ic.get_iwave_iokeys()[i].input; tr.push_back(p); } if (!(ic.get_iwave_iokeys()[i].input) && ic.get_iwave_iokeys()[i].active) { TASK_RELN * p = new TASK_RELN; p->iwaveindex = pow2(n)-1; p->keyword = ic.get_iwave_iokeys()[i].keyword; p->rarrindex = ic.get_iwave_iokeys()[i].rarrindex; p->input = !ic.get_iwave_iokeys()[i].input; tr.push_back(p); } } } } } } } void IOTaskWriter(std::vector const & tr, ostream & str) { for (size_t i=0;i