44 #include "DenseLinAlgPack_DVectorInFunc.hpp"
45 #include "DenseLinAlgPack_DVectorClass.hpp"
46 #include "DenseLinAlgPack_AssertOp.hpp"
52 std::istream& DenseLinAlgPack::input(std::istream& is, DVector* v, LinAlgPackIO::fmtflags extra_flags) {
53 if( !(extra_flags & LinAlgPackIO::ignore_dim_bit) ) {
57 throw LinAlgPackIO::InputException(
"DenseLinAlgPack::input() {DVector}: Input operation of vector dimension failed. Check that the constant n is a valid integer.");
59 throw std::ios_base::failure(
"DenseLinAlgPack::input() {DVector}: Input operation failed because the stream became currupted.");
62 return input_vs(is,&(*v)(),
"DenseLinAlgPack::input() {DVector}");
65 std::istream& DenseLinAlgPack::input(std::istream& is, DVectorSlice* vs, LinAlgPackIO::fmtflags extra_flags) {
66 if( !(extra_flags & LinAlgPackIO::ignore_dim_bit) ) {
70 throw LinAlgPackIO::InputException(
"DenseLinAlgPack::input() {DVectorSlice}: Input operation of vector dimension failed. Check that the constant n is a valid integer.");
72 throw std::ios_base::failure(
"DenseLinAlgPack::input() {DVectorSlice}: Input operation failed because the stream became currupted.");
73 DenseLinAlgPack::Vp_V_assert_sizes( vs->dim(), n );
75 return input_vs(is,vs,
"DenseLinAlgPack::input() {DVectorSlice}");
93 if(!vs->
dim())
return is;
94 ios_base::iostate old_state = is.exceptions();
95 is.exceptions(ios_base::badbit | ios_base::failbit);
98 for(DVectorSlice::iterator itr = vs->begin(); itr != vs->
end(); ++itr)
101 catch(std::ios_base::failure& excpt) {
102 is.exceptions(old_state);
105 std::ostringstream os;
106 os << func <<
": An vector element input failed. Check that the vector element is a valid C number. "
111 std::ostringstream os;
112 os << func <<
": DVector input failed. The end of the file was found before all of the elements where read in. "
118 is.exceptions(old_state);
121 is.exceptions(old_state);
size_type dim() const
Returns the number of elements of the VectorSliceTmpl.