18 static LoggerPtr logger(Logger::getLogger(
"pz.metis"));
32 out <<
"\nTPZMetis::Print fNElements = " <<
fNElements <<
" fNNodes = " <<
fNNodes << endl;
33 for (el=0;el<nel;el++) {
37 out <<
"Element number " << el <<
" : ";
38 for (index=firstindex;index<lastindex;index++) {
45 int numelnodegraph = nodegraphindex[
fNNodes];
46 if (numelnodegraph == nodegraph.NElements() ) {
47 nodegraph.
Resize(numelnodegraph+1);
50 for (nod = numelnodegraph; nod>0; nod--) nodegraph[nod] = nodegraph[nod-1];
52 int firstindex = nodegraphindex[el];
53 int lastindex = nodegraphindex[el+1];
55 out <<
"Node number " << el <<
" : ";
56 for (index=firstindex;index<lastindex;index++) {
57 out << nodegraph[index+1] <<
" ";
80 int numelnodegraph = nodegraphindex[
fNNodes];
81 if (numelnodegraph == nodegraph.NElements() ) {
82 nodegraph.
Resize(numelnodegraph+1);
85 for (nod = numelnodegraph; nod>0; nod--) nodegraph[nod] = nodegraph[nod-1];
87 int firstindex = nodegraphindex[el];
88 int lastindex = nodegraphindex[el+1];
90 for (index=firstindex;index<lastindex;index++) {
91 out << (nodegraph[index+1]+1) <<
" ";
100 int64_t numelnodegraph = nodegraphindex[
fNNodes];
101 if (numelnodegraph == nodegraph.NElements() )
103 nodegraph.
Resize(numelnodegraph+1);
106 for (nod = numelnodegraph; nod>0; nod--) nodegraph[nod] = nodegraph[nod-1];
111 perm[nod] = inverseperm[nod] = nod;
116 int NNodes = (int) fNNodes;
117 int64_t n, sz = nodegraph.NElements();
118 nodegraph.Resize(sz);
120 nodegraphInt[n] = (
int)nodegraph[n];
123 nodegraphindexInt[n] = (
int)nodegraphindex[n];
130 int *permint =
new int[nperms];
131 int *inversepermint =
new int[ninvers];
132 if(!permint || !inverseperm.
size()) {
133 std::cout <<
"TPZMetis::Resequence memory is not enough.\n";
137 for(i=0L;i<nperms;i++)
138 permint[i] = (
int)perm[i];
139 for(i=0L;i<nperms;i++)
140 inversepermint[i] = (
int)inverseperm[i];
143 METIS_NodeND(&NNodes,&nodegraphindexInt[0],&nodegraphInt[1],&numflag,&options,permint,inversepermint);
144 fNNodes = (int64_t)NNodes;
156 std::stringstream sout;
158 if (logger->isDebugEnabled())
167 int64_t n, nVertices = AdjacencyIndex.
NElements();
168 AdjacencyIndexInt.Resize(nVertices,0);
169 for(n=0;n<nVertices;n++)
170 AdjacencyIndexInt[n] = (
int)AdjacencyIndex[n];
172 AdjacencyInt.Resize(nEdges,0);
173 for(n=0;n<nEdges;n++)
174 AdjacencyInt[n] = (
int)Adjacency[n];
175 int nvertices = (int)nVertices-1;
177 Domains.
Resize(nvertices,0);
179 int nEdgesCutted = 0;
182 METIS_SetDefaultOptions(&Options[0]);
185 if(METIS_PartGraphRecursive(&nvertices, &ncon, &AdjacencyIndexInt[0], &AdjacencyInt[0], NULL, NULL, NULL,
186 &nParts, NULL, NULL, &Options[0], &nEdgesCutted, &Domains[0]) != METIS_OK)
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
void ConvertGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex, TPZManVector< int64_t > &nodegraph, TPZManVector< int64_t > &nodegraphindex)
Will convert an element graph defined by elgraph and elgraphindex into a node graph defined by nodegr...
void Print(std::ostream &out)
Prints the current object data structure.
void Subdivide(int nParts, TPZVec< int > &Domains)
Subdivides a Graph in nParts.
virtual void Resequence(TPZVec< int64_t > &perm, TPZVec< int64_t > &inverseperm)
Perform the renumbering of elements. The aim of this operation is to minimize the band of the resulti...
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
int64_t size() const
Returns the number of elements of the vector.
TPZVec< int64_t > fElementGraphIndex
Indicates for each element the index of the first entry with fElementGraph for that element The size ...
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
This abstract class which defines the behavior which derived classes need to implement for implement...
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
int64_t fNElements
Number of elements in the graph.
void ConvertToElementoToElementGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex, TPZVec< int64_t > &eltotelgraph, TPZVec< int > &eltoelweight, TPZVec< int64_t > &eltoelgraphindex)
Convert a traditional elgraph to an element to element graph.
void Print(TPZVec< int64_t > &grapho, TPZVec< int64_t > &graphoindex, const char *name=0, std::ostream &out=std::cout)
Prints graph.
int64_t fNNodes
Number of nodes in the graph.
TPZVec< int64_t > fElementGraph
Node number of each element.
int64_t NElements() const
Returns the number of elements of the vector.
Contains TPZMetis class which implements the renumbering for elements of a mesh to minimize the band...