Vector::reinit (const Epetra_Map &input_map,
const bool fast)
{
- vector.reset();
- map = input_map;
- (void)fast;
+ if (vector->Map().SameAs(input_map) == false)
+ {
+ vector.reset();
+ map = input_map;
- vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
+ vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
+ }
+ else if (fast == false)
+ {
+ const int ierr = vector->PutScalar(0.);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ }
+
last_action = Zero;
}
// generate the vector.
if (allow_different_maps == false)
{
- vector.reset();
if (map.SameAs(v.vector->Map()) == false)
- map = Epetra_Map(v.vector->Map().NumGlobalElements(),
- v.vector->Map().NumMyElements(),
- v.vector->Map().IndexBase(),
- v.vector->Map().Comm());
-
- vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
- last_action = Zero;
+ {
+ vector.reset();
+ map = Epetra_Map(v.vector->Map().NumGlobalElements(),
+ v.vector->Map().NumMyElements(),
+ v.vector->Map().IndexBase(),
+ v.vector->Map().Comm());
+
+ vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
+ last_action = Zero;
+ }
+ else if (fast == false)
+ {
+ int ierr;
+ ierr = vector->GlobalAssemble (last_action);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+
+ ierr = vector->PutScalar(0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+
+ last_action = Zero;
+ }
}
// Otherwise, we have to check
Vector::operator = (const Vector &v)
{
if (vector->Map().SameAs(v.vector->Map()) == true)
- *vector = *v.vector;
+ {
+ vector->GlobalAssemble(last_action);
+ const int ierr = vector->Update(1.0, *v.vector, 0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+
+ last_action = Insert;
+ }
else
{
vector.reset();
v.vector->Map().NumMyElements(),
v.vector->Map().IndexBase(),
v.vector->Map().Comm());
- vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(*v.vector));
+ vector = std::auto_ptr<Epetra_FEVector>
+ (new Epetra_FEVector(*v.vector));
+ last_action = Zero;
}
return *this;
map ((int)n, 0, Epetra_SerialComm())
#endif
{
- reinit (n);
+ last_action = Zero;
+ vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector (map));
}
Vector::Vector (const Epetra_Map &InputMap)
:
- map (InputMap.NumGlobalElements(), 0, InputMap.Comm())
+ map (InputMap.NumGlobalElements(), InputMap.IndexBase(),
+ InputMap.Comm())
{
last_action = Zero;
vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
if (vector->Map().SameAs(v.vector->Map()) == true)
- *vector = *v.vector;
+ {
+ const int ierr = vector->Update(1.0, *v.vector, 0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ }
else
reinit (v, false, true);
map = Epetra_LocalMap ((int)n, 0, Epetra_SerialComm());
#endif
- last_action = Zero;
-
vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector (map));
}
+ else if (fast == false)
+ {
+ int ierr;
+ ierr = vector->GlobalAssemble(last_action);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+
+ ierr = vector->PutScalar(0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ }
+
+ last_action = Zero;
}
Vector::reinit (const Epetra_Map &input_map,
const bool fast)
{
- vector.reset();
-
if (map.NumGlobalElements() != input_map.NumGlobalElements())
{
+ vector.reset();
map = Epetra_LocalMap (input_map.NumGlobalElements(),
input_map.IndexBase(),
input_map.Comm());
+ vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector (map));
}
+ else if (fast == false)
+ {
+ int ierr;
+ ierr = vector->GlobalAssemble(last_action);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
- last_action = Zero;
+ ierr = vector->PutScalar(0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ }
- (void)fast;
- vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector (map));
+ last_action = Zero;
}
-
void
Vector::reinit (const VectorBase &v,
const bool fast,
// generate the vector.
if (allow_different_maps == false)
{
- vector.reset();
if (map.SameAs(v.vector->Map()) == false)
- map = Epetra_LocalMap (v.vector->GlobalLength(),
- v.vector->Map().IndexBase(),
- v.vector->Comm());
-
- vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
+ {
+ vector.reset();
+ map = Epetra_LocalMap (v.vector->GlobalLength(),
+ v.vector->Map().IndexBase(),
+ v.vector->Comm());
+
+ vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
+ }
+ else
+ {
+ int ierr;
+ ierr = vector->GlobalAssemble(last_action);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+
+ ierr = vector->PutScalar(0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ }
last_action = Zero;
}
{
if (size() != v.size())
{
+ vector.reset();
map = Epetra_LocalMap (v.vector->Map().NumGlobalElements(),
v.vector->Map().IndexBase(),
v.vector->Comm());
vector = std::auto_ptr<Epetra_FEVector> (new Epetra_FEVector(map));
}
- *vector = *v.vector;
+ const int ierr = vector->Update(1.0, *v.vector, 0.0);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
return *this;
}