* be disallowed in the future.
*/
Vector &
- operator= (const TrilinosScalar s);
+ operator = (const TrilinosScalar s);
/**
* Copy the given vector. Resize
* necessary.
*/
Vector &
- operator= (const Vector &v);
+ operator = (const Vector &v);
/**
* Another copy function. This
* deal.II vector.
*/
Vector &
- operator= (const ::dealii::Vector<double> &v);
+ operator = (const ::dealii::Vector<double> &v);
/**
* Test for equality. This
* element, both read and write.
*/
reference
- operator () (const unsigned int index);
+ operator () (const unsigned int index);
/**
* Provide read-only access to an
* command.
*/
TrilinosScalar
- operator () (const unsigned int index) const;
+ operator () (const unsigned int index) const;
/**
* Return the value of the vector
LocalizedVector ();
/**
- * This constructor takes an
- * Epetra_LocalMap that already knows
- * the number of elements in the vector.
+ * This constructor takes as
+ * input the number of elements
+ * in the vector.
*/
- LocalizedVector (const Epetra_LocalMap &InputMap);
+ LocalizedVector (const unsigned int n);
/**
* This constructor takes a
* LocalizedVector based on a
* LocalizedVector input.
*/
- LocalizedVector (const LocalizedVector &V);
+ LocalizedVector (const LocalizedVector &V,
+ const bool fast);
+
+ /**
+ * Reinit function that resizes
+ * the vector to the size
+ * specified by <tt>n</tt>.
+ */
+ void reinit (unsigned int n);
/**
* Reinit function. Takes the
- LocalizedVector::LocalizedVector (const Epetra_LocalMap &InputMap)
+ LocalizedVector::LocalizedVector (const unsigned int n)
:
- map (InputMap),
- vector (std::auto_ptr<Epetra_MultiVector>
- (new Epetra_MultiVector(map,1)))
- {}
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+ map ((int)n, 0, Epetra_MpiComm(MPI_COMM_WORLD))
+#else
+ map ((int)n, 0, Epetra_SerialComm())
+#endif
+ {
+ reinit (n);
+ }
+ LocalizedVector::LocalizedVector (const LocalizedVector &v,
+ const bool fast)
+ :
+ map (v.map),
+ vector (std::auto_ptr<Epetra_MultiVector>
+ (new Epetra_MultiVector(map,1,!fast)))
+ {}
+
+
+
+ void
+ LocalizedVector::reinit (unsigned int n)
+ {
+
+ if (map.NumGlobalElements() != (int)n)
+ {
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+ map = Epetra_LocalMap ((int)n, 0, Epetra_MpiComm(MPI_COMM_WORLD));
+#else
+ map = Epetra_LocalMap ((int)n, 0, Epetra_SerialComm());
+#endif
+ }
+
+ vector = std::auto_ptr<Epetra_MultiVector>
+ (new Epetra_MultiVector (map,1,true));
+ }
+
void
LocalizedVector::reinit (const Vector &v)
{
map = Epetra_LocalMap (v.size(),0,v.vector->Comm());
- vector = std::auto_ptr<Epetra_MultiVector> (new Epetra_MultiVector (map,1,false));
+ vector = std::auto_ptr<Epetra_MultiVector>
+ (new Epetra_MultiVector (map,1,false));
*vector = *v.vector;
}