https://mooseframework.inl.gov
Functions
Moose::Kokkos::Utils Namespace Reference

Functions

template<typename T >
KOKKOS_INLINE_FUNCTION const T * find (const T &target, const T *const begin, const T *const end)
 Find a value in an array. More...
 
KOKKOS_INLINE_FUNCTION void choleskySolve (Real *const A, Real *const x, Real *const b, const unsigned int n)
 Perform an in-place linear solve using Cholesky decomposition Matrix and right-hand-side vector are modified after this call. More...
 

Function Documentation

◆ choleskySolve()

KOKKOS_INLINE_FUNCTION void Moose::Kokkos::Utils::choleskySolve ( Real *const  A,
Real *const  x,
Real *const  b,
const unsigned int  n 
)

Perform an in-place linear solve using Cholesky decomposition Matrix and right-hand-side vector are modified after this call.

Parameters
AThe row-major matrix
xThe solution vector
bThe right-hand-side vector
nThe system size

Definition at line 62 of file KokkosUtils.h.

Referenced by InitialConditionTempl< T >::compute(), and Moose::Kokkos::AuxKernel::computeElementInternal().

63 {
64  for (unsigned int i = 0; i < n; ++i)
65  {
66  for (unsigned int j = 0; j <= i; ++j)
67  {
68  Real sum = A[j + n * i];
69 
70  for (unsigned int k = 0; k < j; ++k)
71  sum -= A[k + n * i] * A[k + n * j];
72 
73  if (i == j)
74  A[j + n * i] = ::Kokkos::sqrt(sum);
75  else
76  A[j + n * i] = sum / A[j + n * j];
77  }
78  }
79 
80  for (unsigned int i = 0; i < n; ++i)
81  {
82  Real sum = b[i];
83 
84  for (unsigned int j = 0; j < i; ++j)
85  sum -= A[j + n * i] * b[j];
86 
87  b[i] = sum / A[i + n * i];
88  }
89 
90  for (int i = n - 1; i >= 0; --i)
91  {
92  Real sum = b[i];
93 
94  for (unsigned int j = i + 1; j < n; ++j)
95  sum -= A[i + n * j] * b[j];
96 
97  x[i] = sum / A[i + n * i];
98  }
99 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh

◆ find()

template<typename T >
KOKKOS_INLINE_FUNCTION const T* Moose::Kokkos::Utils::find ( const T &  target,
const T *const  begin,
const T *const  end 
)

Find a value in an array.

Parameters
targetThe target value to find
beginThe pointer to the first element of the array
endThe pointer next to the last element of the array
Returns
The pointer to the target element, end if the target element was not found

Definition at line 30 of file KokkosUtils.h.

Referenced by ElementIDOutputAction::act(), AddKernelAction::act(), CombineComponentsMeshes::act(), MeshOnlyAction::act(), ChainControlSetupAction::act(), MaterialOutputAction::act(), ChainControl::addChainControlDataDependency(), Moose::MFEM::CoefficientMap< mfem::MatrixCoefficient, mfem::PWMatrixCoefficient >::addCoefficient(), FormattedTable::addData(), MFEMProblem::addFunction(), DiffusionPhysicsBase::addInitialConditions(), InputParameterWarehouse::addInputParameters(), FEProblemBase::addOutput(), SONDefinitionFormatter::addParameters(), Moose::MFEM::CoefficientMap< mfem::MatrixCoefficient, mfem::PWMatrixCoefficient >::addPiecewiseBlocks(), MaterialPropertyStorage::addProperty(), PhysicsBase::allMeshBlocks(), InputParameters::applyParameters(), InputParameters::applySpecificParameters(), TransientMultiApp::appTransferVector(), PhysicsBase::assignBlocks(), ParsedSubdomainIDsGenerator::assignElemSubdomainID(), ParsedSubdomainMeshGenerator::assignElemSubdomainID(), TimedSubdomainModifier::buildFromFile(), Moose::Builder::buildFullTree(), Moose::Builder::buildJsonSyntaxTree(), BreakMeshByElementGenerator::buildSubdomainRestrictedNodeToElemMap(), MooseMeshUtils::changeBoundaryId(), MeshExtruderGenerator::changeID(), PhysicsBase::checkBlockRestrictionIdentical(), InputParametersChecksUtils< BatchMeshGeneratorAction >::checkBlockwiseConsistency(), ComponentBoundaryConditionInterface::checkBoundaryConditionsAllRequested(), FEProblemBase::checkICRestartError(), InputParametersChecksUtils< BatchMeshGeneratorAction >::checkTwoDVectorParamsNoRespectiveOverlap(), CSG::CSGBase::checkUniverseLinking(), InputParametersChecksUtils< BatchMeshGeneratorAction >::checkVectorParamsNoOverlap(), SampledOutput::cloneMesh(), MooseMeshElementConversionUtils::convertHex8Elem(), MooseMeshElementConversionUtils::convertPrism6Elem(), CyclicDependencyException< T, Compare >::CyclicDependencyException(), FunctionMaterialPropertyDescriptor< is_ad >::dependsOn(), SideSetsGeneratorBase::elementSubdomainIdInList(), MultiAppGeneralFieldTransfer::examineLocalValueConflicts(), MultiAppGeneralFieldTransfer::examineReceivedValueConflicts(), MultiAppNearestNodeTransfer::execute(), FEProblemBase::FEProblemBase(), FEProblemSolve::FEProblemSolve(), ComputeFVFluxThread< RangeType, AttribMatrixTags >::finalizeContainers(), HashMap< unsigned, MooseVariableFV *>::find(), Moose::Kokkos::Matrix::find(), NearestNodeLocator::findNodes(), ElementSubdomainModifierBase::findReinitializedElemsAndNodes(), SideSetsGeneratorBase::flood(), CommandLine::formatEntry(), FunctionMaterialBase< is_ad >::FunctionMaterialBase(), DerivativeParsedMaterialHelperTempl< is_ad >::functionsPostParse(), ElementSubdomainModifierBase::gatherPatchElements(), CircularBoundaryCorrectionGenerator::generate(), CutMeshByLevelSetGeneratorBase::generate(), LayeredBase::getBounds(), MooseUtils::DelimitedFileReaderTempl< T >::getData(), VariableCondensationPreconditioner::getDofColRow(), VariableCondensationPreconditioner::getDofToCondense(), DependencyResolver< std::string >::getSortedValuesSets(), PhysicsBase::getSubdomainIDs(), FEProblemBase::getSystemBase(), CommandLine::hasArgument(), ComponentInitialConditionInterface::hasInitialCondition(), ComponentMaterialPropertyInterface::hasProperty(), SystemBase::hasVariable(), BlockRestrictable::initializeBlockRestrictable(), BoundaryRestrictable::initializeBoundaryRestrictable(), PhysicsBase::initializePhysics(), ReferenceResidualConvergence::initialSetup(), ElementSubdomainModifierBase::initialSetup(), SystemBase::isArrayVariable(), Moose::Kokkos::Mesh::isBoundaryNode(), AttribTagBase::isMatch(), AttribBoundaries::isMatch(), ActivateElementsUserObjectBase::isNewlyActivated(), Moose::PetscSupport::isSNESVI(), SolutionUserObjectBase::isVariableNodal(), MooseMeshXYCuttingUtils::lineRemoverCutElemTri(), MooseMeshXYCuttingUtils::lineRemoverMoveNode(), MultiSystemSolveObject::MultiSystemSolveObject(), FEProblemBase::needBoundaryMaterialOnSide(), FEProblemBase::needInterfaceMaterialOnSide(), FEProblemBase::needInternalNeighborSideMaterial(), NodeSetsGeneratorBase::nodeElementsInExcludedSubdomains(), NodeSetsGeneratorBase::nodeElementsInIncludedSubdomains(), NodeSetsGeneratorBase::nodeInExcludedNodesets(), NodeSetsGeneratorBase::nodeInIncludedNodesets(), JSONOutput::outputReporters(), ParsedVectorRealReductionReporter::ParsedVectorRealReductionReporter(), ParsedVectorVectorRealReductionReporter::ParsedVectorVectorRealReductionReporter(), Parser::parseError(), MooseUtils::pathContains(), geom_utils::pointInPolygon(), TheWarehouse::prepare(), VecStore::query(), TheWarehouse::queryInto(), SolutionUserObjectBase::readExodusII(), MooseApp::recursivelyCreateExecutors(), SubProblem::removeAlgebraicGhostingFunctor(), CommandLine::removeArgument(), SubProblem::removeCouplingGhostingFunctor(), DependencyResolver< std::string >::removeEdge(), DependencyResolver< std::string >::removeEdgesInvolving(), MooseMesh::setCoordSystem(), NodeSetsGeneratorBase::setup(), SideSetsGeneratorBase::setup(), NonlinearSystemBase::setupScalingData(), PhysicsBase::shouldCreateVariable(), BlockDeletionGenerator::shouldDelete(), Moose::sideIntersectedByLine(), MultiIndex< Real >::slice(), ElementSubdomainModifierBase::subdomainIsReinitialized(), MooseMeshElementConversionUtils::tetNodesForHex(), MultiAppDofCopyTransfer::transfer(), MultiAppShapeEvaluationTransfer::transferVariable(), Checkpoint::updateCheckpointFiles(), NearestNodeLocator::updatePatch(), ParsedAux::validateGenericVectorNames(), ParsedMaterialBase::validateVectorNames(), Moose::MFEM::EquationSystem::VectorContainsName(), and Moose::Builder::walk().

31 {
32  if (begin == end)
33  return end;
34 
35  auto left = begin;
36  auto right = end - 1;
37 
38  while (left <= right)
39  {
40  auto mid = left + (right - left) / 2;
41 
42  if (*mid == target)
43  return mid;
44  else if (*mid < target)
45  left = mid + 1;
46  else
47  right = mid - 1;
48  }
49 
50  return end;
51 }