Commit 01e53a7c authored by kraus's avatar kraus
Browse files

fixing error message when a particle is located outside the mesh during load-balancing

parent 38c6dc10
......@@ -1193,7 +1193,8 @@ protected:
typename RegionLayout<T,Dim,Mesh>::touch_range_dv touchingVN = RLayout.touch_range_rdv(pLoc);
//external location
//external location
PInsist(touchingVN.first != touchingVN.second, "could not find node responsible for particle;\nmesh does not seem correctly adapted to particle distribution");
destination = (*(touchingVN.first)).second->getNode();
msgsend[destination] = 1;
......@@ -1318,6 +1319,7 @@ protected:
typename RegionLayout<T,Dim,Mesh>::touch_range_dv touchingVN = RLayout.touch_range_rdv(pLoc);
//external location
PInsist(touchingVN.first != touchingVN.second, "could not find node responsible for particle;\nmesh does not seem correctly adapted to particle distribution");
destination = (*(touchingVN.first)).second->getNode();
msgsend[destination] = 1;
......@@ -1404,4 +1406,4 @@ protected:
* $RCSfile: ParticleSpatialLayout.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:29 $
* IPPL_VERSION_ID: $Id: ParticleSpatialLayout.h,v 1.1.1.1 2003/01/23 07:40:29 adelmann Exp $
***************************************************************************/
***************************************************************************/
\ No newline at end of file
......@@ -2,8 +2,8 @@
/***************************************************************************
*
* The IPPL Framework
*
* This program was prepared by PSI.
*
* This program was prepared by PSI.
* All rights in the program are reserved by PSI.
* Neither PSI nor the author(s)
* makes any warranty, express or implied, or assumes any liability or
......@@ -17,7 +17,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -48,20 +48,23 @@ using namespace std;
//---------------------------------------------------------------------------//
assertion::assertion( const char *cond, const char *file, int line )
assertion::assertion( const char *cond, const char *file, int line ):
std::runtime_error(cond)
{
msg = new char[ strlen(cond) + strlen(file) + 500 ];
sprintf( msg, "Assertion: %s, failed in %s, line %8d.",
cond, file, line );
}
assertion::assertion( const char *m )
assertion::assertion( const char *m ):
std::runtime_error(m)
{
msg = new char[ strlen(m)+1 ];
strcpy( msg, m );
}
assertion::assertion( const assertion& a )
assertion::assertion( const assertion& a ):
std::runtime_error(a.msg)
{
msg = new char[ strlen(a.msg)+1 ];
strcpy( msg, a.msg );
......@@ -94,13 +97,17 @@ void toss_cookies( const char *cond, const char *file, int line )
// Function to perform the task of actually throwing an isistion.
//---------------------------------------------------------------------------//
void insist( const char *, const char *msg, const char *, int )
void insist( const char *cond, const char *msg, const char *file, int line )
{
// inform other nodes they should quit
Ippl::exitAllNodes(msg, false);
// Ippl::exitAllNodes(msg, false);
char* fullmsg = new char[ strlen(cond) + strlen(msg) + strlen(file) + 500 ];
sprintf( fullmsg, "%s\nAssertion '%s' failed in %s on line %8d.",
msg, cond, file, line );
#ifndef IPPL_NO_EXCEPTIONS
throw assertion( msg );
throw assertion( fullmsg );
#else
abort();
#endif
......@@ -113,5 +120,5 @@ void insist( const char *, const char *msg, const char *, int )
/***************************************************************************
* $RCSfile: PAssert.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: PAssert.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
* IPPL_VERSION_ID: $Id: PAssert.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
\ No newline at end of file
......@@ -2,7 +2,7 @@
/***************************************************************************
*
* The IPPL Framework
*
*
*
* Visit http://people.web.psi.ch/adelmann/ for more details
*
......@@ -11,6 +11,8 @@
#ifndef PASSERT_H
#define PASSERT_H
#include <exception>
#include <stdexcept>
//////////////////////////////////////////////////////////////////////
//
// This is a compile time assert.
......@@ -46,16 +48,16 @@ template<> struct IpplCTAssert<true> { static void test() {} };
// classes for which we don't have implementations...
//===========================================================================//
class assertion /* : std::runtime_error */
class assertion: public std::runtime_error
{
char *msg;
public:
public:
assertion( const char *cond, const char *file, int line );
assertion( const char *m );
assertion( const assertion& a );
~assertion() { delete[] msg; }
assertion& operator=( const assertion& a );
const char* what() const { return msg; }
const char* what() const noexcept { return msg; }
};
//---------------------------------------------------------------------------//
......@@ -79,7 +81,7 @@ void insist( const char *cond, const char *msg, const char *file, int line );
//---------------------------------------------------------------------------//
#ifdef NOPAssert
#define PAssert(c)
#define PAssert(c)
#else
#define PAssert(c) if (!(c)) toss_cookies( #c, __FILE__, __LINE__ );
#endif
......@@ -110,5 +112,5 @@ void insist( const char *cond, const char *msg, const char *file, int line );
/***************************************************************************
* $RCSfile: PAssert.h,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: PAssert.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
* IPPL_VERSION_ID: $Id: PAssert.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment