33 #ifndef __H__LIB_ALGEBRA__OPERATOR__ALGEBRA_DEBUG_WRITER__
34 #define __H__LIB_ALGEBRA__OPERATOR__ALGEBRA_DEBUG_WRITER__
44 template <
typename TAlgebra>
71 case 1: write_vector_dim<1>(vec, filename);
break;
72 case 2: write_vector_dim<2>(vec, filename);
break;
73 case 3: write_vector_dim<3>(vec, filename);
break;
74 default:
UG_ASSERT(0,
"Dimension not implemented.");
84 UG_THROW(
"Only '.mat' format supported for matrices, but"
85 " filename is '" << filename <<
"'.");
90 case 1: write_matrix_dim<1>(mat, filename);
break;
91 case 2: write_matrix_dim<2>(mat, filename);
break;
92 case 3: write_matrix_dim<3>(mat, filename);
break;
93 default:
UG_ASSERT(0,
"Dimension not implemented.");
103 const std::vector<MathVector<dim> > &posvec = base_type::template get_positions<dim>();
105 if(vec.size() > posvec.size())
106 UG_THROW(
"'AlgebraDebugWriter::write_vector':"
107 " Number of positions does not match. Vector has "
108 << vec.size() <<
" elements, but " << posvec.size() <<
" positions were supplied!\n");
111 ConnectionViewer::WriteVectorPar<vector_type, MathVector<dim> >(
name, vec, &posvec[0],
dim);
118 const char* filename)
121 const std::vector<MathVector<dim> > &posvec = base_type::template get_positions<dim>();
123 if(mat.num_rows() > posvec.size() || mat.num_cols() > posvec.size())
124 UG_THROW(
"'AlgebraDebugWriter::write_matrix':"
125 " Number of positions does not match: Matrix has "
126 << mat.num_rows() <<
" rows, " << mat.num_cols() <<
" cols, but "
127 << posvec.size()<<
"positions were supplied." <<
"\n");
129 ConnectionViewer::WriteMatrixPar<matrix_type, MathVector<dim> >
130 (
name, mat, &base_type::template get_positions<dim>()[0],
dim);
location name
Definition: checkpoint_util.lua:128
Debug writer for connection viewer (based on algebraic information + vector positions only)
Definition: algebra_debug_writer.h:46
virtual void write_matrix(const matrix_type &mat, const char *filename)
write matrix
Definition: algebra_debug_writer.h:79
AlgebraDebugWriter()
Constructor.
Definition: algebra_debug_writer.h:63
algebra_type::matrix_type matrix_type
type of matrix
Definition: algebra_debug_writer.h:55
void write_vector_dim(const vector_type &vec, const char *filename)
auxiliary function for vectors
Definition: algebra_debug_writer.h:100
algebra_type::vector_type vector_type
type of vector
Definition: algebra_debug_writer.h:52
IDebugWriter< TAlgebra > base_type
type of base
Definition: algebra_debug_writer.h:58
TAlgebra algebra_type
type of matrix
Definition: algebra_debug_writer.h:49
void write_matrix_dim(const matrix_type &mat, const char *filename)
auxiliary function for matrices
Definition: algebra_debug_writer.h:117
virtual void write_vector(const vector_type &vec, const char *filename)
write vector
Definition: algebra_debug_writer.h:66
base class for all debug writer
Definition: debug_writer.h:244
std::string get_base_dir()
Definition: debug_writer.h:192
int current_dimension() const
returns the current dimension
Definition: debug_writer.h:135
bool FileTypeIs(const char *filename, const char *extension)
!!! Serial i/o version !!!
Definition: file_util.cpp:86
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_THROW(msg)
Definition: error.h:57