Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Nektar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
87
Issues
87
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
44
Merge Requests
44
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nektar
Nektar
Commits
76927fc7
Commit
76927fc7
authored
Mar 27, 2017
by
Michael Turner
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset error util
parent
2287b028
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
125 deletions
+124
-125
library/LibUtilities/BasicUtils/ErrorUtil.hpp
library/LibUtilities/BasicUtils/ErrorUtil.hpp
+121
-120
library/NekMeshUtils/CADSystem/OCE/CADSurfOCE.cpp
library/NekMeshUtils/CADSystem/OCE/CADSurfOCE.cpp
+3
-5
No files found.
library/LibUtilities/BasicUtils/ErrorUtil.hpp
View file @
76927fc7
...
...
@@ -35,11 +35,11 @@
#ifndef ERRORUTIL_HPP
#define ERRORUTIL_HPP
#include <LibUtilities/LibUtilitiesDeclspec.h>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
#include <iostream>
#include <stdexcept>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
#if defined(NEKTAR_USE_MPI)
#include <mpi.h>
...
...
@@ -51,48 +51,42 @@
namespace
ErrorUtil
{
static
boost
::
optional
<
std
::
ostream
&>
outStream
;
static
boost
::
optional
<
std
::
ostream
&>
outStream
;
inline
static
void
SetErrorStream
(
std
::
ostream
&
o
)
{
inline
static
void
SetErrorStream
(
std
::
ostream
&
o
)
{
outStream
=
o
;
}
}
inline
static
bool
HasCustomErrorStream
()
{
inline
static
bool
HasCustomErrorStream
()
{
return
outStream
?
true
:
false
;
}
}
enum
ErrType
{
enum
ErrType
{
efatal
,
ewarning
};
};
class
NekError
:
public
std
::
runtime_error
{
public:
NekError
(
const
std
::
string
&
message
)
:
std
::
runtime_error
(
message
)
class
NekError
:
public
std
::
runtime_error
{
}
};
public:
NekError
(
const
std
::
string
&
message
)
:
std
::
runtime_error
(
message
)
{}
};
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
char
*
msg
,
unsigned
int
level
,
bool
DoComm
=
false
)
{
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
char
*
msg
,
unsigned
int
level
,
bool
DoComm
=
false
)
{
// The user of outStream is primarily for the unit tests.
// The unit tests often generate errors on purpose to make sure
// invalid usage is flagged appropriately. Printing the error
// messages to cerr made the unit test output hard to parse.
std
::
string
baseMsg
=
std
::
string
(
"Level "
)
+
boost
::
lexical_cast
<
std
::
string
>
(
level
)
+
std
::
string
baseMsg
=
std
::
string
(
"Level "
)
+
boost
::
lexical_cast
<
std
::
string
>
(
level
)
+
std
::
string
(
" assertion violation
\n
"
)
+
#if defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
std
::
string
(
"Where : "
)
+
boost
::
lexical_cast
<
std
::
string
>
(
routine
)
+
std
::
string
(
"["
)
+
boost
::
lexical_cast
<
std
::
string
>
(
lineNumber
)
+
std
::
string
(
"]
\n
"
)
+
std
::
string
(
"Message : "
)
+
std
::
string
(
"Where : "
)
+
boost
::
lexical_cast
<
std
::
string
>
(
routine
)
+
std
::
string
(
"["
)
+
boost
::
lexical_cast
<
std
::
string
>
(
lineNumber
)
+
std
::
string
(
"]
\n
"
)
+
std
::
string
(
"Message : "
)
+
#endif
msg
;
...
...
@@ -101,12 +95,12 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
int
rank
=
0
;
#if defined(NEKTAR_USE_MPI)
int
flag
=
0
;
if
(
DoComm
)
if
(
DoComm
)
{
MPI_Initialized
(
&
flag
);
if
(
flag
)
if
(
flag
)
{
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
}
}
#endif
...
...
@@ -121,7 +115,7 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
btSize
=
backtrace
(
btArray
,
40
);
btStrings
=
backtrace_symbols
(
btArray
,
btSize
);
for
(
int
i
=
0
;
i
<
btSize
;
++
i
)
for
(
int
i
=
0
;
i
<
btSize
;
++
i
)
{
btMessage
+=
std
::
string
(
btStrings
[
i
])
+
"
\n
"
;
}
...
...
@@ -136,16 +130,18 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
{
if
(
outStream
)
{
(
*
outStream
)
<<
btMessage
;
(
*
outStream
)
<<
"Fatal : "
<<
baseMsg
<<
std
::
endl
;
}
else
{
std
::
cerr
<<
std
::
endl
<<
"Fatal : "
<<
baseMsg
<<
std
::
endl
;
std
::
cerr
<<
btMessage
;
std
::
cerr
<<
std
::
endl
<<
"Fatal : "
<<
baseMsg
<<
std
::
endl
;
}
}
#if defined(NEKTAR_USE_MPI)
if
(
DoComm
)
if
(
DoComm
)
{
if
(
flag
)
{
...
...
@@ -160,10 +156,12 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
{
if
(
outStream
)
{
(
*
outStream
)
<<
btMessage
;
(
*
outStream
)
<<
"Warning: "
<<
baseMsg
<<
std
::
endl
;
}
else
{
std
::
cerr
<<
btMessage
;
std
::
cerr
<<
"Warning: "
<<
baseMsg
<<
std
::
endl
;
}
}
...
...
@@ -171,19 +169,17 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
default:
std
::
cerr
<<
"Unknown warning type: "
<<
baseMsg
<<
std
::
endl
;
}
}
}
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
std
::
string
&
msg
,
unsigned
int
level
)
{
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
std
::
string
&
msg
,
unsigned
int
level
)
{
Error
(
type
,
routine
,
lineNumber
,
msg
.
c_str
(),
level
);
}
}
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
char
*
msg
)
{
inline
static
void
Error
(
ErrType
type
,
const
char
*
routine
,
int
lineNumber
,
const
char
*
msg
)
{
Error
(
type
,
routine
,
lineNumber
,
msg
,
0
);
}
}
}
// end of namespace
/// Assert Level 0 -- Fundamental assert which
...
...
@@ -192,63 +188,68 @@ inline static void Error(ErrType type, const char *routine, int lineNumber,
/// considered code critical, even under
/// optimized compilation.
#define NEKERROR(type, msg) ErrorUtil::Error(type, __FILE__, __LINE__, msg, 0);
#define NEKERROR(type, msg) \
ErrorUtil::Error(type, __FILE__, __LINE__, msg, 0);
#define ROOTONLY_NEKERROR(type, msg) \
ErrorUtil::Error(type, __FILE__, __LINE__, msg, 0,
true);
ErrorUtil::Error(type, __FILE__, __LINE__, msg, 0,true);
#define ASSERTL0(condition,
msg)
\
if
(!(condition))
\
{
\
#define ASSERTL0(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 0); \
}
}
#define WARNINGL0(condition,
msg)
\
if
(!(condition))
\
{
\
#define WARNINGL0(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 0); \
}
}
/// Assert Level 1 -- Debugging which is used whether in FULLDEBUG or
/// DEBUG compilation mode. This level assert is designed for aiding
/// in standard debug (-g) mode
#if defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
#define ASSERTL1(condition,
msg)
\
if
(!(condition))
\
{
\
#define ASSERTL1(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 1); \
}
#define WARNINGL1(condition,
msg)
\
if
(!(condition))
\
{
\
}
#define WARNINGL1(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 1); \
}
}
#else //defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
#define ASSERTL1(condition,msg)
#define WARNINGL1(condition,msg)
#endif //defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
#else // defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
#define ASSERTL1(condition, msg)
#define WARNINGL1(condition, msg)
#endif // defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
/// Assert Level 2 -- Debugging which is used FULLDEBUG compilation
/// mode. This level assert is designed to provide addition safety
/// checks within the code (such as bounds checking, etc.).
#ifdef NEKTAR_FULLDEBUG
#define ASSERTL2(condition,
msg)
\
if
(!(condition))
\
{
\
#define ASSERTL2(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::efatal, __FILE__, __LINE__, msg, 2); \
}
#define WARNINGL2(condition,
msg)
\
if
(!(condition))
\
{
\
}
#define WARNINGL2(condition,
msg)
\
if
(!(condition))
\
{
\
ErrorUtil::Error(ErrorUtil::ewarning, __FILE__, __LINE__, msg, 2); \
}
}
#else //NEKTAR_FULLDEBUG
#define ASSERTL2(condition,msg)
#define WARNINGL2(condition,msg)
#endif //NEKTAR_FULLDEBUG
#else // NEKTAR_FULLDEBUG
#define ASSERTL2(condition, msg)
#define WARNINGL2(condition, msg)
#endif // NEKTAR_FULLDEBUG
#endif //ERRORUTIL_HPP
#endif // ERRORUTIL_HPP
library/NekMeshUtils/CADSystem/OCE/CADSurfOCE.cpp
View file @
76927fc7
...
...
@@ -90,11 +90,9 @@ Array<OneD, NekDouble> CADSurfOCE::locuv(Array<OneD, NekDouble> p)
uvr
[
1
]
=
p2
.
Y
();
gp_Pnt
p3
=
m_sas
->
Value
(
p2
);
if
(
p3
.
Distance
(
loc
)
>
1e-6
)
{
cout
<<
"large locuv distance "
<<
p3
.
Distance
(
loc
)
/
1000.0
<<
" "
<<
m_id
<<
endl
;
}
WARNINGL2
(
p3
.
Distance
(
loc
)
<
1e-3
,
"large locuv distance "
+
boost
::
lexical_cast
<
string
>
(
p3
.
Distance
(
loc
)
/
1000.0
)
+
" "
+
boost
::
lexical_cast
<
string
>
(
m_id
));
// if the uv returned is slightly off the surface
//(which ShapeAnalysis_Surface can do sometimes)
...
...
Dave Moxey
@dmoxey
mentioned in commit
f87c7550
·
Mar 28, 2017
mentioned in commit
f87c7550
mentioned in commit f87c75501d51a937625dcf148ac85b957e06be46
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment