Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShyLU_DD/FROSch: Replace FROSch::SubomainSolver by FROSch::SolverFactory #8825

Merged
merged 19 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@

#cmakedefine HAVE_SHYLU_DDFROSCH_ZOLTAN2


#cmakedefine HAVE_SHYLU_DDFROSCH_HDF5
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//@HEADER
// ************************************************************************
//
// ShyLU: Hybrid preconditioner package
// Copyright 2012 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Alexander Heinlein ([email protected])
//
// ************************************************************************
//@HEADER

#ifndef _STRATIMIKOS_FROSCH_DECL_HPP
#define _STRATIMIKOS_FROSCH_DECL_HPP

#include <ShyLU_DDFROSch_config.h>

#ifdef HAVE_SHYLU_DDFROSCH_STRATIMIKOS
#include "Stratimikos_DefaultLinearSolverBuilder.hpp"

#include "Teuchos_RCP.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_TestForException.hpp"
#include "Teuchos_AbstractFactoryStd.hpp"


namespace Thyra {

template <class SC,
class LO,
class GO,
class NO>
class FROSchFactory;
}

namespace Stratimikos {

using namespace std;
using namespace Teuchos;
using namespace Thyra;

template <typename LO = int,
typename GO = int,
typename NO = KokkosClassic::DefaultNode::DefaultNodeType>
void enableFROSch(DefaultLinearSolverBuilder& builder,
const string& stratName = "FROSch");
} // namespace Stratimikos

#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,36 @@
// ************************************************************************
//@HEADER

#ifndef THYRA_FROSCH_XPETRA_FACTORY_HPP
#define THYRA_FROSCH_XPETRA_FACTORY_HPP
#ifndef _STRATIMIKOS_FROSCH_DEF_HPP
#define _STRATIMIKOS_FROSCH_DEF_HPP

#include <ShyLU_DDFROSch_config.h>

#ifdef HAVE_SHYLU_DDFROSCH_STRATIMIKOS
#include "Stratimikos_DefaultLinearSolverBuilder.hpp"
#include "Stratimikos_FROSch_decl.hpp"

#include "Thyra_FROSchFactory_def.hpp"

#include "Teuchos_RCP.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_TestForException.hpp"
#include "Teuchos_AbstractFactoryStd.hpp"

#include <string>


namespace Stratimikos {

using namespace std;
using namespace Teuchos;
using namespace Thyra;

template <typename LO = int,typename GO = int,typename NO = KokkosClassic::DefaultNode::DefaultNodeType>
template <typename LO,typename GO,typename NO>
void enableFROSch (DefaultLinearSolverBuilder& builder,
const string& stratName = "FROSch")
const string& stratName)
{
const RCP<const ParameterList> precValidParams = sublist(builder.getValidParameters(), "Preconditioner Types");

TEUCHOS_TEST_FOR_EXCEPTION(precValidParams->isParameter(stratName), logic_error,
"Stratimikos::enableFROSch cannot add \"" + stratName +"\" because it is already included in builder!");

using Base = PreconditionerFactoryBase<double>;
using Base = PreconditionerFactoryBase<double>;
if (!stratName.compare("FROSch")) {
using Impl = FROSchFactory<double, LO, GO, NO> ;
using Impl = FROSchFactory<double, LO, GO, NO>;
builder.setPreconditioningStrategyFactory(abstractFactoryStd<Base, Impl>(), stratName);
}
}

} // namespace Stratimikos

#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
// ************************************************************************
//@HEADER

#ifndef THYRA_FROSCH_XPETRA_FACTORY_DECL_HPP
#define THYRA_FROSCH_XPETRA_FACTORY_DECL_HPP
#ifndef _THYRA_FROSCH_FACTORY_DECL_HPP
#define _THYRA_FROSCH_FACTORY_DECL_HPP

#include <ShyLU_DDFROSch_config.h>

Expand Down Expand Up @@ -83,15 +83,11 @@
#endif

//FROSch
#include <FROSch_AlgebraicOverlappingPreconditioner_def.hpp>
#include <FROSch_GDSWPreconditioner_def.hpp>
#include <FROSch_RGDSWPreconditioner_def.hpp>
#include <FROSch_OneLevelPreconditioner_def.hpp>
#include <FROSch_TwoLevelPreconditioner_def.hpp>
#include <FROSch_TwoLevelBlockPreconditioner_def.hpp>
#include <Thyra_FROSchLinearOp_def.hpp>
#include <FROSch_Tools_def.hpp>

#include <FROSch_SchwarzPreconditioners_fwd.hpp>


namespace Thyra {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,24 @@
// ************************************************************************
//@HEADER

#ifndef THYRA_FROSCH_XPETRA_FACTORY_DEF_HPP
#define THYRA_FROSCH_XPETRA_FACTORY_DEF_HPP
#ifndef _THYRA_FROSCH_FACTORY_DEF_HPP
#define _THYRA_FROSCH_FACTORY_DEF_HPP

#include "Thyra_FROSchFactory_decl.hpp"

#include <FROSch_AlgebraicOverlappingPreconditioner_def.hpp>
#include <FROSch_GDSWPreconditioner_def.hpp>
#include <FROSch_RGDSWPreconditioner_def.hpp>
#include <FROSch_OneLevelPreconditioner_def.hpp>
#include <FROSch_TwoLevelPreconditioner_def.hpp>
#include <FROSch_TwoLevelBlockPreconditioner_def.hpp>


namespace Thyra {

using namespace FROSch;
using namespace std;
using namespace Teuchos;
using namespace Thyra;
using namespace Xpetra;

//Constructor
Expand Down Expand Up @@ -272,7 +278,7 @@ namespace Thyra {
}
}

FROSCH_ASSERT(!repeatedMaps.is_null(),"FROSch::FROSchFactory : ERROR: repeatedMaps.is_null()");
FROSCH_ASSERT(!repeatedMaps.is_null(),"FROSch::FROSchFactory: repeatedMaps.is_null()");
// Extract the DofsPerNode vector
dofsPerNodeVector = ExtractVectorFromParameterList<UN>(*paramList_,"DofsPerNode Vector");
// Extract the DofOrdering vector
Expand All @@ -295,7 +301,7 @@ namespace Thyra {

SchwarzPreconditioner = TLBP;
} else {
FROSCH_ASSERT(false,"Thyra::FROSchFactory : ERROR: Preconditioner Type is unknown.");
FROSCH_ASSERT(false,"Thyra::FROSchFactory: Preconditioner Type is unknown.");
}

SchwarzPreconditioner->compute();
Expand Down Expand Up @@ -344,7 +350,7 @@ namespace Thyra {
TLBP->resetMatrix(A);
SchwarzPreconditioner = TLBP;
} else {
FROSCH_ASSERT(false,"Thyra::FROSchFactory : ERROR: Preconditioner Type is unknown.");
FROSCH_ASSERT(false,"Thyra::FROSchFactory: Preconditioner Type is unknown.");
}
// recompute SchwarzPreconditioner
SchwarzPreconditioner->compute();
Expand Down Expand Up @@ -441,7 +447,7 @@ namespace Thyra {
#endif
}
}
FROSCH_ASSERT(!repeatedMap.is_null(),"FROSch::FROSchFactory : ERROR: repeatedMap.is_null()");
FROSCH_ASSERT(!repeatedMap.is_null(),"FROSch::FROSchFactory: repeatedMap.is_null()");
}
return repeatedMap;
}
Expand All @@ -465,7 +471,7 @@ namespace Thyra {
#endif
}
}
FROSCH_ASSERT(!coordinatesList.is_null(),"FROSch::FROSchFactory : ERROR: coordinatesList.is_null()");
FROSCH_ASSERT(!coordinatesList.is_null(),"FROSch::FROSchFactory: coordinatesList.is_null()");
}
return coordinatesList;
}
Expand All @@ -489,7 +495,7 @@ namespace Thyra {
#endif
}
}
FROSCH_ASSERT(!nullSpaceBasis.is_null(),"FROSch::FROSchFactory : ERROR: nullSpaceBasis.is_null()");
FROSCH_ASSERT(!nullSpaceBasis.is_null(),"FROSch::FROSchFactory: nullSpaceBasis.is_null()");
}
return nullSpaceBasis;
}
Expand Down
Loading