9 #ifndef _snl_fei_Broker_FEData_hpp_
10 #define _snl_fei_Broker_FEData_hpp_
12 #include <fei_macros.hpp>
14 #include <snl_fei_Broker.hpp>
15 #include <fei_FiniteElementData.hpp>
16 #include <fei_VectorSpace.hpp>
17 #include <fei_MatrixGraph.hpp>
18 #include <fei_Matrix_Impl.hpp>
19 #include <fei_Pattern.hpp>
20 #include <fei_Vector_Impl.hpp>
21 #include <fei_ConnectivityBlock.hpp>
22 #include <snl_fei_LinearSystem_FEData.hpp>
23 #include <fei_Lookup_Impl.hpp>
26 #define fei_file "snl_fei_Broker_FEData.hpp"
27 #include <fei_ErrMacros.hpp>
56 if (matrixGraph_.
get() == NULL)
return(vptr);
58 if (setStructure() != 0)
return(vptr);
63 feData_.
get(), localsize,
73 if (matrixGraph_.
get() == NULL)
return(mptr);
75 if (setStructure() != 0)
return(mptr);
78 bool zeroSharedRows =
false;
81 matrixGraph_, localsize, zeroSharedRows));
90 if (matrixGraph_.
get() == NULL)
return(lsptr);
92 if (setStructure() != 0)
return(lsptr);
95 linsysfed =
new LinearSystem_FEData(feData_,
105 matrixGraph_ = matrixGraph;
111 if (matrixGraph_.
get() == NULL) ERReturn(-1);
112 if (setStructure_ ==
true)
return(0);
126 vspace->getRecordCollection(nodeType, nodeRecords);
128 int* intData =
new int[numElemBlocks*3];
129 int* numElemsPerBlock = intData;
130 int* numNodesPerElem = intData+numElemBlocks;
131 int* elemMatrixSizePerBlock = intData+2*numElemBlocks;
134 std::vector<int> elemBlockIDs;
137 for(i=0; i<numElemBlocks; ++i) {
140 if (cblock==NULL)
return(-1);
146 int numSharedNodes = 0;
147 CHK_ERR( vspace->getNumSharedIDs(nodeIDType_, numSharedNodes) );
154 elemMatrixSizePerBlock,
157 numLagrangeConstraints) );
159 std::map<int,fei::ConnectivityBlock*>::const_iterator
162 std::vector<int> nodeNumbers, numDofPerNode, dof_ids;
163 int total_num_dof = 0;
164 for(i=0; i<numElemBlocks; ++i, ++cdb_iter) {
168 int numConnectedNodes = pattern->
getNumIDs();
169 nodeNumbers.resize(numConnectedNodes);
170 numDofPerNode.resize(numConnectedNodes);
171 int* nodeNumPtr = &nodeNumbers[0];
172 int* numDofPtr = &numDofPerNode[0];
180 for(
int ii=0; ii<numConnectedNodes; ++ii) {
182 for(
int f=0; f<numFieldsPerID[ii]; ++f) {
183 dof += vspace->getFieldSize(fieldIDs[foffset++]);
186 total_num_dof += dof;
189 dof_ids.resize(total_num_dof, 0);
190 int* dof_ids_ptr = &dof_ids[0];
197 int numElems = elemIDs.size();
201 for(
int elem=0; elem<numElems; ++elem) {
202 for(
int n=0; n<numConnectedNodes; ++n) {
203 fei::Record<int>* node = nodeRecords->getRecordWithLocalID(nodes[offset++]);
209 nodeNumPtr, numDofPtr, dof_ids_ptr));
215 setStructure_ =
true;
224 bool setMatrixMatrixGraph_;
231 #endif // _snl_fei_Broker_FEData_hpp_
GlobalIDType getNumber() const
const std::map< int, int > & getConnectivityIDs() const
int getNumIndices() const
const int * getNumFieldsPerID() const
virtual fei::SharedPtr< fei::LinearSystem > createLinearSystem()
virtual const fei::ConnectivityBlock * getConnectivityBlock(int blockID) const =0
const int * getFieldIDs() const
void setLookup(Lookup *lookup)
virtual std::map< int, fei::ConnectivityBlock * > & getConnectivityBlocks()=0
std::vector< int > & getRowConnectivities()
virtual int setConnectivity(int elemBlockID, int elemID, int numNodes, const int *nodeNumbers, const int *numDofPerNode, const int *dof_ids)=0
virtual fei::SharedPtr< fei::VectorSpace > getRowSpace()=0
virtual int setLookup(Lookup &lookup)=0
virtual void setMatrixGraph(fei::SharedPtr< fei::MatrixGraph > matrixGraph)
Broker_FEData(fei::SharedPtr< FiniteElementData > feData, fei::SharedPtr< fei::MatrixGraph > matrixGraph, int nodeIDType)
virtual fei::SharedPtr< fei::Vector > createVector(bool isSolutionVector=false)
int getNumOwnedAndSharedIDs(int idType)
virtual fei::SharedPtr< fei::Matrix > createMatrix()
virtual int getLocalNumLagrangeConstraints() const =0
virtual int getNumConnectivityBlocks() const =0
virtual int getConnectivityBlockIDs(std::vector< int > &blockIDs) const =0
virtual int describeStructure(int numElemBlocks, const int *numElemsPerBlock, const int *numNodesPerElem, const int *elemMatrixSizePerBlock, int totalNumNodes, int numSharedNodes, int numMultCRs)=0
const fei::Pattern * getRowPattern() const
int getNumIndices_Owned() const