Commit fb4b5751 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

MeshParsers: allow looping back observable

(cherry picked from commit 5415458d)
parent cfa6eac5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ MeshParser::getField(const std::string& file, const std::string& observable, con
    // Populate field map once:
    if(field_map_[file].empty()) {
        LOG(STATUS) << "Reading field from file \"" << file << "\"";
        field_map_[file] = read_fields(file);
        field_map_[file] = read_fields(file, observable);
        LOG(INFO) << "Field sizes for all regions and observables:";
        for(auto& reg : field_map_[file]) {
            LOG(INFO) << " " << reg.first << ":";
+2 −1
Original line number Diff line number Diff line
@@ -45,9 +45,10 @@ namespace mesh_converter {
        /**
         * @brief Method to read fields from the given file
         * @param  file_name Canonical path pof the input file
         * @param  observable Optionally the observable of interest, required by some parsers
         * @return           Map with all fields for the different regions
         */
        virtual FieldMap read_fields(const std::string& file_name) = 0;
        virtual FieldMap read_fields(const std::string& file_name, const std::string& observable = "") = 0;

    private:
        // Cache of parsed meshes for all regions
+1 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ MeshMap DFISEParser::read_meshes(const std::string& file_name) {
    return ret_map;
}

FieldMap DFISEParser::read_fields(const std::string& file_name) {
FieldMap DFISEParser::read_fields(const std::string& file_name, const std::string&) {
    std::ifstream file(file_name);
    if(!file) {
        throw std::runtime_error("file cannot be accessed");
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ namespace mesh_converter {
        MeshMap read_meshes(const std::string& file_name) override;

        // Read the electric field
        FieldMap read_fields(const std::string& file_name) override;
        FieldMap read_fields(const std::string& file_name, const std::string& observable) override;
    };
} // namespace mesh_converter