"^[0-9]+\\.([0-9]+).*$" "\\1"
TRILINOS_VERSION_MINOR "${Trilinos_VERSION}")
+ # If there is no subminor number, then the REGEX REPLACE will fail,
+ # setting TRILINOS_VERSION_PATCH to TRILINOS_VERSION. If that
+ # is the case, then set the subminor number to zero
STRING(REGEX REPLACE
- "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1"
+ "^[0-9]+\\.[0-9]+\\.([0-9]+)?.*$" "\\1"
TRILINOS_VERSION_SUBMINOR "${Trilinos_VERSION}")
+ IF(${TRILINOS_VERSION_SUBMINOR} STREQUAL "${Trilinos_VERSION}")
+ SET(TRILINOS_VERSION_SUBMINOR "0")
+ ENDIF()
ENDIF()
#
#ifdef DEAL_II_WITH_TRILINOS
/** Compatibility definition (with naming from deal.II < 8.0): */
# define DEAL_II_USE_TRILINOS
+
+# define DEAL_II_TRILINOS_VERSION_MAJOR @TRILINOS_VERSION_MAJOR@
+# define DEAL_II_TRILINOS_VERSION_MINOR @TRILINOS_VERSION_MINOR@
+# define DEAL_II_TRILINOS_VERSION_SUBMINOR @TRILINOS_VERSION_SUBMINOR@
+
+# define DEAL_II_TRILINOS_VERSION_GTE(major,minor,subminor) \
+ ((DEAL_II_TRILINOS_VERSION_MAJOR * 10000 + \
+ DEAL_II_TRILINOS_VERSION_MINOR * 100 + \
+ DEAL_II_TRILINOS_VERSION_SUBMINOR) \
+ >= \
+ (major)*10000 + (minor)*100 + (subminor))
#endif
AssertThrow (size() == v.size(),
ExcDimensionMismatch (size(), v.size()));
- //HACK: For some reason the following doesn't work properly, so do it manually
- // Epetra_Import data_exchange (vector->Map(), v.vector->Map());
- // int ierr = vector->Import(*v.vector, data_exchange, Add);
- // AssertThrow (ierr == 0, ExcTrilinosError(ierr));
- // last_action = Add;
+#if DEAL_II_TRILINOS_VERSION_GTE(11,9,0)
+ Epetra_Import data_exchange (vector->Map(), v.vector->Map());
+ int ierr = vector->Import(*v.vector, data_exchange, Add);
+ AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+ last_action = Add;
+#else
+ // In versions older than 11.9 the Import function is broken for adding
+ // Hence, we provide a workaround in this case
Epetra_MultiVector dummy(vector->Map(), 1, false);
Epetra_Import data_exchange (dummy.Map(), v.vector->Map());
ierr = vector->Update (1.0, dummy, 1.0);
AssertThrow (ierr == 0, ExcTrilinosError(ierr));
+#endif
}
}