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

Merge branch 'silvaco_tcad_electric_field' into 'master'

Silvaco tcad electric field

See merge request allpix-squared/allpix-squared!753
parents 913a7830 34fb501f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ ADD_EXECUTABLE(
    MeshConverter.cpp
    MeshParser.cpp
    parsers/DFISEParser.cpp
    parsers/SilvacoParser.cpp
    ${ALLPIX_SRC}/core/utils/log.cpp
    ${ALLPIX_SRC}/core/utils/text.cpp
    ${ALLPIX_SRC}/core/utils/unit.cpp
+5 −2
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@ using namespace mesh_converter;
std::shared_ptr<MeshParser> MeshParser::factory(const allpix::Configuration& config) {
    auto parser = config.get<std::string>("parser", "df-ise");
    std::transform(parser.begin(), parser.end(), parser.begin(), ::tolower);

    LOG(DEBUG) << "Parser \"" << parser << "\"";
    if(parser == "df-ise" || parser == "dfise") {
        return std::make_shared<DFISEParser>();
    } else if(parser == "silvaco") {
        return std::make_shared<SilvacoParser>();
    } else {
        throw allpix::InvalidValueError(config, "parser", "Unknown parser type");
    }
@@ -63,7 +65,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 << ":";
@@ -80,6 +82,7 @@ MeshParser::getField(const std::string& file, const std::string& observable, con
    for(const auto& region : regions) {
        if(field_map_[file].find(region) != field_map_[file].end() &&
           field_map_[file][region].find(observable) != field_map_[file][region].end()) {
            LOG(DEBUG) << "Region \"" << region << "\"";
            field.insert(
                field.end(), field_map_[file][region][observable].begin(), field_map_[file][region][observable].end());
        } else {
+3 −1
Original line number Diff line number Diff line
@@ -55,9 +55,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
@@ -69,5 +70,6 @@ namespace mesh_converter {
} // namespace mesh_converter

#include "parsers/DFISEParser.hpp"
#include "parsers/SilvacoParser.hpp"

#endif // ALLPIX_MESHPARSER_H
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,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
@@ -46,7 +46,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

Loading