// ***********************************************************************************
// Idefix MHD astrophysical code
//
// Source file src/units.cpp
//
// Last modified : 04/2025
//
// Copyright(C) by :
// - Geoffroy Lesur (IPAG/UGA/CNRS - 2025)
// and other code contributors
//
// Licensed under CeCILL 2.1 License, see COPYING for more information
// ***********************************************************************************
#include "units.hpp"
#include "idefix.hpp"
#include "input.hpp"
void idfx::Units::Init(Input &input) {
if(input.CheckBlock("Units")) {
this->_length = input.GetOrSet("Units","length",0,1.0);
this->_velocity = input.GetOrSet("Units","velocity",0,1.0);
this->_density = input.GetOrSet("Units","density",0,1.0);
this->ComputeUnits();
}
}
void idfx::Units::SetDensity(const real in) {
this->_density = in;
this->ComputeUnits();
}
void idfx::Units::SetLength(const real in) {
this->_length = in;
this->ComputeUnits();
}
void idfx::Units::SetVelocity(const real in) {
this->_velocity = in;
this->ComputeUnits();
}
void idfx::Units::ShowConfig() {
if(_isInitialized) {
idfx::cout