Changeset b57b9b for test/unit_test
- Timestamp:
- Sep 20, 2012, 1:54:01 PM (13 years ago)
- Children:
- c3acbb
- Parents:
- 2d3854
- Location:
- test/unit_test
- Files:
-
- 13 edited
-
library/dirichlet_cs.cpp (modified) (3 diffs)
-
library/dirichlet_cs_mpi.cpp (modified) (2 diffs)
-
library/dirichlet_fas.cpp (modified) (2 diffs)
-
library/dirichlet_fas_lr.cpp (modified) (2 diffs)
-
library/dirichlet_fas_lr_mpi.cpp (modified) (2 diffs)
-
library/dirichlet_fas_mpi.cpp (modified) (2 diffs)
-
library/force_sinus.cpp (modified) (2 diffs)
-
library/periodic_cs.cpp (modified) (2 diffs)
-
library/periodic_cs_mpi.cpp (modified) (2 diffs)
-
library/periodic_fas.cpp (modified) (2 diffs)
-
library/periodic_fas_mpi.cpp (modified) (2 diffs)
-
unit_test/smoother_test.cpp (modified) (1 diff)
-
unit_test/solver_test.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
test/unit_test/library/dirichlet_cs.cpp
r2d3854 rb57b9b 34 34 #include "base/math.hpp" 35 35 #include "base/vector.hpp" 36 #include "cycles/cycle_cs_dirichlet.hpp" 36 37 #include "comm/comm_serial.hpp" 37 38 #include "level/level_operator_cs.hpp" … … 39 40 #include "level/stencils.hpp" 40 41 #include "samples/discretization_poisson_fd.hpp" 41 #include "samples/techniques.hpp"42 42 #include "smoother/gsrb.hpp" 43 43 #ifdef HAVE_LAPACK … … 58 58 LibraryDirichletCSFixture() 59 59 { 60 Factory& factory = MG::GetFactory();60 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 61 61 62 Comm *comm = new CommSerial(Boundary(Dirichlet, Dirichlet, Dirichlet)); 63 comm->Register("COMM"); 62 new CommSerial(boundary); 63 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 64 new DiscretizationPoissonFD(2); 65 new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 66 new GaussSeidelRB(); 67 new Givens<SolverRegular>(); 68 new CycleCSDirichlet(2); 64 69 65 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 66 interface->Register("INTERFACE"); 67 68 Discretization* discretization = new DiscretizationPoissonFD(2); 69 discretization->Register("DISCRETIZATION"); 70 71 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 72 lop->Register("LEVEL_OPERATOR"); 73 74 Smoother* smoother = new GaussSeidelRB(); 75 smoother->Register("SMOOTHER"); 76 77 #ifdef HAVE_LAPACK 78 Solver* solver = new DGESV<SolverRegular>(); 79 #else 80 Solver* solver = new Givens<SolverRegular>(); 81 #endif 82 solver->Register("SOLVER"); 83 84 Techniques::SetCorrectionSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 85 86 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 87 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 88 factory.RegisterObjectStorage("PRECISION", 1e-10); 89 factory.RegisterObjectStorage("MAX_ITERATION", 7); 70 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 71 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 72 new ObjectStorage<int>("MAX_ITERATION", 7); 73 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 90 74 91 75 MG::PostInit(); -
test/unit_test/library/dirichlet_cs_mpi.cpp
r2d3854 rb57b9b 43 43 #include "comm/comm_mpi.hpp" 44 44 #include "comm/domain_decomposition_mpi.hpp" 45 #include "cycles/cycle_cs_dirichlet.hpp" 45 46 #include "level/level_operator_cs.hpp" 46 47 #include "level/level_operator.hpp" 47 48 #include "samples/discretization_poisson_fd.hpp" 48 #include "samples/techniques.hpp"49 49 #include "smoother/gsrb.hpp" 50 #ifdef HAVE_LAPACK51 #include "solver/dgesv.hpp"52 #endif53 50 #include "solver/givens.hpp" 54 51 #include "solver/solver_regular.hpp" … … 65 62 LibraryDirichletCSMPIFixture() 66 63 { 67 Factory& factory = MG::GetFactory();64 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 68 65 69 Comm* comm = new CommMPI(Boundary(Dirichlet, Dirichlet, Dirichlet), new DomainDecompositionMPI()); 70 comm->Register("COMM"); 66 new CommMPI(boundary, new DomainDecompositionMPI()); 67 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 68 new DiscretizationPoissonFD(2); 69 new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 70 new GaussSeidelRB(); 71 new Givens<SolverRegular>(); 72 new CycleCSDirichlet(2); 71 73 72 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 73 interface->Register("INTERFACE"); 74 75 Discretization* discretization = new DiscretizationPoissonFD(2); 76 discretization->Register("DISCRETIZATION"); 77 78 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 79 lop->Register("LEVEL_OPERATOR"); 80 81 Smoother* smoother = new GaussSeidelRB(); 82 smoother->Register("SMOOTHER"); 83 84 #ifdef HAVE_LAPACK 85 Solver* solver = new DGESV<SolverRegular>(); 86 #else 87 Solver* solver = new Givens<SolverRegular>(); 88 #endif 89 solver->Register("SOLVER"); 90 91 Techniques::SetCorrectionSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 92 93 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 94 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 95 factory.RegisterObjectStorage("PRECISION", 1e-10); 96 factory.RegisterObjectStorage("MAX_ITERATION", 7); 74 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 75 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 76 new ObjectStorage<int>("MAX_ITERATION", 7); 77 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 97 78 98 79 MG::PostInit(); -
test/unit_test/library/dirichlet_fas.cpp
r2d3854 rb57b9b 35 35 #include "base/vector.hpp" 36 36 #include "comm/comm_serial.hpp" 37 #include "cycles/cycle_fas_dirichlet.hpp" 37 38 #include "level/level_operator_fas.hpp" 38 39 #include "level/level_operator.hpp" 39 40 #include "samples/discretization_poisson_fd.hpp" 40 #include "samples/techniques.hpp"41 41 #include "smoother/gsrb.hpp" 42 #ifdef HAVE_LAPACK43 #include "solver/dgesv.hpp"44 #endif45 42 #include "solver/givens.hpp" 46 43 #include "solver/solver_regular.hpp" … … 57 54 LibraryDirichletFASFixture() 58 55 { 59 Factory& factory = MG::GetFactory();56 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 60 57 61 Comm *comm = new CommSerial(Boundary(Dirichlet, Dirichlet, Dirichlet)); 62 comm->Register("COMM"); 58 new CommSerial(boundary); 59 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 60 new DiscretizationPoissonFD(2); 61 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 62 new GaussSeidelRB(); 63 new Givens<SolverRegular>(); 64 new CycleFASDirichlet(2); 63 65 64 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 65 interface->Register("INTERFACE"); 66 67 Discretization* discretization = new DiscretizationPoissonFD(2); 68 discretization->Register("DISCRETIZATION"); 69 70 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 71 lop->Register("LEVEL_OPERATOR"); 72 73 Smoother* smoother = new GaussSeidelRB(); 74 smoother->Register("SMOOTHER"); 75 76 #ifdef HAVE_LAPACK 77 Solver* solver = new DGESV<SolverRegular>(); 78 #else 79 Solver* solver = new Givens<SolverRegular>(); 80 #endif 81 82 solver->Register("SOLVER"); 83 84 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 85 86 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 87 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 88 factory.RegisterObjectStorage("PRECISION", 1e-10); 89 factory.RegisterObjectStorage("MAX_ITERATION", 7); 66 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 67 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 68 new ObjectStorage<int>("MAX_ITERATION", 7); 69 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 90 70 91 71 MG::PostInit(); -
test/unit_test/library/dirichlet_fas_lr.cpp
r2d3854 rb57b9b 35 35 #include "base/vector.hpp" 36 36 #include "comm/comm_serial.hpp" 37 #include "cycles/cycle_fas_dirichlet.hpp" 37 38 #include "level/level_operator_fas.hpp" 38 39 #include "level/level_operator.hpp" 39 40 #include "samples/discretization_poisson_fv.hpp" 40 #include "samples/techniques.hpp"41 41 #include "smoother/gsrb.hpp" 42 #ifdef HAVE_LAPACK43 #include "solver/dgesv.hpp"44 #endif45 42 #include "solver/givens.hpp" 46 43 #include "solver/solver_regular.hpp" … … 57 54 LibraryDirichletFASLRFixture() 58 55 { 59 Factory& factory = MG::GetFactory();56 Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 60 57 61 Comm *comm = new CommSerial(Boundary(Dirichlet, Dirichlet, Dirichlet)); 62 comm->Register("COMM"); 58 new CommSerial(boundary); 59 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0, 2, 1.6); 60 new DiscretizationPoissonFV(2); 61 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 62 new GaussSeidelRB(); 63 new Givens<SolverRegular>(); 64 new CycleFASDirichlet(2); 63 65 64 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0, 2, 1.6); 65 interface->Register("INTERFACE"); 66 67 Discretization* discretization = new DiscretizationPoissonFV(2); 68 discretization->Register("DISCRETIZATION"); 69 70 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 71 lop->Register("LEVEL_OPERATOR"); 72 73 Smoother* smoother = new GaussSeidelRB(); 74 smoother->Register("SMOOTHER"); 75 76 #ifdef HAVE_LAPACK 77 Solver* solver = new DGESV<SolverRegular>(); 78 #else 79 Solver* solver = new Givens<SolverRegular>(); 80 #endif 81 82 solver->Register("SOLVER"); 83 84 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 85 86 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 87 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 88 factory.RegisterObjectStorage("PRECISION", 1e-10); 89 factory.RegisterObjectStorage("MAX_ITERATION", 8); 66 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 67 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 68 new ObjectStorage<int>("MAX_ITERATION", 8); 69 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 90 70 91 71 MG::PostInit(); -
test/unit_test/library/dirichlet_fas_lr_mpi.cpp
r2d3854 rb57b9b 44 44 #include "comm/comm_mpi.hpp" 45 45 #include "comm/domain_decomposition_mpi.hpp" 46 #include "cycles/cycle_fas_dirichlet.hpp" 46 47 #include "level/level_operator_fas.hpp" 47 48 #include "level/level_operator.hpp" 48 49 #include "samples/discretization_poisson_fv.hpp" 49 #include "samples/techniques.hpp"50 50 #include "smoother/gsrb.hpp" 51 #ifdef HAVE_LAPACK52 #include "solver/dgesv.hpp"53 #endif54 51 #include "solver/givens.hpp" 55 52 #include "solver/solver_regular.hpp" … … 66 63 LibraryDirichletFASLRMPIFixture() 67 64 { 68 Factory& factory = MG::GetFactory();65 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 69 66 70 Comm *comm = new CommMPI(Boundary(Dirichlet, Dirichlet, Dirichlet), new DomainDecompositionMPI()); 71 comm->Register("COMM"); 67 new CommMPI(boundary, new DomainDecompositionMPI()); 68 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0, 2, 1.6); 69 new DiscretizationPoissonFV(2); 70 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 71 new GaussSeidelRB(); 72 new Givens<SolverRegular>(); 73 new CycleFASDirichlet(2); 72 74 73 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0, 2, 1.6); 74 interface->Register("INTERFACE"); 75 76 Discretization* discretization = new DiscretizationPoissonFV(2); 77 discretization->Register("DISCRETIZATION"); 78 79 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 80 lop->Register("LEVEL_OPERATOR"); 81 82 Smoother* smoother = new GaussSeidelRB(); 83 smoother->Register("SMOOTHER"); 84 85 #ifdef HAVE_LAPACK 86 Solver* solver = new DGESV<SolverRegular>(); 87 #else 88 Solver* solver = new Givens<SolverRegular>(); 89 #endif 90 91 solver->Register("SOLVER"); 92 93 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 94 95 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 96 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 97 factory.RegisterObjectStorage("PRECISION", 1e-10); 98 factory.RegisterObjectStorage("MAX_ITERATION", 8); 75 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 76 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 77 new ObjectStorage<int>("MAX_ITERATION", 8); 78 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 99 79 100 80 MG::PostInit(); -
test/unit_test/library/dirichlet_fas_mpi.cpp
r2d3854 rb57b9b 44 44 #include "comm/comm_mpi.hpp" 45 45 #include "comm/domain_decomposition_mpi.hpp" 46 #include "cycles/cycle_fas_dirichlet.hpp" 46 47 #include "level/level_operator_fas.hpp" 47 48 #include "level/level_operator.hpp" 48 49 #include "samples/discretization_poisson_fd.hpp" 49 #include "samples/techniques.hpp"50 50 #include "smoother/gsrb.hpp" 51 #ifdef HAVE_LAPACK52 #include "solver/dgesv.hpp"53 #endif54 51 #include "solver/givens.hpp" 55 52 #include "solver/solver_regular.hpp" … … 66 63 LibraryDirichletFASMPIFixture() 67 64 { 68 Factory& factory = MG::GetFactory();65 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 69 66 70 Comm *comm = new CommMPI(Boundary(Dirichlet, Dirichlet, Dirichlet), new DomainDecompositionMPI()); 71 comm->Register("COMM"); 67 new CommMPI(boundary, new DomainDecompositionMPI()); 68 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 69 new DiscretizationPoissonFD(2); 70 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 71 new GaussSeidelRB(); 72 new Givens<SolverRegular>(); 73 new CycleFASDirichlet(2); 72 74 73 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 74 interface->Register("INTERFACE"); 75 76 Discretization* discretization = new DiscretizationPoissonFD(2); 77 discretization->Register("DISCRETIZATION"); 78 79 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 80 lop->Register("LEVEL_OPERATOR"); 81 82 Smoother* smoother = new GaussSeidelRB(); 83 smoother->Register("SMOOTHER"); 84 85 #ifdef HAVE_LAPACK 86 Solver* solver = new DGESV<SolverRegular>(); 87 #else 88 Solver* solver = new Givens<SolverRegular>(); 89 #endif 90 91 solver->Register("SOLVER"); 92 93 Techniques::SetFullApproximationSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2); 94 95 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 96 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 97 factory.RegisterObjectStorage("PRECISION", 1e-10); 98 factory.RegisterObjectStorage("MAX_ITERATION", 7); 75 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 76 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 77 new ObjectStorage<int>("MAX_ITERATION", 7); 78 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 99 79 100 80 MG::PostInit(); -
test/unit_test/library/force_sinus.cpp
r2d3854 rb57b9b 41 41 #include <iostream> 42 42 43 #include "base/factory.hpp"44 43 #include "base/math.hpp" 45 44 #include "base/vector.hpp" 46 45 #include "comm/comm_mpi.hpp" 47 46 #include "comm/domain_decomposition_mpi.hpp" 47 #include "cycles/cycle_cs_periodic.hpp" 48 48 #include "level/level_operator_cs.hpp" 49 49 #include "level/level_operator.hpp" 50 50 #include "samples/discretization_poisson_fd.hpp" 51 #include "samples/techniques.hpp"52 51 #include "smoother/gsrb.hpp" 53 52 #include "solver/givens.hpp" … … 67 66 LibraryForceSinusFixture() 68 67 { 69 Factory& factory = MG::GetFactory();68 const Boundary boundary(Periodic, Periodic, Periodic); 70 69 71 Comm* comm = new CommMPI(Boundary(Periodic, Periodic, Periodic), new DomainDecompositionMPI()); 72 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 73 Discretization* discretization = new DiscretizationPoissonFD(2); 74 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 75 Smoother* smoother = new GaussSeidelRB(); 76 Solver* solver = new Givens<SolverSingular>(); 70 new CommMPI(boundary, new DomainDecompositionMPI()); 71 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 72 new DiscretizationPoissonFD(2); 73 new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 74 new GaussSeidelRB(); 75 new Givens<SolverSingular>(); 76 new CycleCSPeriodic(2); 77 77 78 comm->Register("COMM"); 79 interface->Register("INTERFACE"); 80 discretization->Register("DISCRETIZATION"); 81 lop->Register("LEVEL_OPERATOR"); 82 smoother->Register("SMOOTHER"); 83 solver->Register("SOLVER"); 84 85 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2); 86 87 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 88 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 89 factory.RegisterObjectStorage("PRECISION", 1e-10); 90 factory.RegisterObjectStorage("MAX_ITERATION", 7); 78 new ObjectStorage<vmg_int>("PRESMOOTHSTEPS", 3); 79 new ObjectStorage<vmg_int>("POSTSMOOTHSTEPS", 3); 80 new ObjectStorage<vmg_int>("MAX_ITERATION", 7); 81 new ObjectStorage<vmg_float>("PRECISION", 1e-10); 91 82 92 83 MG::PostInit(); -
test/unit_test/library/periodic_cs.cpp
r2d3854 rb57b9b 35 35 #include "base/vector.hpp" 36 36 #include "comm/comm_serial.hpp" 37 #include "cycles/cycle_cs_periodic.hpp" 37 38 #include "level/level_operator_cs.hpp" 38 39 #include "samples/discretization_poisson_fd.hpp" 39 #include "samples/techniques.hpp"40 40 #include "smoother/gs.hpp" 41 41 #include "smoother/gsrb.hpp" 42 #ifdef HAVE_LAPACK43 #include "solver/dsysv.hpp"44 #endif45 42 #include "solver/givens.hpp" 46 43 #include "solver/solver_singular.hpp" … … 57 54 LibraryPeriodicCSFixture() 58 55 { 59 Factory& factory = MG::GetFactory();56 const Boundary boundary(Periodic, Periodic, Periodic); 60 57 61 Comm *comm = new CommSerial(Boundary(Periodic, Periodic, Periodic)); 62 comm->Register("COMM"); 58 new CommSerial(boundary); 59 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 60 new DiscretizationPoissonFD(2); 61 new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 62 new GaussSeidelRB(); 63 new Givens<SolverSingular>(); 64 new CycleCSPeriodic(2); 63 65 64 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 65 interface->Register("INTERFACE"); 66 67 Discretization* discretization = new DiscretizationPoissonFD(2); 68 discretization->Register("DISCRETIZATION"); 69 70 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 71 lop->Register("LEVEL_OPERATOR"); 72 73 Smoother* smoother = new GaussSeidelRB(); 74 smoother->Register("SMOOTHER"); 75 76 #ifdef HAVE_LAPACK 77 Solver* solver = new DSYSV<SolverSingular>(); 78 #else 79 Solver* solver = new Givens<SolverSingular>(); 80 #endif 81 solver->Register("SOLVER"); 82 83 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2); 84 85 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 86 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 87 factory.RegisterObjectStorage("PRECISION", 1e-10); 88 factory.RegisterObjectStorage("MAX_ITERATION", 7); 66 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 67 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 68 new ObjectStorage<int>("MAX_ITERATION", 7); 69 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 89 70 90 71 MG::PostInit(); -
test/unit_test/library/periodic_cs_mpi.cpp
r2d3854 rb57b9b 43 43 #include "comm/comm_mpi.hpp" 44 44 #include "comm/domain_decomposition_mpi.hpp" 45 #include "cycles/cycle_cs_periodic.hpp" 45 46 #include "level/level_operator_cs.hpp" 46 47 #include "samples/discretization_poisson_fd.hpp" 47 #include "samples/techniques.hpp"48 48 #include "smoother/gs.hpp" 49 49 #include "smoother/gsrb.hpp" 50 #ifdef HAVE_LAPACK51 #include "solver/dsysv.hpp"52 #endif53 50 #include "solver/givens.hpp" 54 51 #include "solver/solver_singular.hpp" … … 65 62 LibraryPeriodicCSMPIFixture() 66 63 { 67 Factory& factory = MG::GetFactory();64 const Boundary boundary(Periodic, Periodic, Periodic); 68 65 69 Comm *comm = new CommMPI(Boundary(Periodic, Periodic, Periodic), new DomainDecompositionMPI()); 70 comm->Register("COMM"); 66 new CommMPI(boundary, new DomainDecompositionMPI()); 67 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 68 new DiscretizationPoissonFD(2); 69 new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 70 new GaussSeidelRB(); 71 new Givens<SolverSingular>(); 72 new CycleCSPeriodic(2); 71 73 72 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 73 interface->Register("INTERFACE"); 74 75 Discretization* discretization = new DiscretizationPoissonFD(2); 76 discretization->Register("DISCRETIZATION"); 77 78 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear); 79 lop->Register("LEVEL_OPERATOR"); 80 81 Smoother* smoother = new GaussSeidelRB(); 82 smoother->Register("SMOOTHER"); 83 84 #ifdef HAVE_LAPACK 85 Solver* solver = new DSYSV<SolverSingular>(); 86 #else 87 Solver* solver = new Givens<SolverSingular>(); 88 #endif 89 solver->Register("SOLVER"); 90 91 Techniques::SetCorrectionSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2); 92 93 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 94 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 95 factory.RegisterObjectStorage("PRECISION", 1e-10); 96 factory.RegisterObjectStorage("MAX_ITERATION", 7); 74 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 75 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 76 new ObjectStorage<int>("MAX_ITERATION", 7); 77 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 97 78 98 79 MG::PostInit(); -
test/unit_test/library/periodic_fas.cpp
r2d3854 rb57b9b 34 34 #include "base/math.hpp" 35 35 #include "comm/comm_serial.hpp" 36 #include "cycles/cycle_fas_periodic.hpp" 36 37 #include "level/level_operator_fas.hpp" 37 38 #include "samples/discretization_poisson_fd.hpp" 38 #include "samples/techniques.hpp"39 #include "smoother/gs.hpp"40 39 #include "smoother/gsrb.hpp" 41 #ifdef HAVE_LAPACK42 #include "solver/dsysv.hpp"43 #endif44 40 #include "solver/givens.hpp" 45 41 #include "solver/solver_singular.hpp" … … 56 52 LibraryPeriodicFASFixture() 57 53 { 58 Factory& factory = MG::GetFactory();54 const Boundary boundary(Periodic, Periodic, Periodic); 59 55 60 Comm *comm = new CommSerial(Boundary(Periodic, Periodic, Periodic)); 61 comm->Register("COMM"); 56 new CommSerial(boundary); 57 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 58 new DiscretizationPoissonFD(2); 59 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 60 new GaussSeidelRB(); 61 new Givens<SolverSingular>(); 62 new CycleFASPeriodic(2); 62 63 63 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 64 interface->Register("INTERFACE"); 65 66 Discretization* discretization = new DiscretizationPoissonFD(2); 67 discretization->Register("DISCRETIZATION"); 68 69 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 70 lop->Register("LEVEL_OPERATOR"); 71 72 Smoother* smoother = new GaussSeidelRB(); 73 smoother->Register("SMOOTHER"); 74 75 #ifdef HAVE_LAPACK 76 Solver* solver = new DSYSV<SolverSingular>(); 77 #else 78 Solver* solver = new Givens<SolverSingular>(); 79 #endif 80 solver->Register("SOLVER"); 81 82 Techniques::SetFullApproximationSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2); 83 84 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 85 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 86 factory.RegisterObjectStorage("PRECISION", 1e-10); 87 factory.RegisterObjectStorage("MAX_ITERATION", 7); 64 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 65 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 66 new ObjectStorage<int>("MAX_ITERATION", 7); 67 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 88 68 89 69 MG::PostInit(); -
test/unit_test/library/periodic_fas_mpi.cpp
r2d3854 rb57b9b 43 43 #include "comm/comm_mpi.hpp" 44 44 #include "comm/domain_decomposition_mpi.hpp" 45 #include "cycles/cycle_fas_periodic.hpp" 45 46 #include "level/level_operator_fas.hpp" 46 47 #include "samples/discretization_poisson_fd.hpp" 47 #include "samples/techniques.hpp"48 #include "smoother/gs.hpp"49 48 #include "smoother/gsrb.hpp" 50 #ifdef HAVE_LAPACK51 #include "solver/dsysv.hpp"52 #endif53 49 #include "solver/givens.hpp" 54 50 #include "solver/solver_singular.hpp" … … 65 61 LibraryPeriodicFASMPIFixture() 66 62 { 67 Factory& factory = MG::GetFactory();63 const Boundary boundary(Periodic, Periodic, Periodic); 68 64 69 Comm* comm = new CommMPI(Boundary(Periodic, Periodic, Periodic), new DomainDecompositionMPI()); 70 comm->Register("COMM"); 65 new CommMPI(boundary, new DomainDecompositionMPI()); 66 new VMGInterfaces::InterfaceSinus(sine_factor, boundary, 2, 6, 0.0, 1.0); 67 new DiscretizationPoissonFD(2); 68 new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 69 new GaussSeidelRB(); 70 new Givens<SolverSingular>(); 71 new CycleFASPeriodic(2); 71 72 72 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0); 73 interface->Register("INTERFACE"); 73 new ObjectStorage<int>("PRESMOOTHSTEPS", 3); 74 new ObjectStorage<int>("POSTSMOOTHSTEPS", 3); 75 new ObjectStorage<int>("MAX_ITERATION", 7); 76 new ObjectStorage<vmg_float>("PRECISION", 1.0e-10); 74 77 75 Discretization* discretization = new DiscretizationPoissonFD(2); 76 discretization->Register("DISCRETIZATION"); 78 MG::PostInit(); 77 79 78 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); 79 lop->Register("LEVEL_OPERATOR"); 80 81 Smoother* smoother = new GaussSeidelRB(); 82 smoother->Register("SMOOTHER"); 83 84 #ifdef HAVE_LAPACK 85 Solver* solver = new DSYSV<SolverSingular>(); 86 #else 87 Solver* solver = new Givens<SolverSingular>(); 88 #endif 89 solver->Register("SOLVER"); 90 91 Techniques::SetFullApproximationSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2); 92 93 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3); 94 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3); 95 factory.RegisterObjectStorage("PRECISION", 1e-10); 96 factory.RegisterObjectStorage("MAX_ITERATION", 7); 97 98 MG::PostInit(); 99 100 MG::IsInitialized(); 80 MG::IsInitialized(); 101 81 } 102 82 103 83 ~LibraryPeriodicFASMPIFixture() 104 84 { 105 MG::Destroy();85 MG::Destroy(); 106 86 } 107 87 }; -
test/unit_test/unit_test/smoother_test.cpp
r2d3854 rb57b9b 47 47 SmootherFixture() 48 48 { 49 Boundary boundary(Dirichlet, Dirichlet, Dirichlet);49 const Boundary boundary(Dirichlet, Dirichlet, Dirichlet); 50 50 51 Comm* comm = new CommSerial(boundary); 52 comm->Register("COMM"); 53 54 Discretization* discretization = new DiscretizationPoissonFD(2); 55 discretization->Register("DISCRETIZATION"); 56 57 Interface* interface = new VMGInterfaces::InterfaceSinus(2.0*Math::pi, boundary, 4, 4, 0.0, 1.0); 58 interface->Register("INTERFACE"); 51 new CommSerial(boundary); 52 new DiscretizationPoissonFD(2); 53 new VMGInterfaces::InterfaceSinus(2.0*Math::pi, boundary, 4, 4, 0.0, 1.0); 59 54 60 55 MG::PostInit(); 61 56 62 interface->ImportRightHandSide(*MG::GetRhs());57 MG::GetInterface()->ImportRightHandSide(*MG::GetRhs()); 63 58 64 gs = new GaussSeidel( );65 gsrb = new GaussSeidelRB( );59 gs = new GaussSeidel(false); 60 gsrb = new GaussSeidelRB(false); 66 61 } 67 62 -
test/unit_test/unit_test/solver_test.cpp
r2d3854 rb57b9b 285 285 { 286 286 #ifdef HAVE_LAPACK 287 DGESVTest dgesv;288 BOOST_CHECK_CLOSE( 8.5, dgesv .solution_array[0], 1.0e-12);289 BOOST_CHECK_CLOSE(-16.0, dgesv .solution_array[1], 1.0e-12);290 BOOST_CHECK_CLOSE(-18.0, dgesv .solution_array[2], 1.0e-12);291 BOOST_CHECK_CLOSE( 12.0, dgesv .solution_array[3], 1.0e-12);292 BOOST_CHECK_CLOSE( 4.0, dgesv .solution_array[4], 1.0e-12);287 DGESVTest* dgesv = new DGESVTest(); 288 BOOST_CHECK_CLOSE( 8.5, dgesv->solution_array[0], 1.0e-12); 289 BOOST_CHECK_CLOSE(-16.0, dgesv->solution_array[1], 1.0e-12); 290 BOOST_CHECK_CLOSE(-18.0, dgesv->solution_array[2], 1.0e-12); 291 BOOST_CHECK_CLOSE( 12.0, dgesv->solution_array[3], 1.0e-12); 292 BOOST_CHECK_CLOSE( 4.0, dgesv->solution_array[4], 1.0e-12); 293 293 #endif /* HAVE_LAPACK */ 294 294 } … … 297 297 { 298 298 #ifdef HAVE_LAPACK 299 DSYSVTest dsysv;300 BOOST_CHECK_CLOSE(-0.0625, dsysv .solution_array[0], 1.0e-12);301 BOOST_CHECK_SMALL( dsysv .solution_array[1], 1.0e-12);302 BOOST_CHECK_CLOSE(-0.0625, dsysv .solution_array[2], 1.0e-12);303 BOOST_CHECK_SMALL( dsysv .solution_array[3], 1.0e-12);304 BOOST_CHECK_CLOSE( 0.25, dsysv .solution_array[4], 1.0e-12);305 BOOST_CHECK_SMALL( dsysv .solution_array[5], 1.0e-12);306 BOOST_CHECK_CLOSE(-0.0625, dsysv .solution_array[6], 1.0e-12);307 BOOST_CHECK_SMALL( dsysv .solution_array[7], 1.0e-12);308 BOOST_CHECK_CLOSE(-0.0625, dsysv .solution_array[8], 1.0e-12);299 DSYSVTest* dsysv = new DSYSVTest(); 300 BOOST_CHECK_CLOSE(-0.0625, dsysv->solution_array[0], 1.0e-12); 301 BOOST_CHECK_SMALL( dsysv->solution_array[1], 1.0e-12); 302 BOOST_CHECK_CLOSE(-0.0625, dsysv->solution_array[2], 1.0e-12); 303 BOOST_CHECK_SMALL( dsysv->solution_array[3], 1.0e-12); 304 BOOST_CHECK_CLOSE( 0.25, dsysv->solution_array[4], 1.0e-12); 305 BOOST_CHECK_SMALL( dsysv->solution_array[5], 1.0e-12); 306 BOOST_CHECK_CLOSE(-0.0625, dsysv->solution_array[6], 1.0e-12); 307 BOOST_CHECK_SMALL( dsysv->solution_array[7], 1.0e-12); 308 BOOST_CHECK_CLOSE(-0.0625, dsysv->solution_array[8], 1.0e-12); 309 309 #endif 310 310 } … … 312 312 BOOST_AUTO_TEST_CASE(SolverGivensTest) 313 313 { 314 GivensTest givens;315 BOOST_CHECK_CLOSE( 8.5, givens .solution_array[0], 1.0e-12);316 BOOST_CHECK_CLOSE(-16.0, givens .solution_array[1], 1.0e-12);317 BOOST_CHECK_CLOSE(-18.0, givens .solution_array[2], 1.0e-12);318 BOOST_CHECK_CLOSE( 12.0, givens .solution_array[3], 1.0e-12);319 BOOST_CHECK_CLOSE( 4.0, givens .solution_array[4], 1.0e-12);314 GivensTest* givens = new GivensTest(); 315 BOOST_CHECK_CLOSE( 8.5, givens->solution_array[0], 1.0e-12); 316 BOOST_CHECK_CLOSE(-16.0, givens->solution_array[1], 1.0e-12); 317 BOOST_CHECK_CLOSE(-18.0, givens->solution_array[2], 1.0e-12); 318 BOOST_CHECK_CLOSE( 12.0, givens->solution_array[3], 1.0e-12); 319 BOOST_CHECK_CLOSE( 4.0, givens->solution_array[4], 1.0e-12); 320 320 } 321 321
Note:
See TracChangeset
for help on using the changeset viewer.
