# -Wl,-rpath in our linker flags, we create one convenience library
# for all PETSc libraries in our own lib directory, and have this one
# twiddle with whatever is necessary to link in PETSc.
-lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/libg_c++/$(DEAL_II_PETSC_ARCH)
-lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/libO_c++/$(DEAL_II_PETSC_ARCH)
+#
+# to make things more fun, the whole scheme was changed in petsc 2.3.0
+ifeq ($(DEAL_II_PETSC_VERSION_MINOR),2)
+ lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/libg_c++/$(DEAL_II_PETSC_ARCH)
+ lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/libO_c++/$(DEAL_II_PETSC_ARCH)
+else
+ lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)
+ lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)
+endif
lib-contrib-petsc.g = $(LIBDIR)/libpetsc.g$(lib-suffix)
lib-contrib-petsc.o = $(LIBDIR)/libpetsc$(lib-suffix)
# be replaced by something where we do not blindly include PETSc make files
# (and thus import all of its variables), but rather set up a scheme to
# extract these values upon configuration
+#
+# note also that this only works for PETSc before 2.3 :-]
ifeq ($(USE_CONTRIB_PETSC),yes)
- include $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)/packages
+ ifeq ($(DEAL_II_PETSC_VERSION_MINOR),2)
+ include $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)/packages
+ endif
INCLUDE += -I$(include-path-petsc) -I$(include-path-petsc-bmake)\
$(MPI_INCLUDE)
endif
# PETSc wants to see a whole lot of other flags being passed. ...
ifeq ($(USE_CONTRIB_PETSC),yes)
- include $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)/variables
+ ifeq ($(DEAL_II_PETSC_VERSION_MINOR),2)
+ include $(DEAL_II_PETSC_DIR)/bmake/$(DEAL_II_PETSC_ARCH)/variables
+ else
+ include $(DEAL_II_PETSC_DIR)/bmake/common/variables
+ endif
CXXFLAGS.g += $(GCXX_PETSCFLAGS)
CXXFLAGS.o += $(OCXX_PETSCFLAGS)
endif
// (see test bits/petsc_65)
compress ();
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
const int ierr = VecSet (&s, vector);
+#else
+ const int ierr = VecSet (vector, s);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase &
VectorBase::operator *= (const PetscScalar a)
{
- const int ierr
- = VecScale (&a, vector);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecScale (&a, vector);
+#else
+ const int ierr = VecScale (vector, a);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
{
const PetscScalar factor = 1./a;
- const int ierr
- = VecScale (&factor, vector);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecScale (&factor, vector);
+#else
+ const int ierr = VecScale (vector, factor);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase &
VectorBase::operator += (const VectorBase &v)
{
- const PetscScalar one = 1.0;
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const PetscScalar one = 1.0;
+ const int ierr = VecAXPY (&one, v, vector);
+#else
+ const int ierr = VecAXPY (vector, 1, v);
+#endif
- const int ierr
- = VecAXPY (&one, v, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
VectorBase &
VectorBase::operator -= (const VectorBase &v)
{
- const PetscScalar minus_one = -1.0;
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const PetscScalar minus_one = -1.0;
+ const int ierr = VecAXPY (&minus_one, v, vector);
+#else
+ const int ierr = VecAXPY (vector, -1, v);
+#endif
- const int ierr
- = VecAXPY (&minus_one, v, vector);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return *this;
void
VectorBase::add (const PetscScalar s)
{
- const int ierr
- = VecShift (&s, vector);
+ #if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecShift (&s, vector);
+#else
+ const int ierr = VecShift (vector, s);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
VectorBase::add (const PetscScalar a,
const VectorBase &v)
{
- const int ierr
- = VecAXPY (&a, v, vector);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecAXPY (&a, v, vector);
+#else
+ const int ierr = VecAXPY (vector, a, v);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
void
VectorBase::add (const PetscScalar a,
- const VectorBase &v,
+ const VectorBase &v,
const PetscScalar b,
- const VectorBase &w)
+ const VectorBase &w)
{
const PetscScalar weights[2] = {a,b};
Vec addends[2] = {v.vector, w.vector};
- const int ierr
- = VecMAXPY (2, weights, vector, addends);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecMAXPY (2, weights, vector, addends);
+#else
+ const int ierr = VecMAXPY (vector, 2, weights, addends);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
void
VectorBase::sadd (const PetscScalar s,
- const VectorBase &v)
+ const VectorBase &v)
{
- const int ierr
- = VecAYPX (&s, v, vector);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecAYPX (&s, v, vector);
+#else
+ const int ierr = VecAYPX (vector, s, v);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscScalar weights[2] = {a,b};
Vec addends[2] = {v.vector,w.vector};
- const int ierr
- = VecMAXPY (2, weights, vector, addends);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecMAXPY (2, weights, vector, addends);
+#else
+ const int ierr = VecMAXPY (vector, 2, weights, addends);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
const PetscScalar weights[3] = {a,b,c};
Vec addends[3] = {v.vector, w.vector, x.vector};
- const int ierr
- = VecMAXPY (3, weights, vector, addends);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecMAXPY (3, weights, vector, addends);
+#else
+ const int ierr = VecMAXPY (vector, 3, weights, addends);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
void
VectorBase::equ (const PetscScalar a,
- const VectorBase &v)
+ const VectorBase &v)
{
Assert (size() == v.size(),
ExcDimensionMismatch (size(), v.size()));
void
VectorBase::equ (const PetscScalar a,
- const VectorBase &v,
+ const VectorBase &v,
const PetscScalar b,
- const VectorBase &w)
+ const VectorBase &w)
{
Assert (size() == v.size(),
ExcDimensionMismatch (size(), v.size()));
VectorBase::ratio (const VectorBase &a,
const VectorBase &b)
{
- const int ierr
- = VecPointwiseDivide (a, b, vector);
+#if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR < 3)
+ const int ierr = VecPointwiseDivide (a, b, vector);
+#else
+ const int ierr = VecPointwiseDivide (vector, a, b);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
}
+
void
VectorBase::swap (VectorBase &v)
{