Panzer  Version of the Day
Panzer_STK_SetupLOWSFactory.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #include "PanzerAdaptersSTK_config.hpp"
44 
48 
49 #include "Teuchos_AbstractFactoryStd.hpp"
50 
51 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
52 
53 #ifdef PANZER_HAVE_EPETRA_STACK
54 #include "Epetra_MpiComm.h"
55 #include "Epetra_Vector.h"
56 #include "EpetraExt_VectorOut.h"
57 #endif // PANZER_HAVE_EPETRA_STACK
58 
59 #include "Tpetra_Map.hpp"
60 #include "Tpetra_MultiVector.hpp"
61 
62 #ifdef PANZER_HAVE_TEKO
63 #include "Teko_StratimikosFactory.hpp"
64 #endif
65 
66 #ifdef PANZER_HAVE_MUELU
67 #include "Stratimikos_MueLuHelpers.hpp"
68 //#include "MatrixMarket_Tpetra.hpp"
69 #include "Xpetra_MapFactory.hpp"
70 #include "Xpetra_MultiVectorFactory.hpp"
71 #endif
72 
73 #ifdef PANZER_HAVE_IFPACK2
74 #include <Thyra_Ifpack2PreconditionerFactory.hpp>
75 #include "Tpetra_CrsMatrix_decl.hpp"
76 #endif
77 
78 namespace panzer_stk {
79 
80 namespace {
81 
82  bool
83  determineCoordinateField(const panzer::GlobalIndexer & globalIndexer,std::string & fieldName)
84  {
85  std::vector<std::string> elementBlocks;
86  globalIndexer.getElementBlockIds(elementBlocks);
87 
88  // grab fields for first block
89  std::set<int> runningFields;
90  {
91  const std::vector<int> & fields = globalIndexer.getBlockFieldNumbers(elementBlocks[0]);
92  runningFields.insert(fields.begin(),fields.end());
93  }
94 
95  // grab fields for first block
96  for(std::size_t i=1;i<elementBlocks.size();i++) {
97  const std::vector<int> & fields = globalIndexer.getBlockFieldNumbers(elementBlocks[i]);
98 
99  std::set<int> currentFields(runningFields);
100  runningFields.clear();
101  std::set_intersection(fields.begin(),fields.end(),
102  currentFields.begin(),currentFields.end(),
103  std::inserter(runningFields,runningFields.begin()));
104  }
105 
106  if(runningFields.size()<1)
107  return false;
108 
109  fieldName = globalIndexer.getFieldString(*runningFields.begin());
110  return true;
111  }
112 
113  void
114  fillFieldPatternMap(const panzer::DOFManager & globalIndexer,
115  const std::string & fieldName,
116  std::map<std::string,Teuchos::RCP<const panzer::Intrepid2FieldPattern> > & fieldPatterns)
117  {
118  std::vector<std::string> elementBlocks;
119  globalIndexer.getElementBlockIds(elementBlocks);
120 
121  for(std::size_t e=0;e<elementBlocks.size();e++) {
122  std::string blockId = elementBlocks[e];
123 
124  if(globalIndexer.fieldInBlock(fieldName,blockId))
125  fieldPatterns[blockId] =
126  Teuchos::rcp_dynamic_cast<const panzer::Intrepid2FieldPattern>(globalIndexer.getFieldPattern(blockId,fieldName),true);
127  }
128  }
129 
130  void
131  fillFieldPatternMap(const panzer::GlobalIndexer & globalIndexer,
132  const std::string & fieldName,
133  std::map<std::string,Teuchos::RCP<const panzer::Intrepid2FieldPattern> > & fieldPatterns)
134  {
135  using Teuchos::Ptr;
136  using Teuchos::ptrFromRef;
137  using Teuchos::ptr_dynamic_cast;
138  using panzer::DOFManager;
139 
140  // first standard dof manager
141  {
142  Ptr<const DOFManager> dofManager = ptr_dynamic_cast<const DOFManager>(ptrFromRef(globalIndexer));
143 
144  if(dofManager!=Teuchos::null) {
145  fillFieldPatternMap(*dofManager,fieldName,fieldPatterns);
146  return;
147  }
148  }
149  }
150 } // end anonymous namespace
151 
152  Teuchos::RCP<Thyra::LinearOpWithSolveFactoryBase<double> >
153  buildLOWSFactory(bool blockedAssembly,
154  const Teuchos::RCP<const panzer::GlobalIndexer> & globalIndexer,
155  const Teuchos::RCP<panzer_stk::STKConnManager> & stkConn_manager,
156  int spatialDim,
157  const Teuchos::RCP<const Teuchos::MpiComm<int> > & mpi_comm,
158  const Teuchos::RCP<Teuchos::ParameterList> & strat_params,
159  #ifdef PANZER_HAVE_TEKO
160  const Teuchos::RCP<Teko::RequestHandler> & reqHandler,
161  #endif
162  bool writeCoordinates,
163  bool writeTopo,
164  const Teuchos::RCP<const panzer::GlobalIndexer> & auxGlobalIndexer,
165  bool useCoordinates
166  )
167  {
168  using Teuchos::RCP;
169  using Teuchos::rcp;
170  using Teuchos::rcp_dynamic_cast;
171 
172  Stratimikos::DefaultLinearSolverBuilder linearSolverBuilder;
173 
174  // Note if you want to use new solvers within Teko they have to be added to the solver builer
175  // before teko is added. This is because Teko steals its defaults from the solver its being injected
176  // into!
177 
178  #ifdef PANZER_HAVE_MUELU
179  {
180  Stratimikos::enableMueLu<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>(linearSolverBuilder,"MueLu");
181  Stratimikos::enableMueLuRefMaxwell<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>(linearSolverBuilder,"MueLuRefMaxwell");
182  Stratimikos::enableMueLuMaxwell1<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>(linearSolverBuilder,"MueLuMaxwell1");
183  #ifndef PANZER_HIDE_DEPRECATED_CODE
184  // the next two are only for backwards compatibility
185  Stratimikos::enableMueLu<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>(linearSolverBuilder,"MueLu-Tpetra");
186  Stratimikos::enableMueLuRefMaxwell<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType>(linearSolverBuilder,"MueLuRefMaxwell-Tpetra");
187  #endif
188  }
189  #endif // MUELU
190  #ifdef PANZER_HAVE_IFPACK2
191  {
193  typedef Thyra::Ifpack2PreconditionerFactory<Tpetra::CrsMatrix<double, int, panzer::GlobalOrdinal,panzer::TpetraNodeType> > Impl;
194 
195  linearSolverBuilder.setPreconditioningStrategyFactory(Teuchos::abstractFactoryStd<Base, Impl>(), "Ifpack2");
196  }
197  #endif // MUELU
198 
199 
200  #ifdef PANZER_HAVE_TEKO
201  RCP<Teko::RequestHandler> reqHandler_local = reqHandler;
202 
203  if(!blockedAssembly) {
204 
205  std::string fieldName;
206 
207  // try to set request handler from member variable; This is a potential segfault
208  // if its internally stored data (e.g. callback) gets released and all its data
209  // required by ML or whatever gets hosed
210  if(reqHandler_local==Teuchos::null)
211  reqHandler_local = rcp(new Teko::RequestHandler);
212 
213  // add in the coordinate parameter list callback handler
214  if(determineCoordinateField(*globalIndexer,fieldName)) {
215  std::map<std::string,RCP<const panzer::Intrepid2FieldPattern> > fieldPatterns;
216  fillFieldPatternMap(*globalIndexer,fieldName,fieldPatterns);
217 
218  RCP<panzer_stk::ParameterListCallback> callback = rcp(new
219  panzer_stk::ParameterListCallback(fieldName,fieldPatterns,stkConn_manager,
220  rcp_dynamic_cast<const panzer::GlobalIndexer>(globalIndexer)));
221  reqHandler_local->addRequestCallback(callback);
222 
223  // determine if you want rigid body null space modes...currently an extremely specialized case!
224  if(strat_params->sublist("Preconditioner Types").isSublist("ML")) {
225 /* COMMENTING THIS OUT FOR NOW, this is causing problems with some of the preconditioners in optimization...not sure why
226 
227  Teuchos::ParameterList & ml_params = strat_params->sublist("Preconditioner Types").sublist("ML").sublist("ML Settings");
228 
229  {
230  // force parameterlistcallback to build coordinates
231  callback->preRequest(Teko::RequestMesg(rcp(new Teuchos::ParameterList())));
232 
233  // extract coordinate vectors
234  std::vector<double> & xcoords = const_cast<std::vector<double> & >(callback->getXCoordsVector());
235  std::vector<double> & ycoords = const_cast<std::vector<double> & >(callback->getYCoordsVector());
236  std::vector<double> & zcoords = const_cast<std::vector<double> & >(callback->getZCoordsVector());
237 
238  ml_params.set<double*>("x-coordinates",&xcoords[0]);
239  ml_params.set<double*>("y-coordinates",&ycoords[0]);
240  ml_params.set<double*>("z-coordinates",&zcoords[0]);
241  }
242 */
243 /*
244  bool useRigidBodyNullSpace = false;
245  if(ml_params.isType<std::string>("null space: type"))
246  useRigidBodyNullSpace = ml_params.get<std::string>("null space: type") == "pre-computed";
247 
248  if(useRigidBodyNullSpace) {
249  // force parameterlistcallback to build coordinates
250  callback->preRequest(Teko::RequestMesg(rcp(new Teuchos::ParameterList())));
251 
252  RCP<std::vector<double> > rbm = rcp(new std::vector<double>);
253  std::vector<double> & rbm_ref = *rbm;
254 
255  // extract coordinate vectors
256  std::vector<double> & xcoords = const_cast<std::vector<double> & >(callback->getXCoordsVector());
257  std::vector<double> & ycoords = const_cast<std::vector<double> & >(callback->getYCoordsVector());
258  std::vector<double> & zcoords = const_cast<std::vector<double> & >(callback->getZCoordsVector());
259 
260  // use ML to build the null space modes for ML
261  int Nnodes = Teuchos::as<int>(xcoords.size());
262  int NscalarDof = 0;
263  int Ndof = spatialDim;
264  int nRBM = spatialDim==3 ? 6 : (spatialDim==2 ? 3 : 1);
265  int rbmSize = Nnodes*(nRBM+NscalarDof)*(Ndof+NscalarDof);
266  rbm_ref.resize(rbmSize);
267 
268  ML_Coord2RBM(Nnodes,&xcoords[0],&ycoords[0],&zcoords[0],&rbm_ref[0],Ndof,NscalarDof);
269 
270  ml_params.set<double*>("null space: vectors",&rbm_ref[0]);
271  ml_params.set<int>("null space: dimension",nRBM);
272 
273  callback->storeExtraVector(rbm);
274  }
275 */
276  }
277 
278  if(writeCoordinates) {
279 #ifdef PANZER_HAVE_EPETRA_STACK
280  // force parameterlistcallback to build coordinates
281  callback->preRequest(Teko::RequestMesg(rcp(new Teuchos::ParameterList())));
282 
283  // extract coordinate vectors
284  const std::vector<double> & xcoords = callback->getXCoordsVector();
285  const std::vector<double> & ycoords = callback->getYCoordsVector();
286  const std::vector<double> & zcoords = callback->getZCoordsVector();
287 
288  // use epetra to write coordinates to matrix market files
289  Epetra_MpiComm ep_comm(*mpi_comm->getRawMpiComm()); // this is OK access to RawMpiComm becase its declared on the stack?
290  // and all users of this object are on the stack (within scope of mpi_comm
291  Epetra_Map map(-1,xcoords.size(),0,ep_comm);
292 
293  RCP<Epetra_Vector> vec;
294  switch(spatialDim) {
295  case 3:
296  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&zcoords[0])));
297  EpetraExt::VectorToMatrixMarketFile("zcoords.mm",*vec);
298  // Intentional fall-through.
299  case 2:
300  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&ycoords[0])));
301  EpetraExt::VectorToMatrixMarketFile("ycoords.mm",*vec);
302  // Intentional fall-through.
303  case 1:
304  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&xcoords[0])));
305  EpetraExt::VectorToMatrixMarketFile("xcoords.mm",*vec);
306  break;
307  default:
308  TEUCHOS_ASSERT(false);
309  }
310 #else
311  TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"ERROR: Panzer_STK_SetupLOWSFactory.cpp - writeCoordinates not implemented for Tpetra yet!");
312 #endif
313  }
314 
315 #ifdef PANZER_HAVE_MUELU
316  if(rcp_dynamic_cast<const panzer::GlobalIndexer>(globalIndexer)!=Teuchos::null
317  && useCoordinates) {
318  if(!writeCoordinates)
319  callback->preRequest(Teko::RequestMesg(rcp(new Teuchos::ParameterList())));
320 
321  typedef Tpetra::Map<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> Map;
322  typedef Tpetra::MultiVector<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> MV;
323 
324  // extract coordinate vectors and modify strat_params to include coordinate vectors
325  unsigned dim = Teuchos::as<unsigned>(spatialDim);
326  RCP<MV> coords;
327  for(unsigned d=0;d<dim;d++) {
328  const std::vector<double> & coord = callback->getCoordsVector(d);
329 
330  // no coords vector has been build yet, build one
331  if(coords==Teuchos::null) {
332  if(globalIndexer->getNumFields()==1) {
333  RCP<const panzer::GlobalIndexer> ugi
334  = rcp_dynamic_cast<const panzer::GlobalIndexer>(globalIndexer);
335  std::vector<panzer::GlobalOrdinal> ownedIndices;
336  ugi->getOwnedIndices(ownedIndices);
337  RCP<const Map> coords_map = rcp(new Map(Teuchos::OrdinalTraits<panzer::GlobalOrdinal>::invalid(),ownedIndices,0,mpi_comm));
338  coords = rcp(new MV(coords_map,dim));
339  }
340  else {
341  RCP<const Map> coords_map = rcp(new Map(Teuchos::OrdinalTraits<panzer::GlobalOrdinal>::invalid(),coord.size(),0,mpi_comm));
342  coords = rcp(new MV(coords_map,dim));
343  }
344  }
345 
346  // sanity check the size
347  TEUCHOS_ASSERT(coords->getLocalLength()==coord.size());
348 
349  // fill appropriate coords vector
350  Teuchos::ArrayRCP<double> dest = coords->getDataNonConst(d);
351  for(std::size_t i=0;i<coord.size();i++)
352  dest[i] = coord[i];
353  }
354 
355  // inject coordinates into parameter list
356  Teuchos::ParameterList & muelu_params = strat_params->sublist("Preconditioner Types").sublist("MueLu");
357  muelu_params.set<RCP<MV> >("Coordinates",coords);
358  }
359  #endif
360  }
361  // else write_out_the_mesg("Warning: No unique field determines the coordinates, coordinates unavailable!")
362 
363  Teko::addTekoToStratimikosBuilder(linearSolverBuilder,reqHandler_local);
364  }
365  else {
366  // try to set request handler from member variable
367  if(reqHandler_local==Teuchos::null)
368  reqHandler_local = rcp(new Teko::RequestHandler);
369 
370  std::string fieldName;
371  if(determineCoordinateField(*globalIndexer,fieldName)) {
372  RCP<const panzer::BlockedDOFManager> blkDofs =
373  rcp_dynamic_cast<const panzer::BlockedDOFManager>(globalIndexer);
374  RCP<const panzer::BlockedDOFManager> auxBlkDofs =
375  rcp_dynamic_cast<const panzer::BlockedDOFManager>(auxGlobalIndexer);
376  RCP<panzer_stk::ParameterListCallbackBlocked> callback =
377  rcp(new panzer_stk::ParameterListCallbackBlocked(stkConn_manager,blkDofs,auxBlkDofs));
378  reqHandler_local->addRequestCallback(callback);
379  }
380 
381  Teko::addTekoToStratimikosBuilder(linearSolverBuilder,reqHandler_local);
382 
383  if(writeCoordinates) {
384 #ifdef PANZER_HAVE_EPETRA_STACK
385  RCP<const panzer::BlockedDOFManager> blkDofs =
386  rcp_dynamic_cast<const panzer::BlockedDOFManager>(globalIndexer);
387 
388  // loop over blocks
389  const std::vector<RCP<panzer::GlobalIndexer>> & dofVec
390  = blkDofs->getFieldDOFManagers();
391  for(std::size_t i=0;i<dofVec.size();i++) {
392 
393  // add in the coordinate parameter list callback handler
394  TEUCHOS_ASSERT(determineCoordinateField(*dofVec[i],fieldName));
395 
396  std::map<std::string,RCP<const panzer::Intrepid2FieldPattern> > fieldPatterns;
397  fillFieldPatternMap(*dofVec[i],fieldName,fieldPatterns);
398  panzer_stk::ParameterListCallback plCall(fieldName,fieldPatterns,stkConn_manager,dofVec[i]);
399  plCall.buildArrayToVector();
400  plCall.buildCoordinates();
401 
402  // extract coordinate vectors
403  const std::vector<double> & xcoords = plCall.getXCoordsVector();
404  const std::vector<double> & ycoords = plCall.getYCoordsVector();
405  const std::vector<double> & zcoords = plCall.getZCoordsVector();
406 
407  // use epetra to write coordinates to matrix market files
408  Epetra_MpiComm ep_comm(*mpi_comm->getRawMpiComm()); // this is OK access to RawMpiComm becase its declared on the stack?
409  // and all users of this object are on the stack (within scope of mpi_comm
410  Epetra_Map map(-1,xcoords.size(),0,ep_comm);
411 
412  RCP<Epetra_Vector> vec;
413  switch(spatialDim) {
414  case 3:
415  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&zcoords[0])));
416  EpetraExt::VectorToMatrixMarketFile((fieldName+"_zcoords.mm").c_str(),*vec);
417  // Intentional fall-through.
418  case 2:
419  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&ycoords[0])));
420  EpetraExt::VectorToMatrixMarketFile((fieldName+"_ycoords.mm").c_str(),*vec);
421  // Intentional fall-through.
422  case 1:
423  vec = rcp(new Epetra_Vector(Copy,map,const_cast<double *>(&xcoords[0])));
424  EpetraExt::VectorToMatrixMarketFile((fieldName+"_xcoords.mm").c_str(),*vec);
425  break;
426  default:
427  TEUCHOS_ASSERT(false);
428  }
429 
430  // TODO add MueLu code...
431  #ifdef PANZER_HAVE_MUELU
432  if(useCoordinates) {
433 
434  typedef Xpetra::Map<int,panzer::GlobalOrdinal> Map;
435  typedef Xpetra::MultiVector<double,int,panzer::GlobalOrdinal> MV;
436 
437  // TODO This is Epetra-specific
438  RCP<const Map> coords_map = Xpetra::MapFactory<int,panzer::GlobalOrdinal>::Build(Xpetra::UseEpetra,
439  Teuchos::OrdinalTraits<panzer::GlobalOrdinal>::invalid(),
440  //Teuchos::ArrayView<GO>(ownedIndices),
441  xcoords.size(),
442  0,
443  mpi_comm
444  );
445 
446  unsigned dim = Teuchos::as<unsigned>(spatialDim);
447 
448  RCP<MV> coords = Xpetra::MultiVectorFactory<double,int,panzer::GlobalOrdinal>::Build(coords_map,spatialDim);
449 
450  for(unsigned d=0;d<dim;d++) {
451  // sanity check the size
452  TEUCHOS_ASSERT(coords->getLocalLength()==xcoords.size());
453 
454  // fill appropriate coords vector
455  Teuchos::ArrayRCP<double> dest = coords->getDataNonConst(d);
456  for(std::size_t j=0;j<coords->getLocalLength();++j) {
457  if (d == 0) dest[j] = xcoords[j];
458  if (d == 1) dest[j] = ycoords[j];
459  if (d == 2) dest[j] = zcoords[j];
460  }
461  }
462 
463  // TODO This is Epetra-specific
464  // inject coordinates into parameter list
465  Teuchos::ParameterList & muelu_params = strat_params->sublist("Preconditioner Types").sublist("MueLu");
466  muelu_params.set<RCP<MV> >("Coordinates",coords);
467 
468  }
469  #endif
470 
471  } /* end loop over all physical fields */
472 #else // PANZER_HAVE EPETRA
473  TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error,"ERROR: Panzer_STK_SetupLOWSFactory - writeCoordinates not implemented for Tpetra yet!")
474 #endif
475  }
476 
477  if(writeTopo) {
478  /*
479  RCP<const panzer::BlockedDOFManager> blkDofs =
480  rcp_dynamic_cast<const panzer::BlockedDOFManager>(globalIndexer);
481 
482  writeTopology(*blkDofs);
483  */
484  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,
485  "Topology writing is no longer implemented. It needs to be reimplemented for the "
486  "default DOFManager (estimate 2 days with testing)");
487  }
488  }
489  #endif
490 
491  linearSolverBuilder.setParameterList(strat_params);
492  RCP<Thyra::LinearOpWithSolveFactoryBase<double> > lowsFactory = createLinearSolveStrategy(linearSolverBuilder);
493 
494  return lowsFactory;
495  }
496 
497 
498  Teuchos::RCP<Thyra::LinearOpWithSolveFactoryBase<double> >
499  buildLOWSFactory(bool blockedAssembly,
500  const Teuchos::RCP<const panzer::GlobalIndexer> & globalIndexer,
501  const Teuchos::RCP<panzer::ConnManager> & conn_manager,
502  int spatialDim,
503  const Teuchos::RCP<const Teuchos::MpiComm<int> > & mpi_comm,
504  const Teuchos::RCP<Teuchos::ParameterList> & strat_params,
505  #ifdef PANZER_HAVE_TEKO
506  const Teuchos::RCP<Teko::RequestHandler> & reqHandler,
507  #endif
508  bool writeCoordinates,
509  bool writeTopo,
510  const Teuchos::RCP<const panzer::GlobalIndexer> & auxGlobalIndexer,
511  bool useCoordinates
512  )
513  {
514  #ifdef PANZER_HAVE_TEKO
515  Teuchos::RCP<Teko::RequestHandler> reqHandler_local = reqHandler;
516  if(reqHandler_local==Teuchos::null)
517  reqHandler_local = Teuchos::rcp(new Teko::RequestHandler);
518  #endif
519 
520  auto stk_conn_manager = Teuchos::rcp_dynamic_cast<panzer_stk::STKConnManager>(conn_manager,true);
521 
522  return buildLOWSFactory(blockedAssembly,globalIndexer,stk_conn_manager,spatialDim,mpi_comm,strat_params,
523 #ifdef PANZER_HAVE_TEKO
524  reqHandler_local,
525 #endif
526  writeCoordinates,
527  writeTopo,
528  auxGlobalIndexer,
529  useCoordinates
530  );
531 
532  // should never reach this
533  TEUCHOS_ASSERT(false);
534  return Teuchos::null;
535  }
536 }
virtual const std::string & getFieldString(int num) const =0
Reverse lookup of the field string from a field number.
Copy
const std::vector< Teuchos::RCP< GlobalIndexer > > & getFieldDOFManagers() const
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const =0
void getElementBlockIds(std::vector< std::string > &elementBlockIds) const
virtual void getOwnedIndices(std::vector< panzer::GlobalOrdinal > &indices) const =0
Get the set of indices owned by this processor.
Teuchos::RCP< Thyra::LinearOpWithSolveFactoryBase< double > > buildLOWSFactory(bool blockedAssembly, const Teuchos::RCP< const panzer::GlobalIndexer > &globalIndexer, const Teuchos::RCP< panzer_stk::STKConnManager > &stkConn_manager, int spatialDim, const Teuchos::RCP< const Teuchos::MpiComm< int > > &mpi_comm, const Teuchos::RCP< Teuchos::ParameterList > &strat_params, bool writeCoordinates, bool writeTopo, const Teuchos::RCP< const panzer::GlobalIndexer > &auxGlobalIndexer, bool useCoordinates)
int VectorToMatrixMarketFile(const char *filename, const Epetra_Vector &A, const char *matrixName=0, const char *matrixDescription=0, bool writeHeader=true)
Teuchos::RCP< const FieldPattern > getFieldPattern(const std::string &name) const
Find a field pattern stored for a particular block and field number. This will retrive the pattern ad...
virtual const std::vector< int > & getBlockFieldNumbers(const std::string &blockId) const =0
bool fieldInBlock(const std::string &field, const std::string &block) const