/usr/include/trilinos/AbstractLinAlgPack_VectorMutableDense.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | // @HEADER
// ***********************************************************************
//
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
// Copyright (2003) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef VECTOR_WITH_OP_MUTABLE_DENSE_H
#define VECTOR_WITH_OP_MUTABLE_DENSE_H
#include "AbstractLinAlgPack_VectorSpaceSerial.hpp"
#include "AbstractLinAlgPack_VectorMutable.hpp"
#include "AbstractLinAlgPack_VectorApplyOpSerialBase.hpp"
#include "DenseLinAlgPack_DVectorClass.hpp"
#include "Teuchos_RCP.hpp"
#include "ReleaseResource.hpp"
namespace AbstractLinAlgPack {
/** \brief DVector "Adaptor" subclass for <tt>DenseLinAlgPack::DVectorSlice</tt>
* or <tt>DenseLinAlgPack::DVector</tt> objects.
*
* This class can be used either as a view of a <tt>DenseLinAlgPack::DVectorSlice</tt> object
* or as a storage type for a <tt>DenseLinAlgPack::DVector</tt> object.
*
* To create a storage type with the dimension of \c dim just call the constructor
* <tt>VectorMutableDense(dim)</tt> or after construction you can call
* <tt>this->initialize(dim)</tt>.
*
* To simply create a view of a vector, say \c v, without ownership just call
* <tt>VectorMutableDense(v(),NULL)</tt> or after construction call
* <tt>this->initialize(v(),NULL)</tt>.
*
* Alternately, \c this can be given a vector with the responsibility to
* delete any associated memory by calling <tt>this->initialize()</tt>
* with a <tt>ReleaseResource</tt> object to perform the deallocation.
*
* If \c this has been initialized by <tt>this->initialize(dim)</tt> and if
* the client really needs to get at the <tt>DenseLinAlgPack::DVector</tt> object
* itself, then it can be obtained as:
\code
void f( VectorMutableDense* v )
namespace rmp = MemMngPack;
DVector &_v = *dynamic_cast<rmp::ReleaseResource_ref_count_ptr<DVector>&>(*v.vec_release()).ptr;
\endcode
* This is not pretty but it is not supposed to be. Of course the above function will throw
* an exception if the <tt>dynamic_cast<></tt> fails.
*/
class VectorMutableDense
: virtual public VectorMutable
, virtual private VectorApplyOpSerialBase
{
public:
/** \brief . */
typedef Teuchos::RCP<
MemMngPack::ReleaseResource> release_resource_ptr_t;
/** @name Constructors/initializers */
//@{
/** \brief Calls <tt>this->initialize(dim)</tt>.
*/
VectorMutableDense(
const size_type dim = 0
);
/** \brief Calls <tt>this->initialize(v,v_release)</tt>.
*/
VectorMutableDense(
DVectorSlice v
,const release_resource_ptr_t& v_release
);
/** \brief Call <tt>this->initialize(v,v_release)</tt> with an allocated <tt>DenseLinAlgPack::DVector</tt>
* object.
*/
void initialize(
const size_type dim
);
/** \brief Initialize with a dense vector slice.
*/
void initialize(
DVectorSlice v
,const release_resource_ptr_t& v_release
);
//@}
/** @name Access */
//@{
/** \brief Return the non-const dense vector.
*
* Note that calling this method will result in the vector implementation
* being modified. Therefore, no other methods on \c this object should be
* called until the <tt>DVectorSlice</tt> returned from this method is
* discarded.
*
* Note that the underlying implementation calls <tt>this->has_changed()</tt>
* before this method returns.
*/
DVectorSlice set_vec();
/** \brief Return a const dense vector.
*/
const DVectorSlice get_vec() const;
/** \brief Return a <tt>RCP<></tt> pointer to the object that will
* release the associated resource.
*/
const release_resource_ptr_t& vec_release() const;
//@}
/** @name Overriddenn from Vector */
//@{
/** \brief . */
const VectorSpace& space() const;
/** \brief . */
void apply_op(
const RTOpPack::RTOp& op
,const size_t num_vecs, const Vector* vecs[]
,const size_t num_targ_vecs, VectorMutable* targ_vecs[]
,RTOpPack::ReductTarget *reduct_obj
,const index_type first_ele, const index_type sub_dim, const index_type global_offset
) const;
/** \brief . */
index_type dim() const;
/** \brief . */
value_type get_ele(index_type i) const;
/** \brief . */
void get_sub_vector( const Range1D& rng, RTOpPack::SubVector* sub_vec ) const;
/** \brief . */
void free_sub_vector( RTOpPack::SubVector* sub_vec ) const;
//@}
/** @name Overriddenn from VectorMutable */
//@{
/** \brief . */
VectorMutable& operator=(value_type alpha);
/** \brief . */
VectorMutable& operator=(const Vector& v);
/** \brief . */
VectorMutable& operator=(const VectorMutable& v);
/** \brief . */
void set_ele( index_type i, value_type val );
/** \brief . */
vec_mut_ptr_t sub_view( const Range1D& rng );
/** \brief . */
void get_sub_vector( const Range1D& rng, RTOpPack::MutableSubVector* sub_vec );
/** \brief . */
void commit_sub_vector( RTOpPack::MutableSubVector* sub_vec );
/** \brief . */
void set_sub_vector( const RTOpPack::SparseSubVector& sub_vec );
/** \brief . */
void Vp_StMtV(
value_type alpha
,const GenPermMatrixSlice &P
,BLAS_Cpp::Transp P_trans
,const Vector &x
,value_type beta
);
//@}
/// Hack
VectorMutableDense* operator&()
{
return this;
}
private:
// ///////////////////////////////////////
// Private data members
DVectorSlice v_;
release_resource_ptr_t v_release_;
VectorSpaceSerial space_;
// Not defined and not to be called
//VectorMutableDense(const VectorMutableDense&);
VectorMutableDense& operator=(const VectorMutableDense&);
}; // end class VectorMutableDense
// //////////////////////////////////////
// Inline members
inline
DVectorSlice
VectorMutableDense::set_vec()
{
this->has_changed();
return v_;
}
inline
const DVectorSlice
VectorMutableDense::get_vec() const
{
return v_;
}
inline
const VectorMutableDense::release_resource_ptr_t&
VectorMutableDense::vec_release() const
{
return v_release_;
}
} // end namespace AbstractLinAlgPack
#endif // VECTOR_WITH_OP_MUTABLE_DENSE_H
|