Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
16854a38
Commit
16854a38
authored
Nov 07, 2016
by
Praetorius, Simon
Browse files
sequential petsc corrected
parent
d51f8d70
Changes
16
Hide whitespace changes
Inline
Side-by-side
AMDiS/cmake/enable_hypre.cmake
View file @
16854a38
...
@@ -17,7 +17,7 @@ macro(enable_hypre _FLAGS_ _INC_DIRS_ _LIBS_)
...
@@ -17,7 +17,7 @@ macro(enable_hypre _FLAGS_ _INC_DIRS_ _LIBS_)
HINTS
${
PETSC_INCLUDE_DIRS
}
)
HINTS
${
PETSC_INCLUDE_DIRS
}
)
if
(
_HYPRE_H
)
if
(
_HYPRE_H
)
get_filename_component
(
HYPRE_INCLUDE_DIRECTORIES
${
HYPRE_H
}
PATH
)
get_filename_component
(
HYPRE_INCLUDE_DIRECTORIES
${
_
HYPRE_H
}
PATH
)
list
(
APPEND
${
_INC_DIRS_
}
${
HYPRE_INCLUDE_DIRECTORIES
}
)
list
(
APPEND
${
_INC_DIRS_
}
${
HYPRE_INCLUDE_DIRECTORIES
}
)
endif
(
_HYPRE_H
)
endif
(
_HYPRE_H
)
...
...
AMDiS/cmake3/amdis_seq_petsc.cmake
View file @
16854a38
if
(
ENABLE_SEQ_PETSC
)
if
(
ENABLE_SEQ_PETSC
)
target_enable_mpi
(
amdis P
RIVATE
)
target_enable_mpi
(
amdis P
UBLIC
)
target_enable_petsc
(
amdis P
RIVATE
)
target_enable_petsc
(
amdis P
UBLIC
)
target_compile_definitions
(
amdis P
RIVATE
HAVE_SEQ_PETSC=1
)
target_compile_definitions
(
amdis P
UBLIC
HAVE_SEQ_PETSC=1
)
target_sources
(
amdis PRIVATE
target_sources
(
amdis PRIVATE
${
SOURCE_DIR
}
/solver/PetscSolver.cc
${
SOURCE_DIR
}
/solver/PetscSolver.cc
...
...
AMDiS/cmake3/target_enable_hypre.cmake
View file @
16854a38
...
@@ -17,7 +17,7 @@ macro(target_enable_hypre _TARGET_ _SCOPE_)
...
@@ -17,7 +17,7 @@ macro(target_enable_hypre _TARGET_ _SCOPE_)
HINTS
${
PETSC_INCLUDE_DIRS
}
)
HINTS
${
PETSC_INCLUDE_DIRS
}
)
if
(
_HYPRE_H
)
if
(
_HYPRE_H
)
get_filename_component
(
HYPRE_INCLUDE_DIRECTORIES
${
HYPRE_H
}
PATH
)
get_filename_component
(
HYPRE_INCLUDE_DIRECTORIES
${
_
HYPRE_H
}
PATH
)
target_include_directories
(
${
_TARGET_
}
${
_SCOPE_
}
${
HYPRE_INCLUDE_DIRECTORIES
}
)
target_include_directories
(
${
_TARGET_
}
${
_SCOPE_
}
${
HYPRE_INCLUDE_DIRECTORIES
}
)
endif
(
_HYPRE_H
)
endif
(
_HYPRE_H
)
...
...
AMDiS/src/ProblemStat.cc
View file @
16854a38
...
@@ -566,14 +566,16 @@ namespace AMDiS {
...
@@ -566,14 +566,16 @@ namespace AMDiS {
FUNCNAME
(
"ProblemStat::createSolver()"
);
FUNCNAME
(
"ProblemStat::createSolver()"
);
// definition of standard-backends
// definition of standard-backends
#if defined HAVE_PARALLEL_PETSC
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
string
backend
(
"p_petsc"
);
std
::
string
backend
=
"p_"
;
#elif defined HAVE_PARALLEL_MTL
#else
string
backend
(
"p_mtl"
);
std
::
string
backend
=
""
;
#elif defined HAVE_SEQ_PETSC
#endif
string
backend
(
"petsc"
);
#if defined(HAVE_PARALLEL_PETSC) || defined(HAVE_SEQ_PETSC)
backend
+=
"petsc"
;
#else
#else
string
backend
(
"mtl"
)
;
backend
+=
"mtl"
;
#endif
#endif
// === read backend-name ===
// === read backend-name ===
...
...
AMDiS/src/parallel/PetscHelper.h
View file @
16854a38
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include
<vector>
#include
<vector>
#include
<petsc.h>
#include
<petsc.h>
#include
"AMDiS_fwd.h"
#include
"AMDiS_fwd.h"
#include
"utility/PetscWrapper.h"
namespace
AMDiS
namespace
AMDiS
{
{
...
@@ -121,80 +122,4 @@ namespace AMDiS
...
@@ -121,80 +122,4 @@ namespace AMDiS
}
// end namespace petsc_helper
}
// end namespace petsc_helper
}
// end namespace Parallel
}
// end namespace Parallel
// functions for PETSc API changes
namespace
petsc
{
inline
PetscErrorCode
options_view
(
PetscViewer
viewer
)
{
#if (PETSC_VERSION_MINOR >= 7)
return
PetscOptionsView
(
PETSC_NULL
,
viewer
);
#else
return
PetscOptionsView
(
viewer
);
#endif
}
inline
PetscErrorCode
options_insert_string
(
const
char
in_str
[])
{
#if (PETSC_VERSION_MINOR >= 7)
return
PetscOptionsInsertString
(
PETSC_NULL
,
in_str
);
#else
return
PetscOptionsInsertString
(
in_str
);
#endif
}
inline
PetscErrorCode
ksp_set_operators
(
KSP
ksp
,
Mat
Amat
,
Mat
Pmat
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
KSPSetOperators
(
ksp
,
Amat
,
Pmat
);
#else
return
KSPSetOperators
(
ksp
,
Amat
,
Pmat
,
SAME_NONZERO_PATTERN
);
#endif
}
inline
PetscErrorCode
ksp_get_operators
(
KSP
ksp
,
Mat
*
Amat
,
Mat
*
Pmat
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
KSPGetOperators
(
ksp
,
Amat
,
Pmat
);
#else
return
KSPGetOperators
(
ksp
,
Amat
,
Pmat
,
SAME_NONZERO_PATTERN
);
#endif
}
template
<
class
Monitor
>
inline
PetscErrorCode
ksp_monitor_set
(
KSP
ksp
,
Monitor
monitor
)
{
#if (PETSC_VERSION_MINOR >= 7)
PetscViewerAndFormat
*
vf
;
PetscErrorCode
ierr
;
ierr
=
PetscViewerAndFormatCreate
(
PETSC_VIEWER_STDOUT_WORLD
,
PETSC_VIEWER_DEFAULT
,
&
vf
);
CHKERRQ
(
ierr
);
ierr
=
KSPMonitorSet
(
ksp
,(
PetscErrorCode
(
*
)(
KSP
,
PetscInt
,
PetscReal
,
void
*
))
monitor
,
vf
,(
PetscErrorCode
(
*
)(
void
**
))
PetscViewerAndFormatDestroy
);
CHKERRQ
(
ierr
);
return
ierr
;
#else
return
KSPMonitorSet
(
ksp
,
monitor
,
PETSC_NULL
,
PETSC_NULL
);
#endif
}
inline
PetscErrorCode
mat_create_vecs
(
Mat
mat
,
Vec
*
right
,
Vec
*
left
)
{
#if (PETSC_VERSION_MINOR >= 6)
return
MatCreateVecs
(
mat
,
right
,
left
);
#else
return
MatGetVecs
(
mat
,
right
,
left
);
#endif
}
inline
PetscErrorCode
mat_nullspace_remove
(
MatNullSpace
sp
,
Vec
vec
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
MatNullSpaceRemove
(
sp
,
vec
);
#else
return
MatNullSpaceRemove
(
sp
,
vec
,
PETSC_NULL
);
#endif
}
}
// end namespace petsc
}
// end namespace AMDiS
}
// end namespace AMDiS
#endif
AMDiS/src/solver/BlockPreconditioner.h
View file @
16854a38
...
@@ -91,14 +91,16 @@ namespace AMDiS {
...
@@ -91,14 +91,16 @@ namespace AMDiS {
int
max_iter
=
100
,
double
tol
=
1.e-8
)
int
max_iter
=
100
,
double
tol
=
1.e-8
)
{
{
// definition of standard-backends
// definition of standard-backends
#if defined HAVE_PARALLEL_PETSC
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
std
::
string
backend
(
"p_petsc"
);
std
::
string
backend
=
"p_"
;
#elif defined HAVE_PARALLEL_MTL
std
::
string
backend
(
"p_mtl"
);
#elif defined HAVE_PETSC
std
::
string
backend
(
"petsc"
);
#else
#else
std
::
string
backend
(
"mtl"
);
std
::
string
backend
=
""
;
#endif
#if defined(HAVE_PARALLEL_PETSC) || defined(HAVE_SEQ_PETSC)
backend
+=
"petsc"
;
#else
backend
+=
"mtl"
;
#endif
#endif
// === read backend-name ===
// === read backend-name ===
...
...
AMDiS/src/solver/KrylovPreconditioner.h
View file @
16854a38
...
@@ -70,15 +70,16 @@ namespace AMDiS {
...
@@ -70,15 +70,16 @@ namespace AMDiS {
solver
(
NULL
),
solver
(
NULL
),
runner
(
NULL
)
runner
(
NULL
)
{
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
std
::
string
backend
=
"p_"
;
#else
std
::
string
backend
=
""
;
#endif
#if defined HAVE_PARALLEL_PETSC
#if defined(HAVE_PARALLEL_PETSC) || defined(HAVE_SEQ_PETSC)
std
::
string
backend
(
"p_petsc"
);
backend
+=
"petsc"
;
#elif defined HAVE_PARALLEL_MTL
std
::
string
backend
(
"p_mtl"
);
#elif defined HAVE_PETSC || defined HAVE_SEQ_PETSC
std
::
string
backend
(
"petsc"
);
#else
#else
std
::
string
backend
(
"mtl"
)
;
backend
+=
"mtl"
;
#endif
#endif
// === read backend-name ===
// === read backend-name ===
...
...
AMDiS/src/solver/PetscSolver.h
View file @
16854a38
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include
"solver/LinearSolver.h"
#include
"solver/LinearSolver.h"
#include
"solver/PetscTypes.h"
#include
"solver/PetscTypes.h"
#include
"solver/MatrixStreams.h"
#include
"solver/MatrixStreams.h"
#include
"utility/PetscWrapper.h"
#include
"Timer.h"
#include
"Timer.h"
#include
<vector>
#include
<vector>
#include
<iostream>
#include
<iostream>
...
@@ -58,7 +59,7 @@ namespace AMDiS {
...
@@ -58,7 +59,7 @@ namespace AMDiS {
virtual
void
init
(
PC
pc
,
const
SolverMatrix
<
Matrix
<
DOFMatrix
*>
>&
A
,
const
MatrixType
&
fullMatrix
)
virtual
void
init
(
PC
pc
,
const
SolverMatrix
<
Matrix
<
DOFMatrix
*>
>&
A
,
const
MatrixType
&
fullMatrix
)
{
{
petsc
_
options_insert_string
((
"-"
+
prefix
+
"pc_type "
+
name
).
c_str
());
petsc
::
options_insert_string
((
"-"
+
prefix
+
"pc_type "
+
name
).
c_str
());
PCSetFromOptions
(
pc
);
PCSetFromOptions
(
pc
);
}
}
...
...
AMDiS/src/utility/PetscWrapper.h
0 → 100644
View file @
16854a38
/******************************************************************************
*
* AMDiS - Adaptive multidimensional simulations
*
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
******************************************************************************/
/** \file PetscWrapper.h */
#ifndef AMDIS_PETSCWRAPPER_H
#define AMDIS_PETSCWRAPPER_H
#include
<mpi.h>
#include
<petsc.h>
namespace
AMDiS
{
// functions for PETSc API changes
namespace
petsc
{
inline
PetscErrorCode
options_view
(
PetscViewer
viewer
)
{
#if (PETSC_VERSION_MINOR >= 7)
return
PetscOptionsView
(
PETSC_NULL
,
viewer
);
#else
return
PetscOptionsView
(
viewer
);
#endif
}
inline
PetscErrorCode
options_insert_string
(
const
char
in_str
[])
{
#if (PETSC_VERSION_MINOR >= 7)
return
PetscOptionsInsertString
(
PETSC_NULL
,
in_str
);
#else
return
PetscOptionsInsertString
(
in_str
);
#endif
}
inline
PetscErrorCode
ksp_set_operators
(
KSP
ksp
,
Mat
Amat
,
Mat
Pmat
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
KSPSetOperators
(
ksp
,
Amat
,
Pmat
);
#else
return
KSPSetOperators
(
ksp
,
Amat
,
Pmat
,
SAME_NONZERO_PATTERN
);
#endif
}
inline
PetscErrorCode
ksp_get_operators
(
KSP
ksp
,
Mat
*
Amat
,
Mat
*
Pmat
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
KSPGetOperators
(
ksp
,
Amat
,
Pmat
);
#else
return
KSPGetOperators
(
ksp
,
Amat
,
Pmat
,
SAME_NONZERO_PATTERN
);
#endif
}
template
<
class
Monitor
>
inline
PetscErrorCode
ksp_monitor_set
(
KSP
ksp
,
Monitor
monitor
)
{
#if (PETSC_VERSION_MINOR >= 7)
PetscViewerAndFormat
*
vf
;
PetscErrorCode
ierr
;
ierr
=
PetscViewerAndFormatCreate
(
PETSC_VIEWER_STDOUT_WORLD
,
PETSC_VIEWER_DEFAULT
,
&
vf
);
CHKERRQ
(
ierr
);
ierr
=
KSPMonitorSet
(
ksp
,(
PetscErrorCode
(
*
)(
KSP
,
PetscInt
,
PetscReal
,
void
*
))
monitor
,
vf
,(
PetscErrorCode
(
*
)(
void
**
))
PetscViewerAndFormatDestroy
);
CHKERRQ
(
ierr
);
return
ierr
;
#else
return
KSPMonitorSet
(
ksp
,
monitor
,
PETSC_NULL
,
PETSC_NULL
);
#endif
}
inline
PetscErrorCode
mat_create_vecs
(
Mat
mat
,
Vec
*
right
,
Vec
*
left
)
{
#if (PETSC_VERSION_MINOR >= 6)
return
MatCreateVecs
(
mat
,
right
,
left
);
#else
return
MatGetVecs
(
mat
,
right
,
left
);
#endif
}
inline
PetscErrorCode
mat_nullspace_remove
(
MatNullSpace
sp
,
Vec
vec
)
{
#if (PETSC_VERSION_MINOR >= 5)
return
MatNullSpaceRemove
(
sp
,
vec
);
#else
return
MatNullSpaceRemove
(
sp
,
vec
,
PETSC_NULL
);
#endif
}
}
// end namespace petsc
}
// end namespace AMDiS
#endif
extensions/demo/pfc/CMakeLists.txt
View file @
16854a38
...
@@ -2,21 +2,18 @@ project("extensions_demo_pfc")
...
@@ -2,21 +2,18 @@ project("extensions_demo_pfc")
cmake_minimum_required
(
VERSION 2.8
)
cmake_minimum_required
(
VERSION 2.8
)
find_package
(
AMDIS REQUIRED
)
find_package
(
AMDIS REQUIRED
)
include
(
${
AMDIS_USE_FILE
}
)
if
(
AMDIS_FOUND
)
add_definitions
(
-DUSE_MTL=1
)
message
(
"amdis was found
\n
"
)
include
(
${
AMDIS_USE_FILE
}
)
SET
(
BASIS_LIBS
${
AMDIS_LIBRARIES
}
)
endif
(
AMDIS_FOUND
)
set
(
pfc src/pfc.cc
)
set
(
pfc src/pfc.cc
)
add_executable
(
"pfc"
${
pfc
}
)
add_executable
(
"pfc"
${
pfc
}
)
target_link_libraries
(
"pfc"
${
BAS
IS_LIBS
}
)
target_link_libraries
(
"pfc"
${
AMD
IS_LIB
RARIE
S
}
)
set
(
pfc_rb src/pfc_rb.cc
)
set
(
pfc_rb src/pfc_rb.cc
)
add_executable
(
"pfc_rb"
${
pfc_rb
}
)
add_executable
(
"pfc_rb"
${
pfc_rb
}
)
target_link_libraries
(
"pfc_rb"
${
BAS
IS_LIBS
}
)
target_link_libraries
(
"pfc_rb"
${
AMD
IS_LIB
RARIE
S
}
)
set
(
vpfc src/vpfc.cc
)
set
(
vpfc src/vpfc.cc
)
add_executable
(
"vpfc"
${
vpfc
}
)
add_executable
(
"vpfc"
${
vpfc
}
)
target_link_libraries
(
"vpfc"
${
BAS
IS_LIBS
}
)
target_link_libraries
(
"vpfc"
${
AMD
IS_LIB
RARIE
S
}
)
extensions/demo/pfc/init/pfc.dat.2d
View file @
16854a38
...
@@ -28,16 +28,8 @@ pfc->space->dim: 2
...
@@ -28,16 +28,8 @@ pfc->space->dim: 2
% ================== SOLVER ======================================
% ================== SOLVER ======================================
%#include "init/pfc_solver.inc"
pfc->space->solver->backend: bpetsc
pfc->space->solver: cg
#include "init/pfc_solver.mtl.inc"
pfc->space->MG->number of levels: 10
pfc->space->MG->max iteration: 100
pfc->space->MG->tolerance: 1.e-8
pfc->space->MG->nu1: 20
pfc->space->MG->nu2: 20
pfc->space->MG->gamma: 1
pfc->space->MG->mu: 3
pfc->space->MG->fine level: 12
% ==================== TIMESTEPS ===============================
% ==================== TIMESTEPS ===============================
adapt->timestep: 1.e-1
adapt->timestep: 1.e-1
...
...
extensions/demo/pfc/init/pfc_rb.mtl.dat.2d
View file @
16854a38
...
@@ -29,6 +29,7 @@ pfc->space->dim: 2
...
@@ -29,6 +29,7 @@ pfc->space->dim: 2
% ================== SOLVER ======================================
% ================== SOLVER ======================================
pfc->space->solver->backend: mtl
#include "init/pfc_solver.mtl.inc"
#include "init/pfc_solver.mtl.inc"
...
...
extensions/demo/pfc/init/pfc_solver.inc
View file @
16854a38
%
pfc
->
space
->
solver
->
backend
:
p_
petsc
pfc
->
space
->
solver
->
backend
:
petsc
pfc
->
space
->
solver
->
petsc
prefix
:
pfc_
pfc
->
space
->
solver
->
petsc
prefix
:
pfc_
pfc
->
space
->
solver
:
pfc
pfc
->
space
->
solver
:
pfc
pfc
->
space
->
solver
->
ksp_type
:
fgmres
pfc
->
space
->
solver
->
ksp_type
:
fgmres
...
@@ -26,4 +26,4 @@ precon_pfc_MpL2->max iteration: 1000
...
@@ -26,4 +26,4 @@ precon_pfc_MpL2->max iteration: 1000
precon_pfc_MpL2
->
relative
tolerance
:
1.e-3
precon_pfc_MpL2
->
relative
tolerance
:
1.e-3
precon_pfc_MpL2
->
use
direct
solver
:
0
precon_pfc_MpL2
->
use
direct
solver
:
0
precon_pfc_MpL2
->
solver
:
cg
precon_pfc_MpL2
->
solver
:
cg
precon_pfc_MpL2
->
use
AMG
:
0
precon_pfc_MpL2
->
use
AMG
:
0
\ No newline at end of file
extensions/demo/pfc/src/pfc.cc
View file @
16854a38
...
@@ -2,13 +2,11 @@
...
@@ -2,13 +2,11 @@
#include
"Helpers.h"
#include
"Helpers.h"
#include
"PhaseFieldCrystal.h"
#include
"PhaseFieldCrystal.h"
#if
(
defined
HAVE_SEQ_PETSC) || (defined HAVE
_PETSC)
#if defined
(USE_SEQ
_PETSC)
#include
"preconditioner/PetscPreconPfc.h"
#include
"preconditioner/PetscPreconPfc.h"
#endif
#elif defined(USE_PARALLEL_PETSC)
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include
"preconditioner/PetscSolverPfc.h"
#include
"preconditioner/PetscSolverPfc.h"
#endif
#elif defined(USE_MTL)
#if (!defined HAVE_SEQ_PETSC) && (!defined HAVE_PETSC) && (!defined HAVE_PARALLEL_DOMAIN_AMDIS)
#include
"preconditioner/MTLPreconPfc.h"
#include
"preconditioner/MTLPreconPfc.h"
#endif
#endif
...
@@ -30,33 +28,24 @@ public:
...
@@ -30,33 +28,24 @@ public:
{
{
super
::
finalizeData
();
super
::
finalizeData
();
#ifdef USE_PRECON
#if defined(USE_SEQ_PETSC)
// sequential PFC preconditioner
// sequential PFC preconditioner
#if (defined HAVE_SEQ_PETSC) || (defined HAVE_PETSC)
PetscPreconPfc
*
precon
=
dynamic_cast
<
PetscPreconPfc
*>
(
prob
->
getSolver
()
->
getRightPrecon
());
PetscPreconPfc
*
precon
=
dynamic_cast
<
PetscPreconPfc
*>
(
prob
->
getSolver
()
->
getRightPrecon
());
if
(
precon
)
{
if
(
precon
)
{
precon
->
setData
(
getTau
(),
M0
);
precon
->
setData
(
getTau
(),
M0
);
}
}
// PetscPreconPfcDiag* precon2 = dynamic_cast<PetscPreconPfcDiag*>(prob->getSolver()->getRightPrecon());
#elif defined(USE_PARALLEL_PETSC)
// if (precon2) {
// precon2->setData(getTau(), M0);
}
#elif !defined(HAVE_PARALLEL_DOMAIN_AMDIS)
MTLPreconPfc
*
precon
=
dynamic_cast
<
MTLPreconPfc
*>
(
prob
->
getSolver
()
->
getRightPrecon
());
if
(
precon
)
precon
->
setData
(
getTau
(),
M0
);
#else
// parallel PFC preconditioner
// parallel PFC preconditioner
Parallel
::
PetscSolverPfc
*
solver
=
dynamic_cast
<
Parallel
::
PetscSolverPfc
*>
(
prob
->
getSolver
());
Parallel
::
PetscSolverPfc
*
solver
=
dynamic_cast
<
Parallel
::
PetscSolverPfc
*>
(
prob
->
getSolver
());
if
(
solver
)
if
(
solver
)
{
solver
->
setData
(
getTau
(),
M0
);
solver
->
setData
(
getTau
(),
M0
);
}
// Parallel::PetscSolverPfcDiag* solver2 = dynamic_cast<Parallel::PetscSolverPfcDiag*>(prob->getSolver());
#elif defined(USE_MTL)
// if (solver2)
// mtl4 preconditioner
// solver2->setData(getTau(), M0);
MTLPreconPfc
*
precon
=
dynamic_cast
<
MTLPreconPfc
*>
(
prob
->
getSolver
()
->
getRightPrecon
());
#endif
if
(
precon
)
{
precon
->
setData
(
getTau
(),
M0
);
}
#endif
#endif
}
}
...
@@ -82,20 +71,13 @@ int main(int argc, char** argv)
...
@@ -82,20 +71,13 @@ int main(int argc, char** argv)
AMDiS
::
init
(
argc
,
argv
);
AMDiS
::
init
(
argc
,
argv
);
Timer
t
;
Timer
t
;
#ifdef USE_PRECON
// add preconditioner / solver to the parameter list. Must be added before problem is initialized.
// add preconditioner / solver to the parameter list. Must be added before problem is initialized.
#if
(
defined
HAVE_SEQ_PETSC) || (defined HAVE
_PETSC)
#if defined
(USE_SEQ
_PETSC)
CreatorMap
<
PetscPreconditionerNested
>::
addCreator
(
"pfc"
,
new
PetscPreconPfc
::
Creator
);
CreatorMap
<
PetscPreconditionerNested
>::
addCreator
(
"pfc"
,
new
PetscPreconPfc
::
Creator
);
// CreatorMap<PetscPreconditionerNested>::addCreator("pfc_diag", new PetscPreconPfcDiag::Creator);
#elif defined(USE_PARALLEL_PETSC)
#elif !defined(HAVE_PARALLEL_DOMAIN_AMDIS)
CreatorMap
<
typename
MTLPreconPfc
::
precon_base
>::
addCreator
(
"pfc"
,
new
MTLPreconPfc
::
Creator
);
// CreatorMap<typename MTLPreconPfc_Diag::base_precon>::addCreator("pfc", new MTLPreconPfc::Creator);
#else
CreatorMap
<
LinearSolverInterface
>::
addCreator
(
"p_petsc_pfc"
,
new
Parallel
::
PetscSolverPfc
::
Creator
);
CreatorMap
<
LinearSolverInterface
>::
addCreator
(
"p_petsc_pfc"
,
new
Parallel
::
PetscSolverPfc
::
Creator
);
// CreatorMap<LinearSolverInterface>::addCreator("p_petsc_pfc_diag", new Parallel::PetscSolverPfcDiag::Creator);
#elif defined(USE_MTL)
#endif
CreatorMap
<
typename
MTLPreconPfc
::
precon_base
>::
addCreator
(
"pfc"
,
new
MTLPreconPfc
::
Creator
);
#endif
#endif
// create and initialize the PFC BaseProblem
// create and initialize the PFC BaseProblem
...
...
extensions/demo/pfc/src/pfc_rb.cc
View file @
16854a38
...
@@ -2,13 +2,11 @@
...
@@ -2,13 +2,11 @@
#include
"Helpers.h"
#include
"Helpers.h"
#include
"PhaseFieldCrystal.h"
#include
"PhaseFieldCrystal.h"
#if
(
defined
HAVE_SEQ_PETSC) || (defined HAVE
_PETSC)
#if defined
(USE_SEQ
_PETSC)
#include
"preconditioner/PetscPreconPfc.h"
#include
"preconditioner/PetscPreconPfc.h"
#endif
#elif defined(USE_PARALLEL_PETSC)
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include
"preconditioner/PetscSolverPfc.h"
#include
"preconditioner/PetscSolverPfc.h"
#endif
#elif defined(USE_MTL)
#if (!defined HAVE_SEQ_PETSC) && (!defined HAVE_PETSC) && (!defined HAVE_PARALLEL_DOMAIN_AMDIS)
#include
"preconditioner/MTLPreconPfc.h"
#include
"preconditioner/MTLPreconPfc.h"
#endif
#endif
...
@@ -49,24 +47,19 @@ public:
...
@@ -49,24 +47,19 @@ public:
{
{
super
::
initData
();
super
::
initData
();
#if defined(USE_SEQ_PETSC)
// sequential PFC preconditioner
// sequential PFC preconditioner
#if (defined HAVE_SEQ_PETSC) || (defined HAVE_PETSC)
PetscPreconPfc
*
runner
=
dynamic_cast
<
PetscPreconPfc
*>
(
prob
->
getSolver
()
->
getRunner
());
PetscPreconPfc
*
runner
=
dynamic_cast
<
PetscPreconPfc
*>
(
prob
->
getSolver
()
->
getRunner
());
if
(
runner
)
{
if
(
runner
)
{
dynamic_cast
<
PetscSolver
<
PetscPreconPfc
>*>
(
prob
->
getSolver
())
->
setNested
(
true
);
runner
->
setData
(
getTau
());
runner
->
setData
(
getTau
());
}
}
#endif
#elif defined(USE_PARALLEL_PETSC)
// parallel PFC preconditioner
// parallel PFC preconditioner
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
Parallel
::
PetscSolverPfc
*
solver
=
dynamic_cast
<
Parallel
::
PetscSolverPfc
*>
(
prob
->
getSolver
());
Parallel
::
PetscSolverPfc
*
solver
=
dynamic_cast
<
Parallel
::
PetscSolverPfc
*>
(
prob
->
getSolver
());
if
(
solver
)
if
(
solver
)