33 #ifndef __H__LIB_ALGEBRA__OPERATOR__DEBUG_WRITER__
34 #define __H__LIB_ALGEBRA__OPERATOR__DEBUG_WRITER__
77 for (
size_t i = 0; i <
m_secDir.size (); i++)
90 UG_WARNING (
"IVectorDebugWriter: Directory '" << path <<
"' does not exist. Using cwd instead.\n");
93 for (
size_t i = 0; i <
m_secDir.size (); i++)
98 UG_WARNING (
"IVectorDebugWriter: Could not create directory '" << path <<
"'. Using cwd instead.\n");
116 template <
typename TVector>
242 template <
typename TAlgebra>
264 template <
typename TVector>
307 size_t iExtPos =
name.find_last_of(
".");
308 if(iExtPos != std::string::npos &&
name.substr(iExtPos).compare(
".vec") != 0)
309 UG_THROW(
"Only '.vec' format supported for vectors, but"
310 " filename is '"<<
name<<
"'.");
312 if(iExtPos == std::string::npos)
352 template <
typename TAlgebra>
411 size_t iExtPos =
name.find_last_of(
".");
412 if(iExtPos != std::string::npos &&
name.substr(iExtPos).compare(
".mat") != 0)
413 UG_THROW(
"Only '.mat' format supported for matrices, but"
414 " filename is '"<<
name<<
"'.");
416 if(iExtPos == std::string::npos)
location name
Definition: checkpoint_util.lua:128
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
Context of a debugger writer: Keeps the debugging section etc.
Definition: debug_writer.h:57
std::vector< std::string > m_secDir
debuging section subdirectories
Definition: debug_writer.h:109
void compose_file_path(std::string &path)
composes the path for the files and creates the intermediate directories (up to the base one):
Definition: debug_writer.h:85
std::string get_base_dir()
Definition: debug_writer.h:65
std::string m_baseDir
base directory for the debugging output
Definition: debug_writer.h:106
void leave_section()
leave the current debugging section
Definition: debug_writer.h:71
void set_base_dir(const char *const baseDir)
set the base directory for output files (.vec and .mat)
Definition: debug_writer.h:64
void print_message(const char *msg)
prints a message
Definition: debug_writer.h:74
void enter_section(const char *secDir)
enter a new debugging section
Definition: debug_writer.h:68
DebugWriterContext()
constructor
Definition: debug_writer.h:61
Definition: debug_writer.h:354
void enter_debug_writer_section(std::string secDir)
enters a debugging section
Definition: debug_writer.h:424
virtual void set_debug(SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
set debug writer
Definition: debug_writer.h:384
void write_debug(const matrix_type &mat, const char *filename)
write debug output for a matrix (if debug writer set)
Definition: debug_writer.h:399
void write_debug(const matrix_type &mat, std::string name)
write debug output for a matrix (if debug writer set)
Definition: debug_writer.h:404
virtual ~DebugWritingObject()
virtual destructor
Definition: debug_writer.h:381
DebugWritingObject(SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
Definition: debug_writer.h:371
TAlgebra::vector_type vector_type
type of vector
Definition: debug_writer.h:360
ConstSmartPtr< IDebugWriter< algebra_type > > debug_writer() const
Definition: debug_writer.h:392
DebugWritingObject()
Definition: debug_writer.h:370
void enter_debug_writer_section(const char *secDir)
enters a debugging section
Definition: debug_writer.h:429
TAlgebra algebra_type
type of algebra
Definition: debug_writer.h:357
SmartPtr< IDebugWriter< algebra_type > > m_spDebugWriter
Debug Writer.
Definition: debug_writer.h:442
SmartPtr< IDebugWriter< algebra_type > > debug_writer()
returns the debug writer
Definition: debug_writer.h:391
TAlgebra::matrix_type matrix_type
type of matrix
Definition: debug_writer.h:363
DebugWritingObject(const DebugWritingObject< algebra_type > &parent)
clone constructor
Definition: debug_writer.h:376
bool debug_writer_valid() const
returns true if the debug writer is set
Definition: debug_writer.h:395
void leave_debug_writer_section()
leaves a debugging section
Definition: debug_writer.h:435
base class for all debug writer
Definition: debug_writer.h:244
virtual void write_vector(const vector_type &vec, const char *name)=0
write vector
TAlgebra algebra_type
type of algebra
Definition: debug_writer.h:247
TAlgebra::vector_type vector_type
type of vector
Definition: debug_writer.h:250
virtual void write_matrix(const matrix_type &mat, const char *name)=0
write matrix
TAlgebra::matrix_type matrix_type
type of matrix
Definition: debug_writer.h:253
Interface for providing vertex positions.
Definition: debug_writer.h:46
virtual bool get_positions(std::vector< MathVector< dim > > &vec)=0
Assigns position information to given vector.
virtual ~IPositionProvider()
Definition: debug_writer.h:52
base class for all vector debug writer
Definition: debug_writer.h:118
std::vector< MathVector< 2 > > m_vPos2d
Definition: debug_writer.h:226
std::string get_base_dir()
Definition: debug_writer.h:192
TVector vector_type
type of vector
Definition: debug_writer.h:121
const std::vector< MathVector< 1 > > & get_pos(Int2Type< 1 >) const
Definition: debug_writer.h:233
const std::vector< MathVector< dim > > & get_positions() const
returns the positions (only available for current dimension)
Definition: debug_writer.h:139
SmartPtr< DebugWriterContext > m_spContext
debugging writer context
Definition: debug_writer.h:219
void set_positions(IPositionProvider< dim > &provider)
employs a position provider to set the current positions
Definition: debug_writer.h:160
virtual ~IVectorDebugWriter()
virtual destructor
Definition: debug_writer.h:129
int m_currentDim
current dimension
Definition: debug_writer.h:222
void leave_section()
leave the current debugging section
Definition: debug_writer.h:198
virtual void print_message(const char *msg)
prints a message
Definition: debug_writer.h:182
std::vector< MathVector< dim > > & positions()
returns the positions and sets the current dim
Definition: debug_writer.h:204
std::vector< MathVector< 2 > > & get_pos(Int2Type< 2 >)
Definition: debug_writer.h:231
void set_positions(const std::vector< MathVector< dim > > &vPos)
sets the current positions
Definition: debug_writer.h:153
const std::vector< MathVector< 2 > > & get_pos(Int2Type< 2 >) const
Definition: debug_writer.h:234
std::vector< MathVector< 1 > > & get_pos(Int2Type< 1 >)
help function to get local ips
Definition: debug_writer.h:230
void set_base_dir(const char *const baseDir)
set the base directory for output files (.vec and .mat)
Definition: debug_writer.h:185
void set_context(SmartPtr< DebugWriterContext > context)
set the debugging writer context
Definition: debug_writer.h:173
SmartPtr< DebugWriterContext > get_context()
get the debugging writer context
Definition: debug_writer.h:176
std::vector< MathVector< 1 > > m_vPos1d
vectors of positions
Definition: debug_writer.h:225
std::vector< MathVector< 3 > > & get_pos(Int2Type< 3 >)
Definition: debug_writer.h:232
virtual void update_positions()
Definition: debug_writer.h:149
const std::vector< MathVector< 3 > > & get_pos(Int2Type< 3 >) const
Definition: debug_writer.h:235
int get_dim() const
get the dimensionality
Definition: debug_writer.h:167
ConstSmartPtr< DebugWriterContext > get_context() const
get the debugging writer context
Definition: debug_writer.h:179
void enter_section(const char *secDir)
enter a new debugging section
Definition: debug_writer.h:195
virtual void write_vector(const vector_type &vec, const char *name)=0
write vector
IVectorDebugWriter()
Constructor.
Definition: debug_writer.h:125
std::vector< MathVector< 3 > > m_vPos3d
Definition: debug_writer.h:227
void compose_file_path(std::string &path)
composes the path for the files and creates the intermediate directories (up to the base one):
Definition: debug_writer.h:210
int current_dimension() const
returns the current dimension
Definition: debug_writer.h:135
Instances of this class or of derived classes are thrown if errors arise.
Definition: error.h:104
Definition: debug_writer.h:266
bool vector_debug_writer_valid() const
returns true if the debug writer is set
Definition: debug_writer.h:290
virtual ~VectorDebugWritingObject()
virtual destructor
Definition: debug_writer.h:277
virtual void write_debug(const vector_type &vec, std::string name)
writing debug output for a vector (if debug writer set)
Definition: debug_writer.h:300
SmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer()
returns the debug writer
Definition: debug_writer.h:286
void enter_vector_debug_writer_section(std::string secDir)
enters a debugging section
Definition: debug_writer.h:331
VectorDebugWritingObject(SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
Definition: debug_writer.h:273
void leave_vector_debug_writer_section()
leaves a debugging section
Definition: debug_writer.h:342
VectorDebugWritingObject()
Definition: debug_writer.h:272
virtual void set_debug(SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
set debug writer
Definition: debug_writer.h:280
void print_debugger_message(const char *msg)
prints a debugger message (listing all the sections)
Definition: debug_writer.h:325
void enter_vector_debug_writer_section(const char *secDir)
enters a debugging section
Definition: debug_writer.h:336
SmartPtr< IVectorDebugWriter< vector_type > > m_spVectorDebugWriter
Debug Writer.
Definition: debug_writer.h:349
void write_debug(const vector_type &vec, const char *filename)
writing debug output for a vector (if debug writer set)
Definition: debug_writer.h:293
TVector vector_type
type of vector
Definition: debug_writer.h:269
ConstSmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer() const
Definition: debug_writer.h:287
void print_debugger_message(std::string msg)
prints a debugger message (listing all the sections)
Definition: debug_writer.h:320
UG_API bool FileExists(const char *filename)
!!! Serial i/o version !!!
Definition: file_util.cpp:53
UG_API bool CreateDirectory(const char *directory)
Creates a directory.
Definition: file_util_posix.cpp:149
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
#define UG_WARNING(msg)
Definition: log.h:328
#define PROFILE_FUNC_GROUP(groups)
Definition: profiler.h:258
Definition: metaprogramming_util.h:42
function ProblemDisc new(problemDesc, dom)