FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_MatrixGraph.hpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_MatrixGraph_hpp_
10 #define _fei_MatrixGraph_hpp_
11 
12 #include <fei_macros.hpp>
13 #include <fei_SharedPtr.hpp>
14 #include <fei_VectorSpace.hpp>
15 #include <fei_Reducer.hpp>
16 #include <snl_fei_Constraint.hpp>
17 #include <fei_Record.hpp>
18 #include <fei_SparseRowGraph.hpp>
19 
20 #include <vector>
21 
22 namespace fei {
23  class ConnectivityBlock;
24  class Pattern;
28 
33 class MatrixGraph {
34  public:
36  class Factory {
37  public:
39  virtual ~Factory(){}
40 
48  const char* name) = 0;
49  };
50 
51  enum { REDUCED_INDICES = 0,
52  UNREDUCED_INDICES = 1,
53  BLOCK_ENTRY_GRAPH = 2,
54  POINT_ENTRY_GRAPH = 3};
55 
57  virtual ~MatrixGraph(){}
58 
66  virtual void setParameters(const fei::ParameterSet& params) = 0;
67 
74  virtual void setRowSpace(fei::SharedPtr<fei::VectorSpace> rowSpace) = 0;
75 
80 
87  virtual void setColumnSpace(fei::SharedPtr<fei::VectorSpace> columnSpace) = 0;
88 
93 
115  virtual int definePattern(int numIDs,
116  int idType) = 0;
117 
140  virtual int definePattern(int numIDs,
141  int idType,
142  int fieldID) = 0;
143 
168  virtual int definePattern(int numIDs,
169  int idType,
170  const int* numFieldsPerID,
171  const int* fieldIDs) = 0;
172 
196  virtual int definePattern(int numIDs,
197  const int* idTypes,
198  const int* numFieldsPerID,
199  const int* fieldIDs) = 0;
200 
223  virtual int initConnectivityBlock(int blockID,
224  int numConnectivityLists,
225  int patternID,
226  bool diagonal=false) = 0;
227 
250  virtual int initConnectivityBlock(int numConnectivityLists,
251  int patternID,
252  bool diagonal=false) = 0;
253 
274  virtual int initConnectivityBlock(int blockID,
275  int numConnectivityLists,
276  int rowPatternID,
277  int colPatternID) = 0;
278 
291  virtual int initConnectivity(int blockID,
292  int connectivityID,
293  const int* connectedIdentifiers) = 0;
294 
309  virtual int initConnectivity(int blockID,
310  int connectivityID,
311  const int* rowConnectedIdentifiers,
312  const int* colConnectedIdentifiers) = 0;
313 
326  virtual int initConnectivity(int patternID,
327  const int* connectedIdentifiers) = 0;
328 
343  virtual int initConnectivity(int rowPatternID,
344  const int* rowConnectedIdentifiers,
345  int colPatternID,
346  const int* colConnectedIdentifiers) = 0;
347 
363  virtual int initConnectivity(int idType,
364  int numRows,
365  const int* rowIDs,
366  const int* rowOffsets,
367  const int* packedColumnIDs) = 0;
368 
386  virtual int initConnectivity(int idType,
387  int fieldID,
388  int numRows,
389  const int* rowIDs,
390  const int* rowOffsets,
391  const int* packedColumnIDs) = 0;
392 
407  virtual int initConnectivity(int idType,
408  int numRows,
409  const int* rowIDs,
410  const int* rowLengths,
411  const int*const* columnIDs) = 0;
412 
415  virtual int initLagrangeConstraint(int constraintID,
416  int constraintIDType,
417  int numIDs,
418  const int* idTypes,
419  const int* IDs,
420  const int* fieldIDs) = 0;
421 
424  virtual int initPenaltyConstraint(int constraintID,
425  int constraintIDType,
426  int numIDs,
427  const int* idTypes,
428  const int* IDs,
429  const int* fieldIDs) = 0;
430 
433  virtual int initSlaveConstraint(int numIDs,
434  const int* idTypes,
435  const int* IDs,
436  const int* fieldIDs,
437  int offsetOfSlave,
438  int offsetIntoSlaveField,
439  const double* weights,
440  double rhsValue) = 0;
441 
442  virtual bool newSlaveData() = 0;
443 
446  virtual bool hasSlaveDof(int ID, int idType) = 0;
447 
452  virtual int initComplete() = 0;
453 
466  createGraph(bool blockEntryGraph,
467  bool localRowGraph_includeSharedRows=false) = 0;
468 
472  virtual int compareStructure(const fei::MatrixGraph& matrixGraph,
473  bool& equivalent) const = 0;
474 
476  virtual int getNumConnectivityBlocks() const = 0;
477 
479  virtual std::map<int,fei::ConnectivityBlock*>& getConnectivityBlocks() = 0;
481  virtual int getConnectivityBlockIDs(std::vector<int>& blockIDs) const = 0;
482 
485  virtual int getNumIDsPerConnectivityList(int blockID) const = 0;
486 
490  virtual int getConnectivityNumIndices(int blockID) const = 0;
491 
496  virtual int getConnectivityNumIndices(int blockID,
497  int& numRowIndices,
498  int& numColIndices) = 0;
499 
502  virtual int getConnectivityIndices(int blockID,
503  int connectivityID,
504  int indicesAllocLen,
505  int* indices,
506  int& numIndices) = 0;
507 
511  virtual int getConnectivityIndices(int blockID,
512  int connectivityID,
513  int rowIndicesAllocLen,
514  int* rowIndices,
515  int& numRowIndices,
516  int colIndicesAllocLen,
517  int* colIndices,
518  int& numColIndices) = 0;
519 
522  virtual int getPatternNumIndices(int patternID,
523  int& numIndices) = 0;
524 
527  virtual int getPatternIndices(int patternID,
528  const int* IDs,
529  std::vector<int>& indices) = 0;
530 
532  virtual int getLocalNumLagrangeConstraints() const = 0;
533 
536  virtual int getGlobalNumSlaveConstraints() const = 0;
537 
541  virtual ConstraintType* getLagrangeConstraint(int constraintID) = 0;
542 
546  virtual std::map<int, ConstraintType* >& getLagrangeConstraints() = 0;
547 
551  virtual ConstraintType* getPenaltyConstraint(int constraintID) = 0;
552 
556  virtual ConstraintType* getSlaveConstraint(int constraintID) = 0;
557 
562  std::vector<int>& globalIndices) = 0;
563 
567  virtual const fei::ConnectivityBlock* getConnectivityBlock(int blockID) const = 0;
568 
572  virtual fei::ConnectivityBlock* getConnectivityBlock(int blockID) = 0;
573 
575  virtual void setIndicesMode(int mode) = 0;
576 
579 
583  virtual fei::Pattern* getPattern(int patternID) = 0;
584 
586  virtual int createSlaveMatrices() = 0;
587 
592 
595 
597  virtual void getConstrainedIndices(std::vector<int>& crindices) const = 0;
598 };//class MatrixGraph
599 }//namespace fei
600 
601 #endif
602 
virtual void setIndicesMode(int mode)=0
virtual void setParameters(const fei::ParameterSet &params)=0
virtual ConstraintType * getLagrangeConstraint(int constraintID)=0
virtual int getGlobalNumSlaveConstraints() const =0
virtual ConstraintType * getPenaltyConstraint(int constraintID)=0
virtual void setColumnSpace(fei::SharedPtr< fei::VectorSpace > columnSpace)=0
virtual int initLagrangeConstraint(int constraintID, int constraintIDType, int numIDs, const int *idTypes, const int *IDs, const int *fieldIDs)=0
virtual int initSlaveConstraint(int numIDs, const int *idTypes, const int *IDs, const int *fieldIDs, int offsetOfSlave, int offsetIntoSlaveField, const double *weights, double rhsValue)=0
virtual fei::SharedPtr< fei::Reducer > getReducer()=0
snl_fei::Constraint< fei::Record< int > * > ConstraintType
virtual int getConstraintConnectivityIndices(ConstraintType *cr, std::vector< int > &globalIndices)=0
virtual const fei::ConnectivityBlock * getConnectivityBlock(int blockID) const =0
virtual bool hasSlaveDof(int ID, int idType)=0
virtual void setRowSpace(fei::SharedPtr< fei::VectorSpace > rowSpace)=0
virtual fei::SharedPtr< fei::SparseRowGraph > createGraph(bool blockEntryGraph, bool localRowGraph_includeSharedRows=false)=0
virtual std::map< int, fei::ConnectivityBlock * > & getConnectivityBlocks()=0
virtual fei::SharedPtr< fei::SparseRowGraph > getRemotelyOwnedGraphRows()=0
virtual int getConnectivityNumIndices(int blockID) const =0
virtual fei::SharedPtr< fei::VectorSpace > getRowSpace()=0
virtual int initConnectivity(int blockID, int connectivityID, const int *connectedIdentifiers)=0
virtual std::map< int, ConstraintType * > & getLagrangeConstraints()=0
virtual int initComplete()=0
virtual int getConnectivityIndices(int blockID, int connectivityID, int indicesAllocLen, int *indices, int &numIndices)=0
virtual fei::SharedPtr< fei::VectorSpace > getColSpace()=0
virtual int createSlaveMatrices()=0
virtual void getConstrainedIndices(std::vector< int > &crindices) const =0
virtual fei::SharedPtr< fei::FillableMat > getSlaveDependencyMatrix()=0
virtual int getPatternNumIndices(int patternID, int &numIndices)=0
virtual ConstraintType * getSlaveConstraint(int constraintID)=0
virtual int compareStructure(const fei::MatrixGraph &matrixGraph, bool &equivalent) const =0
virtual int getPatternIndices(int patternID, const int *IDs, std::vector< int > &indices)=0
virtual int definePattern(int numIDs, int idType)=0
virtual int initPenaltyConstraint(int constraintID, int constraintIDType, int numIDs, const int *idTypes, const int *IDs, const int *fieldIDs)=0
virtual int getLocalNumLagrangeConstraints() const =0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)=0
virtual int getNumConnectivityBlocks() const =0
virtual int getConnectivityBlockIDs(std::vector< int > &blockIDs) const =0
virtual fei::Pattern * getPattern(int patternID)=0
virtual int getNumIDsPerConnectivityList(int blockID) const =0
virtual int initConnectivityBlock(int blockID, int numConnectivityLists, int patternID, bool diagonal=false)=0