Changeset 13887


Ignore:
Timestamp:
11/06/12 15:40:16 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added GetMaxNodes

Location:
issm/trunk-jpl/src/c/Container
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/Container/Elements.cpp

    r13813 r13887  
    294294}
    295295/*}}}*/
     296/*FUNCTION Elements::MaxNumNodes{{{*/
     297int Elements::MaxNumNodes(void){
     298
     299        int max=0;
     300        int allmax;
     301        int numnodes=0;
     302
     303        /*Now go through all elements, and get how many nodes they own, unless they are clone nodes: */
     304        for(int i=0;i<this->Size();i++){
     305
     306                Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(i));
     307                numnodes=element->GetNumberOfNodes();
     308                if(numnodes>max)max=numnodes;
     309        }
     310
     311        /*Grab max of all cpus: */
     312        #ifdef _HAVE_MPI_
     313        MPI_Allreduce((void*)&max,(void*)&allmax,1,MPI_INT,MPI_MAX,IssmComm::GetComm());
     314        max=allmax;
     315        #endif
     316
     317        return max;
     318}
     319/*}}}*/
    296320/*FUNCTION Elements::NumberOfElements{{{*/
    297321int Elements::NumberOfElements(void){
  • TabularUnified issm/trunk-jpl/src/c/Container/Elements.h

    r13797 r13887  
    2727                void   Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
    2828                void   DeleteResults(void);
     29                int    MaxNumNodes(void);
    2930                void   ProcessResultsUnits(void);
    3031                void   SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
Note: See TracChangeset for help on using the changeset viewer.