Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "SundanceEvalVectorArray.hpp"
00044 #include "SundanceSparsitySuperset.hpp"
00045 #include "PlayaTabs.hpp"
00046
00047 using namespace Sundance;
00048 using namespace Sundance;
00049
00050 using namespace Teuchos;
00051
00052 EvalVectorArray::EvalVectorArray()
00053 : Array<RCP<EvalVector> >()
00054 {;}
00055
00056 void EvalVectorArray::copy(const RCP<EvalVectorArray>& other)
00057 {
00058 resize(other->size());
00059
00060 for (int i=0; i<other->size(); i++)
00061 {
00062 (*this)[i]->copy((*other)[i]);
00063 }
00064 }
00065
00066 void EvalVectorArray::steal(const RCP<EvalVectorArray>& other)
00067 {
00068 resize(other->size());
00069
00070 for (int i=0; i<other->size(); i++)
00071 {
00072 (*this)[i] = (*other)[i];
00073 }
00074 }
00075
00076 ostream& EvalVectorArray::print(std::ostream& os,
00077 const SparsitySuperset* derivs) const
00078 {
00079 Tabs tab;
00080 TEUCHOS_TEST_FOR_EXCEPTION(derivs->numDerivs() != this->size(),
00081 std::logic_error,
00082 "mismatch between deriv set size=" << derivs->numDerivs()
00083 << "and result vector size " << this->size()
00084 << "in EvalVectorArray::print");
00085
00086 int maxlen = 25;
00087 for (int i=0; i<derivs->numDerivs(); i++)
00088 {
00089 int s = derivs->deriv(i).toString().length();
00090 if (s > maxlen) maxlen = s;
00091 }
00092
00093 for (int i=0; i<derivs->numDerivs(); i++)
00094 {
00095 os << tab;
00096 os.width(maxlen);
00097 os.setf(ios_base::left, ios_base::adjustfield);
00098 os << derivs->deriv(i).toString() << "\t\t";
00099 (*this)[i]->print(os);
00100 os << std::endl;
00101 }
00102 return os;
00103 }