예제 #1
0
void
PreconditionerML::createMLList ( list_Type& list,
                                 const GetPot&       dataFile,
                                 const std::string&  section,
                                 const std::string&  subSection,
                                 const bool&         verbose )
{
    list.setName ( "ML paramters list" );

    std::string defList = dataFile ( (section + "/" + subSection + "/default_parameter_list").data(), "SA" );
    if ( defList != "none" )
    {
        ML_Epetra::SetDefaults ( defList, list );
    }

    bool found;

    bool MLPrintParameterList = dataFile ( (section + "/displayList").data(), false, found );

    Int MLOutput             = dataFile ( (section + "/" + subSection + "/MLOuput").data(), 0, found);
    if ( found )
    {
        list.set ( "ML output", MLOutput );
    }

    Int printUnused          = dataFile ( (section + "/" + subSection + "/print_unused").data(), -2, found);
    if ( found )
    {
        list.set ( "print unused", printUnused );
    }

    Int PDEEquations         = dataFile ( (section + "/" + subSection + "/pde_equations").data(), 1, found);
    if ( found )
    {
        list.set ( "PDE equations", PDEEquations );
    }

    Int CycleApplications    = dataFile ( (section + "/" + subSection + "/cycle_applications").data(), 1, found);
    if ( found )
    {
        list.set ( "cycle applications", CycleApplications );
    }

    Int MaxLevels            = dataFile ( (section + "/" + subSection + "/max_levels").data(), 2, found);
    if ( found )
    {
        list.set ( "max levels", MaxLevels );
    }

    std::string IncOrDec     = dataFile ( (section + "/" + subSection + "/inc_or_dec").data(), "increasing", found);
    if ( found )
    {
        list.set ( "increasing or decreasing", IncOrDec );
    }

    std::string precType     = dataFile ( (section + "/" + subSection + "/prec_type").data(), "MGV", found);
    if ( found )
    {
        list.set ( "prec type", precType );
    }

    // Int NumProjectedModes    = dataFile( (section + "/" + subSection + "/number_of_prejected_modes").data(), 0 );
    // if ( found ) list.set( "ML print parameter list", MLPrintParameterList );

    std::string eigenAnalysisType = dataFile ( (section + "/" + subSection + "/eigne-analysis/type").data(), "cg", found );
    if ( found )
    {
        list.set ( "eigen-analysis: type", eigenAnalysisType );
    }

    Int eigenAnalysisIterations   = dataFile ( (section + "/" + subSection + "/eigne-analysis/iterations").data(), 10, found );
    if ( found )
    {
        list.set ( "eigen-analysis: iterations", eigenAnalysisIterations );
    }

    // Aggregation options

    std::string AggregationType                  = dataFile ( (section + "/" + subSection + "/aggregation/type").data(), "Uncoupled", found );
    if ( found )
    {
        list.set ( "aggregation: type", AggregationType );
    }

    bool AggregationBlockScaling          = dataFile ( (section + "/" + subSection + "/aggregation/block_scaling").data(), false, found );
    if ( found )
    {
        list.set ( "aggregation: block scaling", AggregationBlockScaling );
    }

    Real        AggregationThreshold             = dataFile ( (section + "/" + subSection + "/aggregation/threshold").data(), 0.0 , found );
    if ( found )
    {
        list.set ( "aggregation: threshold", AggregationThreshold );
    }

    Real        AggregationDampingFactor         = dataFile ( (section + "/" + subSection + "/aggregation/damping_factor").data(), 4. / 3. , found );
    if ( found )
    {
        list.set ( "aggregation: damping factor", AggregationDampingFactor );
    }

    Int AggregationSmoothingSweeps               = dataFile ( (section + "/" + subSection + "/aggregation/smoothing_sweeps").data(), 1, found );
    if ( found )
    {
        list.set ( "aggregation: smoothing sweeps", AggregationSmoothingSweeps );
    }

    Int AggregationGlobalAggregates              = dataFile ( (section + "/" + subSection + "/aggregation/global_aggregates").data(), 1, found );
    if ( found )
    {
        list.set ( "aggregation: global aggregates", AggregationGlobalAggregates );
    }

    Int AggregationLocalAggregates               = dataFile ( (section + "/" + subSection + "/aggregation/local_aggregates").data(), 1, found );
    if ( found )
    {
        list.set ( "aggregation: local aggregates", AggregationLocalAggregates );
    }

    Int AggregationNodesPerAggregate             = dataFile ( (section + "/" + subSection + "/aggregation/nodes_per_aggregate").data(), 1, found );
    if ( found )
    {
        list.set ( "aggregation: nodes per aggregate",  AggregationNodesPerAggregate );
    }

    Int AggregationNextLevelAggregatesPerProcess = dataFile ( (section + "/" + subSection + "/aggregation/next-level_aggregates_per_process").data(), 128, found );
    if ( found )
    {
        list.set ( "aggregation: next level aggregates per process", AggregationNextLevelAggregatesPerProcess );
    }

    bool AggregationUseTentativeRestriction      = dataFile ( (section + "/" + subSection + "/aggregation/tentative_restriction").data(), false, found );
    if ( found )
    {
        list.set ( "aggregation: use tentative restriction", AggregationUseTentativeRestriction );
    }

    bool AggregationSymmetrize                   = dataFile ( (section + "/" + subSection + "/aggregation/symmetrize").data(), false, found );
    if ( found )
    {
        list.set ( "aggregation: symmetrize", AggregationSymmetrize );
    }

    Int AggregationNumLevelTypes                 = dataFile ( (section + "/" + subSection + "/aggregation/level_type").data(), 0, found );
    if ( found )
    {
        for (Int i (0); i < AggregationNumLevelTypes; ++i)
        {
            std::string levelIndex             = dataFile ( (section + "/" + subSection + "/aggregation/level_type").data(), "0", 2 * i + 1 );
            std::string levelParamValue = dataFile ( (section + "/" + subSection + "/aggregation/level_type").data(), "METIS", 2 * i + 2 );
            list.set ( ("aggregation: type (level " + levelIndex + ")").data(), levelParamValue );
        }
    }

    bool   EnergyMinimizationEnable              = dataFile ( (section + "/" + subSection + "/energy_minimization/enable").data(), false, found );
    if ( found )
    {
        list.set ( "energy minimization: enable", EnergyMinimizationEnable );
    }

    Int    EnergyMinimizationType                = dataFile ( (section + "/" + subSection + "/energy_minimization/type").data(), 2, found );
    if ( found )
    {
        list.set ( "energy minimization: type", EnergyMinimizationType );
    }

    Real   EnergyMinimizationDropTol             = dataFile ( (section + "/" + subSection + "/energy_minimization/droptol").data(), 0., found );
    if ( found )
    {
        list.set ( "energy minimization: droptol", EnergyMinimizationDropTol );
    }

    bool   EnergyMinimizationCheap               = dataFile ( (section + "/" + subSection + "/energy_minimization/cheap").data(), false, found );
    if ( found )
    {
        list.set ( "energy minimization: cheap", EnergyMinimizationCheap );
    }

    // Smoothing parameters

    std::string SmootherType                = dataFile ( (section + "/" + subSection + "/smoother/type").data(), "IFPACK", found );
    if ( found )
    {
        list.set ( "smoother: type", SmootherType );
    }

    Int SmootherSweeps                      = dataFile ( (section + "/" + subSection + "/smoother/sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "smoother: sweeps", SmootherSweeps );
    }

    Real   SmootherDampingFactor            = dataFile ( (section + "/" + subSection + "/smoother/damping_factor").data(), 1.0, found );
    if ( found )
    {
        list.set ( "smoother: damping factor", SmootherDampingFactor );
    }

    std::string SmootherPreOrPost           = dataFile ( (section + "/" + subSection + "/smoother/pre_or_post").data(), "both", found );
    if ( found )
    {
        list.set ( "smoother: pre or post", SmootherPreOrPost );
    }

    Real   SmootherChebyshevAlpha           = dataFile ( (section + "/" + subSection + "/smoother/Chebyshev_alpha").data(), 20., found );
    if ( found )
    {
        list.set ( "smoother: Chebyshev alpha", SmootherChebyshevAlpha );
    }

    bool SmootherHiptmairEfficientSymmetric = dataFile ( (section + "/" + subSection + "/smoother/Hiptmair_efficient_symmetric").data(), true, found );
    if ( found )
    {
        list.set ( "smoother: Hiptmair efficient symmetric", SmootherHiptmairEfficientSymmetric );
    }

    std::string SmootherIfpackType           = dataFile ( (section + "/" + subSection + "/smoother/ifpack_type").data(), "ILU", found );
    if ( found )
    {
        list.set ( "smoother: ifpack type", SmootherIfpackType );
    }

    Int SmootherIfpackOverlap                = dataFile ( (section + "/" + subSection + "/smoother/ifpack_overlap").data(), 1, found );
    if ( found )
    {
        list.set ( "smoother: ifpack overlap", SmootherIfpackOverlap );
    }

    Int SmootherNumLevelTypes               = dataFile ( (section + "/" + subSection + "/smoother/level_type").data(), 0, found );
    if ( found )
    {
        for (Int i (0); i < SmootherNumLevelTypes; ++i)
        {
            std::string levelIndex          = dataFile ( (section + "/" + subSection + "/smoother/level_type").data(), "0", 2 * i + 1 );
            std::string levelParamValue     = dataFile ( (section + "/" + subSection + "/smoother/level_type").data(), "IFPACK", 2 * i + 2 );
            list.set ( ("smoother: type (level " + levelIndex + ")").data(), levelParamValue );
        }
    }

    Int SmootherNumLevelSweeps              = dataFile ( (section + "/" + subSection + "/smoother/level_sweeps").data(), 0, found );
    if ( found )
    {
        for (Int i (0); i < SmootherNumLevelSweeps; ++i)
        {
            std::string levelIndex          = dataFile ( (section + "/" + subSection + "/smoother/level_sweeps").data(), "0", 2 * i + 1 );
            Int levelParamValue             = dataFile ( (section + "/" + subSection + "/smoother/level_sweeps").data(), 1, 2 * i + 2 );
            list.set ( ("smoother: sweeps (level " + levelIndex + ")").data(), levelParamValue );
        }
    }

    // subsmoother parameter

    std::string SubSmootherType             = dataFile ( (section + "/" + subSection + "/subsmoother/type").data(), "Chebyshev", found );
    if ( found )
    {
        list.set ( "subsmoother: type", SubSmootherType );
    }

    Real   SubSmootherChebyshevAlpha        = dataFile ( (section + "/" + subSection + "/subsmoother/Chebyshev_alpha").data(), 20., found );
    if ( found )
    {
        list.set ( "subsmoother: Chebyshev alpha", SubSmootherChebyshevAlpha );
    }

    //    Real   SubSmootherSGSDampingFactor      = dataFile((section + "/" + subSection + "/subsmoothers/SGS_damping_factor").data(), 1., found );
    Int SubSmootherEdgeSweeps               = dataFile ( (section + "/" + subSection + "/subsmoother/edge_sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "subsmoother: edge sweeps", SubSmootherEdgeSweeps );
    }

    Int SubSmootherNodeSweeps               = dataFile ( (section + "/" + subSection + "/subsmoother/node_sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "subsmoother: node sweeps", SubSmootherNodeSweeps );
    }


    // Coarsest Grid Parameters

    Int CoarseMaxSize                 = dataFile ( (section + "/" + subSection + "/coarse/max_size").data(), 128, found );
    if ( found )
    {
        list.set ( "coarse: max size",  CoarseMaxSize );
    }

    std::string CoarseType            = dataFile ( (section + "/" + subSection + "/coarse/type").data(), "Chebyshev", found );
    if ( found )
    {
        list.set ( "coarse: type", CoarseType );
    }

    std::string CoarsePreOrPost       = dataFile ( (section + "/" + subSection + "/coarse/pre_or_post").data(), "post", found );
    if ( found )
    {
        list.set ( "coarse: pre or post", CoarsePreOrPost );
    }

    Int CoarseSweeps                  = dataFile ( (section + "/" + subSection + "/coarse/sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "coarse: sweeps", CoarseSweeps );
    }

    Real   CoarseDampingFactor        = dataFile ( (section + "/" + subSection + "/coarse/damping_factor").data(), 1.0, found );
    if ( found )
    {
        list.set ( "coarse: damping factor", CoarseDampingFactor );
    }

    std::string CoarseSubsmootherType = dataFile ( (section + "/" + subSection + "/coarse/subsmoother_type").data(), "Chebyshev", found );
    if ( found )
    {
        list.set ( "coarse: subsmoother type", CoarseSubsmootherType );
    }

    Int CoarseNodeSweeps              = dataFile ( (section + "/" + subSection + "/coarse/node_sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "coarse: node sweeps", CoarseNodeSweeps );
    }

    Int CoarseEdgeSweeps              = dataFile ( (section + "/" + subSection + "/coarse/edge_sweeps").data(), 2, found );
    if ( found )
    {
        list.set ( "coarse: edge sweeps", CoarseEdgeSweeps );
    }

    Real   CoarseChebyshevAlpha       = dataFile ( (section + "/" + subSection + "/coarse/Chebyshev_alpha").data(), 30., found );
    if ( found )
    {
        list.set ( "coarse: Chebyshev alpha", CoarseChebyshevAlpha );
    }

    Int CoarseMaxProcesses            = dataFile ( (section + "/" + subSection + "/coarse/max_processes").data(), -1, found );
    if ( found )
    {
        list.set ( "coarse: max processes", CoarseMaxProcesses );
    }


    // Load-balancing Options
    Int RepartitionEnable              = dataFile ( (section + "/" + subSection + "/repartition/enable").data(), 0, found );
    if ( found )
    {
        list.set ( "repartition: enable", RepartitionEnable );
    }

    std::string RepartitionPartitioner = dataFile ( (section + "/" + subSection + "/repartition/partitioner").data(), "ParMETIS", found );
    if ( found )
    {
        list.set ( "repartition: partitioner", RepartitionPartitioner );
    }

    Real   RepartitionMaxMinRatio      = dataFile ( (section + "/" + subSection + "/repartition/max_min_ratio").data(), 1.3, found );
    if ( found )
    {
        list.set ( "repartition: max min ratio", RepartitionMaxMinRatio );
    }

    Int RepartitionMinPerProc          = dataFile ( (section + "/" + subSection + "/repartition/min_per_proc").data(), 512, found );
    if ( found )
    {
        list.set ( "repartition: min per proc", RepartitionMinPerProc );
    }

    Real   RepartitionNodeMaxMinRatio  = dataFile ( (section + "/" + subSection + "/repartition/node_max_min_ratio").data(), 1.3, found );
    if ( found )
    {
        list.set ( "repartition: node max min ratio", RepartitionNodeMaxMinRatio );
    }

    Int RepartitionNodeMinPerProc      = dataFile ( (section + "/" + subSection + "/repartition/node_min_per_proc").data(), 170, found );
    if ( found )
    {
        list.set ( "repartition: node min per proc", RepartitionNodeMinPerProc );
    }

    Int RepartitionZoltanDimensions    = dataFile ( (section + "/" + subSection + "/repartition/Zoltan_dimensions").data(), 2, found );
    if ( found )
    {
        list.set ( "repartition: Zoltan dimensions", RepartitionZoltanDimensions );
    }

    if ( MLPrintParameterList && verbose )
    {
        std::cout << "ML parameters list:" << std::endl;
        std::cout << "-----------------------------" << std::endl;
        list.print ( std::cout );
        std::cout << "-----------------------------" << std::endl;
    }
}
예제 #2
0
 void setParameters (list_Type&  list)
 {
     M_startingTimeStimulus =  list.get ("starting_time_stimulus", 0.0);
     M_tShortS1S1 = list.get ("tShortS1S1", 0.001);
     M_stimulusInterval = list.get ("stimulus_interval", 0.0 );
     this->setStIntMin ( list.get ("stIntMin", 0.001) );
     this->setStIntS1S2 ( list.get ("stIntS1S2", 0.0) );
     this->setStIntS1S2Min ( list.get ("stIntS1S2Min", 10.0) );
     this->setStIntS2S3 ( list.get ("stIntS2S3", 0.01) );
     this->setStIntS3S4 ( list.get ("stIntS3S4", 0.01) );
     M_nbStimMax = list.get ("nbStimMax", 1);
     this->setRepeatSt ( list.get ("repeatSt", 1) );
     this->setTimeStep ( list.get ("dt", 0.01) );
     this->setPacingProtocol ( list.get ("pacPro", "FCL-ExtraSt") );
     this->setPacingProtocolType ( list.get ("pacProType", "S1-S2") );
     M_stimulusDuration = list.get ("duration_stimulus", 1.0 );
     M_pacingSite_X = list.get ( "pacing_site_X", 1.0 );
     M_pacingSite_Y = list.get ( "pacing_site_Y", 1.0 );
     M_pacingSite_Z = list.get ( "pacing_site_Z", 1.0 );
     M_radius = list.get ( "applied_current_radius", 0.2 );
     M_stimulusAmplitude = list.get ( "stimulus_amplitude", 1.0 );
 }
예제 #3
0
void
PreconditionerIfpack::createIfpackList( list_Type&         list,
                                        const GetPot&      dataFile,
                                        const std::string& section,
                                        const std::string& subSection,
                                        const bool&        verbose )
{
    // See http://trilinos.sandia.gov/packages/docs/r9.0/packages/ifpack/doc/html/index.html
    // for more informations on the parameters

    Int overlapLevel     = dataFile( (section + "/" + subSection + "/overlap").data(), 0 );

    std::string precType = dataFile( (section + "/" + subSection + "/prectype").data(), "Amesos" );

    list.set( "prectype", precType );
    list.set( "overlap level", overlapLevel );

    bool displayList = dataFile( (section + "/displayList").data(), false );

    std::string relaxationType              = dataFile( (section + "/" + subSection + "/relaxation/type").data(), "Jacobi" );
    Int         relaxationSweeps            = dataFile( (section + "/" + subSection + "/relaxation/sweeps").data(), 1 );
    Real        relaxationDampingFactor     = dataFile( (section + "/" + subSection + "/relaxation/damping_factor").data(), 1.0 );
    Real        relaxationMinDiagValue      = dataFile( (section + "/" + subSection + "/relaxation/min_diagonal_value").data(), 0.0 );
    bool        relaxationZeroStartSolution = dataFile( (section + "/" + subSection + "/relaxation/zero_starting_solution").data(), true );

    list.set( "relaxation: type", relaxationType );
    list.set( "relaxation: sweeps", relaxationSweeps );
    list.set( "relaxation: damping factor", relaxationDampingFactor );
    list.set( "relaxation: min diagonal value", relaxationMinDiagValue );
    list.set( "relaxation: zero starting solution", relaxationZeroStartSolution );

    std::string partitionerType         = dataFile( (section + "/" + subSection + "/partitioner/type").data(), "metis" );
    Int         partitionerOverlap      = dataFile( (section + "/" + subSection + "/partitioner/overlap").data(), 0 );
    Int         partitionerLocalParts   = dataFile( (section + "/" + subSection + "/partitioner/local_parts").data(), 1 );
    Int         partitionerRootNode     = dataFile( (section + "/" + subSection + "/partitioner/root_node").data(), 0 );
    bool        partitionerUseSymmGraph = dataFile( (section + "/" + subSection + "/partitioner/use_symmetric_graph").data(), true );

    list.set( "partitioner: type",                partitionerType );
    list.set( "partitioner: overlap",             partitionerOverlap );
    list.set( "partitioner: local parts",         partitionerLocalParts );
    list.set( "partitioner: root node",           partitionerRootNode );
    list.set( "partitioner: use symmetric graph", partitionerUseSymmGraph );

    std::string amesosSolverType = dataFile( (section + "/" + subSection + "/amesos/solvertype").data(), "Amesos_KLU" );

    list.set( "amesos: solver type", amesosSolverType );

    Int    levelOfFill     = dataFile( (section + "/" + subSection + "/fact/level-of-fill").data(),      4  );
    Real   ILUTlevelOfFill = dataFile( (section + "/" + subSection + "/fact/ilut_level-of-fill").data(), 4. );
    Real   athr            = dataFile( (section + "/" + subSection + "/fact/absolute_threshold").data(), 0. );
    Real   rthr            = dataFile( (section + "/" + subSection + "/fact/relative_threshold").data(), 1. );
    Real   relaxValue      = dataFile( (section + "/" + subSection + "/fact/relax_value").data(), 0. );
    Real   dropTolerance   = dataFile( (section + "/" + subSection + "/fact/drop_tolerance").data(), 1e-5 );

    list.set( "fact: drop tolerance", dropTolerance );
    list.set( "fact: level-of-fill", levelOfFill );
    list.set( "fact: ilut level-of-fill", ILUTlevelOfFill );
    list.set( "fact: absolute threshold", athr );
    list.set( "fact: relative threshold", rthr );
    list.set( "fact: relax value", relaxValue );

    Int combineMode = dataFile( (section + "/" + subSection + "/schwarz/combine_mode").data(), 0 );
    Epetra_CombineMode schwarzCombineMode;

    switch (combineMode)
    {
    case 0 :
        schwarzCombineMode = Add;
        break;
    case 1 :
        schwarzCombineMode = Zero;
        break;
    case 2 :
        schwarzCombineMode = Insert;
        break;
    case 3 :
        schwarzCombineMode = Average;
        break;
    case 4 :
        schwarzCombineMode = AbsMax;
        break;
    default:
        schwarzCombineMode = Zero;
    }

    bool schwarzComputeCondest        = dataFile( (section + "/" + subSection + "/schwarz/compute_condest").data(), true );
    std::string schwarzReorderingType = dataFile( (section + "/" + subSection + "/schwarz/reordering_type").data(), "none" );
    bool schwarzFilterSingletons      = dataFile( (section + "/" + subSection + "/schwarz/filter_singletons").data(), true );

    list.set( "schwarz: combine mode", schwarzCombineMode);
    list.set( "schwarz: compute condest", schwarzComputeCondest);
    list.set( "schwarz: reordering type", schwarzReorderingType);
    list.set( "schwarz: filter singletons", schwarzFilterSingletons);

    if ( displayList && verbose )
    {
        std::cout << "Ifpack parameters list:" << std::endl;
        std::cout << "-----------------------------" << std::endl;
        list.print( std::cout );
        std::cout << "-----------------------------" << std::endl;
    }
}