Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GTMesh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomáš Jakubec
GTMesh
Commits
7a3fc697
There was an error fetching the commit references. Please try again later.
Commit
7a3fc697
authored
5 years ago
by
Tomáš Jakubec
Browse files
Options
Downloads
Patches
Plain Diff
console debug done
parent
31128a4b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Unstructured_mesh/Unstructured_mesh.pro.user
+1
-1
1 addition, 1 deletion
Unstructured_mesh/Unstructured_mesh.pro.user
Unstructured_mesh/main.cpp
+5
-1
5 additions, 1 deletion
Unstructured_mesh/main.cpp
debug/consolelogger.h
+69
-4
69 additions, 4 deletions
debug/consolelogger.h
with
75 additions
and
6 deletions
Unstructured_mesh/Unstructured_mesh.pro.user
+
1
−
1
View file @
7a3fc697
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2019-10-0
2T13:13:57
. -->
<!-- Written by QtCreator 4.10.0, 2019-10-0
3T23:49:08
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
This diff is collapsed.
Click to expand it.
Unstructured_mesh/main.cpp
+
5
−
1
View file @
7a3fc697
...
...
@@ -693,19 +693,23 @@ void testDebug() {
{
"treti"
,
3
}
};
ConsoleLogger
::
writeVar
(
__LINE__
,
__FILE__
,
"r"
,
r
,
"i"
,
i
,
"c"
,
c
,
"list"
,
list
,
"vec"
,
vec
,
"b"
,
b
,
"map"
,
m
);
ConsoleLogger
::
writeVar
(
__LINE__
,
__FILE__
,
"---"
,
{
5
,
4
,
3
,
2
});
DBGVAR
(
r
,
i
,
c
,
list
,
vec
,
b
,
m
);
}
int
main
()
{
//testMesh2D();
//testMesh2DLoadAndWrite();
testMesh3D
();
//
testMesh3D();
//test3DMeshDeformedPrisms();
//testMeshDataContainer();
//testTemplate();
//UnstructuredMesh<5, size_t, double, 6,5,4> m;
//m.ComputeElementMeasures();
testDebug
();
}
This diff is collapsed.
Click to expand it.
debug/consolelogger.h
+
69
−
4
View file @
7a3fc697
...
...
@@ -4,11 +4,30 @@
#include
<fstream>
#include
<string>
/* TODO prefer exportable class to iterable
namespace Detail {
constexpr bool is_exportable(...) {
return false;
}
template <typename T1>
constexpr auto is_exportable(const T1&)
-> typename std::enable_if<std::is_class<
typename std::remove_reference<decltype(std::cerr << std::declval<const T1&>())>::type
>::value
,bool>::type
{
return true;
}
}*/
/**
* @brief The ConsoleLogger class
*/
class
ConsoleLogger
{
static
void
_writeWar
(...)
{
std
::
cerr
<<
"variable is not exportable"
<<
std
::
endl
;
...
...
@@ -19,7 +38,9 @@ class ConsoleLogger {
static
auto
_writeWar
(
const
T
&
b
)
->
typename
std
::
enable_if
<
std
::
is_class
<
typename
std
::
remove_reference
<
decltype
(
std
::
cerr
<<
b
)
>::
type
>::
value
&&
!
std
::
is_same
<
T
,
bool
>::
value
!
std
::
is_same
<
T
,
bool
>::
value
&&
!
std
::
is_same
<
T
,
std
::
string
>::
value
&&
!
std
::
is_same
<
T
,
const
char
*>::
value
>::
type
{
std
::
cerr
<<
b
;
...
...
@@ -32,12 +53,25 @@ class ConsoleLogger {
std
::
cerr
<<
(
b
==
true
?
"true"
:
"false"
);
}
static
void
_writeWar
(
const
std
::
string
&
str
)
{
std
::
cerr
<<
'"'
<<
str
<<
'"'
;
}
static
void
_writeWar
(
const
char
*
str
)
{
std
::
cerr
<<
'"'
<<
str
<<
'"'
;
}
template
<
typename
T1
,
typename
T2
>
static
auto
_writeWar
(
const
std
::
pair
<
T1
,
T2
>&
b
)
{
std
::
cerr
<<
"{ "
;
_writeWar
(
b
.
first
);
std
::
cerr
<<
"
=>
"
;
std
::
cerr
<<
"
,
"
;
_writeWar
(
b
.
second
);
std
::
cerr
<<
"}"
;
}
template
<
typename
T
>
...
...
@@ -59,6 +93,23 @@ class ConsoleLogger {
}
}
template
<
typename
T
>
static
void
_writeWar
(
const
std
::
initializer_list
<
T
>
&
list
)
{
auto
it
=
list
.
begin
();
std
::
cerr
<<
"[ "
;
while
(
it
!=
list
.
end
()){
_writeWar
(
*
it
);
if
(
++
it
==
list
.
end
()){
std
::
cerr
<<
" ]"
;
}
else
{
std
::
cerr
<<
", "
;
}
}
}
public
:
...
...
@@ -80,14 +131,28 @@ public:
template
<
typename
VAR_NAME
,
typename
VAR
,
typename
...
REST
>
static
void
writeVar
(
int
line
,
const
char
*
cppFile
,
VAR_NAME
name
,
VAR
value
,
REST
...
rest
){
static
void
writeVar
(
int
line
,
const
char
*
cppFile
,
VAR_NAME
name
,
const
VAR
&
value
,
REST
...
rest
){
writeVar
(
line
,
cppFile
,
name
,
value
);
writeVar
(
line
,
cppFile
,
rest
...);
}
template
<
typename
VAR_NAME
,
typename
VAR
>
static
void
writeVar
(
int
line
,
const
char
*
cppFile
,
VAR_NAME
name
,
VAR
value
){
static
void
writeVar
(
int
line
,
const
char
*
cppFile
,
VAR_NAME
name
,
const
VAR
&
value
){
#ifdef __linux__
std
::
cerr
<<
"In file "
<<
cppFile
<<
" at line "
<<
line
<<
" variable
\033
[0;33m"
<<
name
<<
"
\033
[0m has value of
\033
[0;31m"
;
_writeWar
(
value
);
std
::
cerr
<<
"
\033
[0m
\n
"
;
#else
std
::
cerr
<<
"In file "
<<
cppFile
<<
" at line "
<<
line
<<
" variable "
<<
name
<<
" has value of "
;
_writeWar
(
value
);
std
::
cerr
<<
"
\n
"
;
#endif
}
template
<
typename
VAR_NAME
,
typename
VAR
>
static
void
writeVar
(
int
line
,
const
char
*
cppFile
,
VAR_NAME
name
,
const
std
::
initializer_list
<
VAR
>&
value
){
#ifdef __linux__
std
::
cerr
<<
"In file "
<<
cppFile
<<
" at line "
<<
line
<<
" variable
\033
[0;33m"
<<
name
<<
"
\033
[0m has value of
\033
[0;31m"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment