Commit 142e22c3 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'p-inline-constref' into 'master'

Inline and const& some member functions

See merge request allpix-squared/allpix-squared!900
parents bde35cf2 bd85b4bb
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -84,13 +84,6 @@ void ConfigManager::parse_detectors() {
    detector_configs_ = std::list<Configuration>(detector_configs.begin(), detector_configs.end());
}

/**
 * The global configuration is the combination of all sections with a global header.
 */
Configuration& ConfigManager::getGlobalConfiguration() {
    return global_config_;
}

/**
 * Load all extra options that should be added on top of the configuration in the file. The options loaded here are
 * automatically applied to the module instance when these are added later.
@@ -139,12 +132,6 @@ bool ConfigManager::loadDetectorOptions(const std::vector<std::string>& options)
    return optionsApplied;
}

/**
 * All special global and ignored sections are not included in the list of module configurations.
 */
std::list<Configuration>& ConfigManager::getModuleConfigurations() {
    return module_configs_;
}
/**
 * The list of detector configurations is read from the configuration defined in 'detector_file'
 */
@@ -178,14 +165,6 @@ Configuration& ConfigManager::addInstanceConfiguration(const ModuleIdentifier& i
    return ret_config;
}

/**
 * The list of instance configurations can contain configurations with duplicate names, but the instance configuration is
 * guaranteed to have a configuration value 'identifier' that contains an unique identifier for every same config name
 */
std::list<Configuration>& ConfigManager::getInstanceConfigurations() {
    return instance_configs_;
}

/**
 * An instance configuration might be dropped when not used (e.g. it is overwritten by another module instance afterwards)
 * We need to remove it from the instance configuration list to ensure dumping the config actually dumps only the instance
+11 −3
Original line number Diff line number Diff line
@@ -70,13 +70,17 @@ namespace allpix {
        /**
         * @brief Get the global configuration
         * @return Reference to global configuration
         *
         * The global configuration is the combination of all sections with a global header.
         */
        Configuration& getGlobalConfiguration();
        Configuration& getGlobalConfiguration() { return global_config_; }
        /**
         * @brief Get all the module configurations
         * @return Reference to list of module configurations
         *
         * All special global and ignored sections are not included in the list of module configurations.
         */
        std::list<Configuration>& getModuleConfigurations();
        std::list<Configuration>& getModuleConfigurations() { return module_configs_; }

        /**
         * @brief Add a new module instance configuration and applies instance options
@@ -88,8 +92,12 @@ namespace allpix {
        /**
         * @brief Get all the instance configurations
         * @return Reference to list of instance configurations
         *
         * The list of instance configurations can contain configurations with duplicate names, but the instanceconfiguration
         * is guaranteed to have a configuration value 'identifier' that contains an unique identifier for every same config
         * name.
         */
        std::list<Configuration>& getInstanceConfigurations();
        std::list<Configuration>& getInstanceConfigurations() { return instance_configs_; }

        /**
         * @brief Drops an instance configuration from instance configuration storage
+0 −11
Original line number Diff line number Diff line
@@ -62,13 +62,6 @@ unsigned int Configuration::count(std::initializer_list<std::string> keys) const
    return found;
}

std::string Configuration::getName() const {
    return name_;
}
std::filesystem::path Configuration::getFilePath() const {
    return path_;
}

std::string Configuration::getText(const std::string& key) const {
    try {
        // NOTE: returning literally including ""
@@ -177,10 +170,6 @@ void Configuration::setAlias(const std::string& new_key, const std::string& old_
    }
}

unsigned int Configuration::countSettings() const {
    return static_cast<unsigned int>(config_.size());
}

/**
 * All keys that are already defined earlier in this configuration are not changed.
 */
+3 −3
Original line number Diff line number Diff line
@@ -283,20 +283,20 @@ namespace allpix {
         * @brief Return total number of key / value pairs
         * @return Number of settings
         */
        unsigned int countSettings() const;
        unsigned int countSettings() const { return static_cast<unsigned int>(config_.size()); }

        /**
         * @brief Get name of the configuration header
         * @return Configuration name
         */
        std::string getName() const;
        const std::string& getName() const { return name_; }

        /**
         * @brief Get path to the file containing the configuration if it has one
         * @return Absolute path to configuration file or empty if not linked to a file
         * @warning Parameter should be used with care as not all configurations are required to have a file
         */
        std::filesystem::path getFilePath() const;
        std::filesystem::path getFilePath() const { return path_; }

        /**
         * @brief Merge other configuration, only adding keys that are not yet defined in this configuration
+0 −63
Original line number Diff line number Diff line
@@ -76,24 +76,6 @@ void Detector::build_transform() {
    transform_ = transform_center * transform_local.Inverse();
}

std::string Detector::getName() const {
    return name_;
}
std::string Detector::getType() const {
    return model_->getType();
}

const std::shared_ptr<DetectorModel> Detector::getModel() const {
    return model_;
}

ROOT::Math::XYZPoint Detector::getPosition() const {
    return position_;
}
ROOT::Math::Rotation3D Detector::getOrientation() const {
    return orientation_;
}

/**
 * @warning The local coordinate position does normally not have its origin at the center of rotation
 *
@@ -127,14 +109,6 @@ Pixel Detector::getPixel(const Pixel::Index& index) const {
    return {index, type, local_center, global_center, size};
}

/**
 * The electric field is replicated for all pixels and uses flipping at each boundary (side effects are not modeled in this
 * stage). Outside of the sensor the electric field is strictly zero by definition.
 */
bool Detector::hasElectricField() const {
    return electric_field_.isValid();
}

/**
 * The electric field is replicated for all pixels and uses flipping at each boundary (side effects are not modeled in this
 * stage). Outside of the sensor the electric field is strictly zero by definition.
@@ -143,13 +117,6 @@ ROOT::Math::XYZVector Detector::getElectricField(const ROOT::Math::XYZPoint& loc
    return electric_field_.get(local_pos);
}

/**
 * The type of the electric field is set depending on the function used to apply it.
 */
FieldType Detector::getElectricFieldType() const {
    return electric_field_.getType();
}

/**
 * @throws std::invalid_argument If the electric field dimensions are incorrect or the thickness domain is outside the sensor
 */
@@ -170,10 +137,6 @@ void Detector::setElectricFieldFunction(FieldFunction<ROOT::Math::XYZVector> fun
    electric_field_.setFunction(std::move(function), thickness_domain, type);
}

bool Detector::hasWeightingPotential() const {
    return weighting_potential_.isValid();
}

/**
 * The weighting potential is retrieved relative to a reference pixel. Outside of the sensor the weighting potential is
 * strictly zero by definition.
@@ -186,13 +149,6 @@ double Detector::getWeightingPotential(const ROOT::Math::XYZPoint& local_pos, co
    return weighting_potential_.getRelativeTo(local_pos, ref, true);
}

/**
 * The type of the weighting potential is set depending on the function used to apply it.
 */
FieldType Detector::getWeightingPotentialType() const {
    return weighting_potential_.getType();
}

/**
 * @throws std::invalid_argument If the weighting potential dimensions are incorrect or the thickness domain is outside the
 * sensor
@@ -214,10 +170,6 @@ void Detector::setWeightingPotentialFunction(FieldFunction<double> function,
    weighting_potential_.setFunction(std::move(function), thickness_domain, type);
}

bool Detector::hasMagneticField() const {
    return magnetic_field_on_;
}

// TODO Currently the magnetic field in the detector is fixed to the field vector at it's center position. Change in case a
// field gradient is needed inside the sensor.
void Detector::setMagneticField(ROOT::Math::XYZVector b_field) {
@@ -232,14 +184,6 @@ ROOT::Math::XYZVector Detector::getMagneticField(const ROOT::Math::XYZPoint&) co
    return magnetic_field_;
}

/**
 * The doping profile is replicated for all pixels and uses flipping at each boundary (side effects are not modeled in this
 * stage). Outside of the sensor the doping profile is strictly zero by definition.
 */
bool Detector::hasDopingProfile() const {
    return doping_profile_.isValid();
}

/**
 * The doping profile is replicated for all pixels and uses flipping at each boundary (side effects are not modeled in this
 * stage). Outside of the sensor the doping profile is strictly zero by definition.
@@ -249,13 +193,6 @@ double Detector::getDopingConcentration(const ROOT::Math::XYZPoint& pos) const {
    return doping_profile_.get(pos, true);
}

/**
 * The type of the doping profile is set depending on the function used to apply it.
 */
FieldType Detector::getDopingProfileType() const {
    return doping_profile_.getType();
}

/**
 * @throws std::invalid_argument If the doping profile dimensions are incorrect
 *
Loading