AutoPas  3.0.0
Loading...
Searching...
No Matches
Functions
ParticleMatcher.h File Reference
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "autopas/utils/ArrayMath.h"
#include "autopas/utils/Math.h"
Include dependency graph for ParticleMatcher.h:

Go to the source code of this file.

Functions

bool equalParticles (const auto &lhs, const auto &rhs)
 Check if two particle-like objects are strictly equal.
 
bool almostEqualParticles (const auto &lhs, const auto &rhs, double epsilon=autopas::utils::Math::EPSILON_RELATIVE_EQUALITY)
 Check if two particle-like objects are almost equal using relative comparisons.
 
bool almostEqualParticlesUlps (const auto &lhs, const auto &rhs, unsigned int ulpDistance=autopas::utils::Math::MAX_ULP_DISTANCE)
 Check if two particle-like objects are almost equal using an ULP distance.
 

Detailed Description

Author
J. Schuhmacher
Date
11.02.26

Function Documentation

◆ almostEqualParticles()

bool almostEqualParticles ( const auto &  lhs,
const auto &  rhs,
double  epsilon = autopas::utils::Math::EPSILON_RELATIVE_EQUALITY 
)

Check if two particle-like objects are almost equal using relative comparisons.

Position, velocity, and force are compared using autopas::utils::almostEqualRelative(...) with a configurable relative tolerance. Additionally, getTypeId() must match exactly.

Template Parameters
LParticle-like type of the left-hand side.
RParticle-like type of the right-hand side.
Parameters
lhsLeft-hand side particle.
rhsRight-hand side particle.
epsilonRelative tolerance used for the floating-point comparisons.
Returns
True if getR(), getV(), and getF() are almost equal (relative) and getTypeId() matches.

◆ almostEqualParticlesUlps()

bool almostEqualParticlesUlps ( const auto &  lhs,
const auto &  rhs,
unsigned int  ulpDistance = autopas::utils::Math::MAX_ULP_DISTANCE 
)

Check if two particle-like objects are almost equal using an ULP distance.

Position, velocity, and force are compared using autopas::utils::almostEqualUlps(...) with a configurable maximum ULP distance. Additionally, getTypeId() must match exactly.

Template Parameters
LParticle-like type of the left-hand side.
RParticle-like type of the right-hand side.
Parameters
lhsLeft-hand side particle.
rhsRight-hand side particle.
ulpDistanceMaximum allowed distance in ULPs.
Returns
True if getR(), getV(), and getF() are almost equal (ULPs) and getTypeId() matches.

◆ equalParticles()

bool equalParticles ( const auto &  lhs,
const auto &  rhs 
)

Check if two particle-like objects are strictly equal.

Strict equality means that position, velocity, force, and ID are compared using operator== on the respective return types.

Template Parameters
LParticle-like type of the left-hand side.
RParticle-like type of the right-hand side.
Parameters
lhsLeft-hand side particle.
rhsRight-hand side particle.
Returns
True if getR(), getV(), getF(), and getID() are all strictly equal; false otherwise.