14#include "arcane/aleph/IAlephFactory.h"
15#include "arcane/ServiceBuilder.h"
31 , m_initialized(
false)
43 const String& name()
const {
return m_name; }
65 m_impl_map.insert(std::make_pair(1,
new FactoryImpl(
"Sloop")));
66 m_impl_map.insert(std::make_pair(2,
new FactoryImpl(
"Hypre")));
67 m_impl_map.insert(std::make_pair(3,
new FactoryImpl(
"Trilinos")));
68 m_impl_map.insert(std::make_pair(4,
new FactoryImpl(
"Cuda")));
69 m_impl_map.insert(std::make_pair(5,
new FactoryImpl(
"PETSc")));
73 for (
const auto& i : m_impl_map) {
75 const String& name = implementation->name();
76 debug() <<
"\33[1;34m\t[AlephFactory] Adding " << name <<
" library..."
78 auto factory =
sb.createReference(name +
"AlephFactory",
SB_AllowNull);
79 implementation->setFactory(factory);
81 debug() <<
"\33[1;34m\t[AlephFactory] done"
91 for (
const auto& i : m_impl_map)
98IAlephFactoryImpl* AlephFactory::
99_getFactory(Integer solver_index)
101 FactoryImplMap::const_iterator ci = m_impl_map.find(solver_index);
102 if (ci == m_impl_map.end())
103 ARCANE_FATAL(
"Invalid solver index '{0}' for aleph factory", solver_index);
104 FactoryImpl* implementation = ci->second;
105 IAlephFactoryImpl* factory = implementation->factory();
107 throw NotSupportedException(A_FUNCINFO,
108 String::format(
"Implementation for '{0}' not available",
109 implementation->name()));
112 if (!implementation->m_initialized) {
113 debug() <<
"\33[1;34m\t\t[_getFactory] initializing solver_index="
114 << solver_index <<
" ..."
116 implementation->m_initialized =
true;
117 factory->initialize();
126hasSolverImplementation(Integer solver_index)
128 FactoryImplMap::const_iterator ci = m_impl_map.find(solver_index);
129 if (ci == m_impl_map.end())
131 FactoryImpl* implementation = ci->second;
132 IAlephFactoryImpl* factory = implementation->factory();
141IAlephTopology* AlephFactory::
142GetTopology(AlephKernel* kernel, Integer index, Integer nb_row_size)
144 debug() <<
"\33[1;34m\t\t[IAlephFactory::GetTopology] Switch=" << kernel->underlyingSolver() <<
"\33[0m";
145 auto f = _getFactory(kernel->underlyingSolver());
146 return f->createTopology(
traceMng(), kernel, index, nb_row_size);
152IAlephVector* AlephFactory::
153GetVector(AlephKernel* kernel, Integer index)
155 debug() <<
"\33[1;34m\t\t[AlephFactory::GetVector] Switch=" << kernel->underlyingSolver() <<
"\33[0m";
156 auto f = _getFactory(kernel->underlyingSolver());
157 return f->createVector(
traceMng(), kernel, index);
163IAlephMatrix* AlephFactory::
164GetMatrix(AlephKernel* kernel, Integer index)
166 debug() <<
"\33[1;34m\t\t[AlephFactory::GetMatrix] Switch=" << kernel->underlyingSolver() <<
"\33[0m";
167 auto f = _getFactory(kernel->underlyingSolver());
168 return f->createMatrix(
traceMng(), kernel, index);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Interface d'une fabrique d'implémentation pour Aleph.
Interface de l'application.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Interface du gestionnaire de traces.
Chaîne de caractères unicode.
ITraceMng * traceMng() const
Gestionnaire de trace.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flot pour un message de debug.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
@ SB_AllowNull
Autorise l'absence du service.