Skip to content
Snippets Groups Projects
Commit 9826054e authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

fix R3 calls exported to python

parent d67b0bb9
Branches
Tags
1 merge request!1440Fix R3 calls exported to python
Pipeline #91657 passed
...@@ -77,7 +77,7 @@ void setPositionInformation(const IParticle* particle, std::string name, std::os ...@@ -77,7 +77,7 @@ void setPositionInformation(const IParticle* particle, std::string name, std::os
if (pos == R3()) if (pos == R3())
return; return;
result << indent() << name << "_position = R3(" << Py::Fmt::printNm(pos.x()) << ", " result << indent() << name << "_position = ba.R3(" << Py::Fmt::printNm(pos.x()) << ", "
<< Py::Fmt::printNm(pos.y()) << ", " << Py::Fmt::printNm(pos.z()) << ")\n"; << Py::Fmt::printNm(pos.y()) << ", " << Py::Fmt::printNm(pos.z()) << ")\n";
result << indent() << name << ".translate(" << name << "_position)\n"; result << indent() << name << ".translate(" << name << "_position)\n";
} }
...@@ -111,7 +111,7 @@ std::string defineMaterials(const MaterialKeyHandler& matHandler) ...@@ -111,7 +111,7 @@ std::string defineMaterials(const MaterialKeyHandler& matHandler)
<< Py::Fmt::printDouble(material_data.imag()) << ")\n"; << Py::Fmt::printDouble(material_data.imag()) << ")\n";
} else { } else {
R3 magnetic_field = p_material->magnetization(); R3 magnetic_field = p_material->magnetization();
result << indent() << "magnetic_field = R3(" << magnetic_field.x() << ", " result << indent() << "magnetic_field = ba.R3(" << magnetic_field.x() << ", "
<< magnetic_field.y() << ", " << magnetic_field.z() << ")\n"; << magnetic_field.y() << ", " << magnetic_field.z() << ")\n";
result << indent() << matHandler.mat2key(p_material) << " = ba." << factory_name->second result << indent() << matHandler.mat2key(p_material) << " = ba." << factory_name->second
<< "(\"" << p_material->materialName(); << "(\"" << p_material->materialName();
...@@ -468,7 +468,7 @@ std::string defineMultiLayers(const ComponentKeyHandler& objHandler) ...@@ -468,7 +468,7 @@ std::string defineMultiLayers(const ComponentKeyHandler& objHandler)
auto external_field = s->externalField(); auto external_field = s->externalField();
if (external_field.mag() > 0.0) { if (external_field.mag() > 0.0) {
std::string field_name = key + "_external_field"; std::string field_name = key + "_external_field";
result << indent() << field_name << " = R3(" result << indent() << field_name << " = ba.R3("
<< Py::Fmt::printScientificDouble(external_field.x()) << ", " << Py::Fmt::printScientificDouble(external_field.x()) << ", "
<< Py::Fmt::printScientificDouble(external_field.y()) << ", " << Py::Fmt::printScientificDouble(external_field.y()) << ", "
<< Py::Fmt::printScientificDouble(external_field.z()) << ")\n"; << Py::Fmt::printScientificDouble(external_field.z()) << ")\n";
......
...@@ -135,7 +135,7 @@ std::string definePolarizationAnalyzer(const PolFilter& analyzer, const std::str ...@@ -135,7 +135,7 @@ std::string definePolarizationAnalyzer(const PolFilter& analyzer, const std::str
if (analyzer_direction.mag() > 0.0) { if (analyzer_direction.mag() > 0.0) {
std::string direction_name = "analyzer_direction"; std::string direction_name = "analyzer_direction";
result << indent() << direction_name << " = R3(" result << indent() << direction_name << " = ba.R3("
<< Py::Fmt::printDouble(analyzer_direction.x()) << ", " << Py::Fmt::printDouble(analyzer_direction.x()) << ", "
<< Py::Fmt::printDouble(analyzer_direction.y()) << ", " << Py::Fmt::printDouble(analyzer_direction.y()) << ", "
<< Py::Fmt::printDouble(analyzer_direction.z()) << ")\n"; << Py::Fmt::printDouble(analyzer_direction.z()) << ")\n";
...@@ -231,8 +231,9 @@ std::string defineBeamPolarization(const Beam& beam) ...@@ -231,8 +231,9 @@ std::string defineBeamPolarization(const Beam& beam)
auto bloch_vector = beam.polVector(); auto bloch_vector = beam.polVector();
if (bloch_vector.mag() > 0.0) { if (bloch_vector.mag() > 0.0) {
std::string beam_polMatrices = "beam_polMatrices"; std::string beam_polMatrices = "beam_polMatrices";
result << indent() << beam_polMatrices << " = R3(" << Py::Fmt::printDouble(bloch_vector.x()) result << indent() << beam_polMatrices << " = ba.R3("
<< ", " << Py::Fmt::printDouble(bloch_vector.y()) << ", " << Py::Fmt::printDouble(bloch_vector.x()) << ", "
<< Py::Fmt::printDouble(bloch_vector.y()) << ", "
<< Py::Fmt::printDouble(bloch_vector.z()) << ")\n"; << Py::Fmt::printDouble(bloch_vector.z()) << ")\n";
result << indent() << "beam.setPolarization(" << beam_polMatrices << ")\n"; result << indent() << "beam.setPolarization(" << beam_polMatrices << ")\n";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment