From 240dd8eabe57c17a69304674cb5a611263a00944 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sun, 15 Nov 2020 22:41:38 +0100 Subject: [PATCH] invert if..return --- Core/Export/SampleToPython.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/Export/SampleToPython.cpp b/Core/Export/SampleToPython.cpp index 8c03d7e0d17..d8d6b0264c5 100644 --- a/Core/Export/SampleToPython.cpp +++ b/Core/Export/SampleToPython.cpp @@ -654,12 +654,10 @@ void SampleToPython::setPositionInformation(const IParticle* particle, std::stri std::ostringstream& result) const { kvector_t pos = particle->position(); - bool has_position_info = (pos != kvector_t()); + if (pos == kvector_t()) + return; - if (has_position_info) { - result << indent() << name << "_position = kvector_t(" << pyfmt::printNm(pos.x()) << ", " - << pyfmt::printNm(pos.y()) << ", " << pyfmt::printNm(pos.z()) << ")\n"; - - result << indent() << name << ".setPosition(" << name << "_position)\n"; - } + result << indent() << name << "_position = kvector_t(" << pyfmt::printNm(pos.x()) << ", " + << pyfmt::printNm(pos.y()) << ", " << pyfmt::printNm(pos.z()) << ")\n"; + result << indent() << name << ".setPosition(" << name << "_position)\n"; } -- GitLab