if (!expect_constrained_source)
{
GrowingVectorMemory<VectorType> mem;
- VectorType *tmp_vector = mem.alloc();
+ typename VectorMemory<VectorType>::Pointer tmp_vector (mem);
// first copy over src vector and
// pre-filter
tmp_vector->reinit(src, true);
pre_filter (*tmp_vector);
// then let matrix do its work
matrix->vmult (dst, *tmp_vector);
- mem.free(tmp_vector);
}
else
{
if (!expect_constrained_source)
{
GrowingVectorMemory<VectorType> mem;
- VectorType *tmp_vector = mem.alloc();
+ typename VectorMemory<VectorType>::Pointer tmp_vector (mem);
// first copy over src vector and
// pre-filter
tmp_vector->reinit(src, true);
pre_filter (*tmp_vector);
// then let matrix do its work
matrix->Tvmult (dst, *tmp_vector);
- mem.free(tmp_vector);
}
else
{
if (!expect_constrained_source)
{
GrowingVectorMemory<VectorType> mem;
- VectorType *tmp_vector = mem.alloc();
+ typename VectorMemory<VectorType>::Pointer tmp_vector (mem);
// first copy over src vector and
// pre-filter
tmp_vector->reinit(src, true);
pre_filter (*tmp_vector);
// then let matrix do its work
matrix->vmult_add (dst, *tmp_vector);
- mem.free(tmp_vector);
}
else
{
if (!expect_constrained_source)
{
GrowingVectorMemory<VectorType> mem;
- VectorType *tmp_vector = mem.alloc();
+ typename VectorMemory<VectorType>::Pointer tmp_vector (mem);
// first copy over src vector and
// pre-filter
tmp_vector->reinit(src, true);
pre_filter (*tmp_vector);
// then let matrix do its work
matrix->Tvmult_add (dst, *tmp_vector);
- mem.free(tmp_vector);
}
else
{
/**
* Auxiliary vector.
*/
- VectorType *Vr;
+ typename VectorMemory<VectorType>::Pointer Vr;
/**
* Auxiliary vector.
*/
- VectorType *Vrbar;
+ typename VectorMemory<VectorType>::Pointer Vrbar;
/**
* Auxiliary vector.
*/
- VectorType *Vp;
+ typename VectorMemory<VectorType>::Pointer Vp;
/**
* Auxiliary vector.
*/
- VectorType *Vy;
+ typename VectorMemory<VectorType>::Pointer Vy;
/**
* Auxiliary vector.
*/
- VectorType *Vz;
+ typename VectorMemory<VectorType>::Pointer Vz;
/**
* Auxiliary vector.
*/
- VectorType *Vt;
+ typename VectorMemory<VectorType>::Pointer Vt;
/**
* Auxiliary vector.
*/
- VectorType *Vv;
+ typename VectorMemory<VectorType>::Pointer Vv;
/**
* Right hand side vector.
*/
const AdditionalData &data)
:
Solver<VectorType>(cn),
- Vx(nullptr),
- Vr(nullptr),
- Vrbar(nullptr),
- Vp(nullptr),
- Vy(nullptr),
- Vz(nullptr),
- Vt(nullptr),
- Vv(nullptr),
- Vb(nullptr),
alpha(0.),
beta(0.),
omega(0.),
const PreconditionerType &preconditioner)
{
deallog.push("Bicgstab");
- Vr = this->memory.alloc();
+ Vr = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vrbar = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vp = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vy = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vz = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vt = typename VectorMemory<VectorType>::Pointer(this->memory);
+ Vv = typename VectorMemory<VectorType>::Pointer(this->memory);
+
Vr->reinit(x, true);
- Vrbar = this->memory.alloc();
Vrbar->reinit(x, true);
- Vp = this->memory.alloc();
Vp->reinit(x, true);
- Vy = this->memory.alloc();
Vy->reinit(x, true);
- Vz = this->memory.alloc();
Vz->reinit(x, true);
- Vt = this->memory.alloc();
Vt->reinit(x, true);
- Vv = this->memory.alloc();
Vv->reinit(x, true);
Vx = &x;
}
while (state.breakdown == true);
- this->memory.free(Vr);
- this->memory.free(Vrbar);
- this->memory.free(Vp);
- this->memory.free(Vy);
- this->memory.free(Vz);
- this->memory.free(Vt);
- this->memory.free(Vv);
-
deallog.pop();
// in case of failure: throw exception
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// Initialize intermediate vector
const Epetra_Map &first_op_init_map = first_op.OperatorDomainMap();
first_op.Apply(tril_src, tril_dst);
const int ierr = tril_dst.Update (1.0, tril_int, 1.0);
AssertThrow (ierr == 0, ExcTrilinosError(ierr));
-
- vector_memory.free(i);
};
return_op.Tvmult = [first_op, second_op](Domain &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// These operators may themselves be transposed or not, so we let them
// decide what the intended outcome is
// Reset transpose flag
const_cast<TrilinosPayload &>(first_op).transpose();
const_cast<TrilinosPayload &>(second_op).transpose();
-
- vector_memory.free(i);
};
return_op.inv_vmult = [first_op, second_op](Domain &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// Initialize intermediate vector
const Epetra_Map &first_op_init_map = first_op.OperatorRangeMap();
first_op.ApplyInverse(tril_src, tril_dst);
const int ierr = tril_dst.Update (1.0, tril_int, 1.0);
AssertThrow (ierr == 0, ExcTrilinosError(ierr));
-
- vector_memory.free(i);
};
return_op.inv_Tvmult = [first_op, second_op](Range &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// These operators may themselves be transposed or not, so we let them
// decide what the intended outcome is
// Reset transpose flag
const_cast<TrilinosPayload &>(first_op).transpose();
const_cast<TrilinosPayload &>(second_op).transpose();
-
- vector_memory.free(i);
};
return return_op;
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// Initialize intermediate vector
const Epetra_Map &first_op_init_map = first_op.OperatorDomainMap();
// decide what the intended outcome is
second_op.Apply(tril_src, tril_int);
first_op.Apply(tril_int, tril_dst);
-
- vector_memory.free(i);
};
return_op.Tvmult = [first_op, second_op](Domain &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// These operators may themselves be transposed or not, so we let them
// decide what the intended outcome is
// Reset transpose flag
const_cast<TrilinosPayload &>(first_op).transpose();
const_cast<TrilinosPayload &>(second_op).transpose();
-
- vector_memory.free(i);
};
return_op.inv_vmult = [first_op, second_op](Domain &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// Initialize intermediate vector
const Epetra_Map &first_op_init_map = first_op.OperatorRangeMap();
// and the same order as Tvmult
first_op.ApplyInverse(tril_src, tril_int);
second_op.ApplyInverse(tril_int, tril_dst);
-
- vector_memory.free(i);
};
return_op.inv_Tvmult = [first_op, second_op](Range &tril_dst,
// Duplicated from LinearOperator::operator*
// TODO: Template the constructor on GrowingVectorMemory vector type?
GrowingVectorMemory<GVMVectorType> vector_memory;
- GVMVectorType *i = vector_memory.alloc();
+ VectorMemory<GVMVectorType>::Pointer i (vector_memory);
// These operators may themselves be transposed or not, so we let them
// decide what the intended outcome is
// Reset transpose flag
const_cast<TrilinosPayload &>(first_op).transpose();
const_cast<TrilinosPayload &>(second_op).transpose();
-
- vector_memory.free(i);
};
return return_op;