9 #include <fei_ReverseMapper.hpp>
13 #include <fei_VectorSpace.hpp>
14 #include <snl_fei_RecordCollection.hpp>
21 std::vector<int> idTypes;
22 vspace.getIDTypes(idTypes);
24 const std::vector<int>& eqnNumbers = vspace.getEqnNumbers();
26 for(
size_t idt=0; idt<idTypes.size(); ++idt) {
28 int err = vspace.getRecordCollection(idTypes[idt], recordcollection);
30 throw std::runtime_error(
"fei::ReverseMapper ERROR, failed to retrieve record-collection.");
33 const std::vector<fei::Record<int> >&
36 for(
size_t i=0; i<records.size(); ++i) {
40 const std::vector<int>& fieldIDs = fm->
getFieldIDs();
45 for(
size_t i=0; i<fieldIDs.size(); ++i) {
53 erec.IDType = idTypes[idt];
54 erec.ID = record->
getID();
55 erec.fieldID = fieldIDs[i];
57 for(
int j=0; j<fieldSizes[i]; ++j) {
59 erec.global_eqn = eqnNumbers[offsetIntoEqnNumbers+offset2+j];
60 eqnmap_.insert(std::make_pair(erec.global_eqn, erec));
67 ReverseMapper::~ReverseMapper()
71 EqnRecord ReverseMapper::getEqnRecord(
int global_eqn,
int option)
const
73 std::map<int,EqnRecord>::const_iterator
74 iter = eqnmap_.find(global_eqn);
76 if (iter == eqnmap_.end()) {
87 std::ostringstream osstr;
88 osstr <<
"fei::ReverseMapper::getEqnRecord ERROR, global_eqn="<<global_eqn
90 throw std::runtime_error(osstr.str());
std::vector< fei::Record< int > > & getRecords()
ReverseMapper(const VectorSpace &vspace)
std::vector< int > & getFieldSizes()
std::vector< int > & getFieldIDs()
int getFieldEqnOffset(int fieldID, int &offset) const
GlobalIDType getID() const
int getOffsetIntoEqnNumbers() const
fei::FieldMask * getFieldMask()