Changeset 4410


Ignore:
Timestamp:
07/06/10 11:22:23 (15 years ago)
Author:
Mathieu Morlighem
Message:

Better way to handle hnodes (NULL pointer)

Location:
issm/trunk/src/c
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp

    r4218 r4410  
    2323        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    2424       
    25         //_printf_("      Configuring elements...\n");
     25        _printf_("      Configuring elements...\n");
    2626        for (i=0;i<elements->Size();i++){
    2727                element=(Element*)elements->GetObjectByOffset(i);
    2828                element->Configure(elements,loads,nodes,materials,parameters);
    2929        }
    30         //_printf_("      Configuring loads...\n");
     30        _printf_("      Configuring loads...\n");
    3131        for (i=0;i<loads->Size();i++){
    3232                load=(Load*)loads->GetObjectByOffset(i);
     
    3535                }
    3636        }
    37         //_printf_("      Configuring nodes...\n");
     37        _printf_("      Configuring nodes...\n");
    3838        for (i=0;i<nodes->Size();i++){
    3939                node=(Node*)nodes->GetObjectByOffset(i);
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4405 r4410  
    602602        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    603603         * datasets, using internal ids and offsets hidden in hooks: */
    604         this->hnodes[analysis_counter]->configure(nodesin);
     604        if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
    605605        this->hmatice->configure(materialsin);
    606606        this->hmatpar->configure(materialsin);
     
    608608
    609609        /*Now, go pick up the objects inside the hooks: */
    610         this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     610        if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     611        else this->nodes=NULL;
    611612        this->matice=(Matice*)this->hmatice->delivers();
    612613        this->matpar=(Matpar*)this->hmatpar->delivers();
  • issm/trunk/src/c/objects/Elements/PentaHook.cpp

    r4396 r4410  
    5353        this->hneighbors=NULL;
    5454
     55        //Initialize hnodes as NULL
     56        for(int i=0;i<this->numanalyses;i++){
     57                this->hnodes[i]=NULL;
     58        }
     59
    5560}
    5661/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4405 r4410  
    487487        /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
    488488         * datasets, using internal ids and offsets hidden in hooks: */
    489         this->hnodes[analysis_counter]->configure(nodesin);
     489        if(this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
    490490        this->hmatice->configure(materialsin);
    491491        this->hmatpar->configure(materialsin);
    492492
    493493        /*Now, go pick up the objects inside the hooks: */
    494         this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     494        if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
     495        else this->nodes=NULL;
    495496        this->matice=(Matice*)this->hmatice->delivers();
    496497        this->matpar=(Matpar*)this->hmatpar->delivers();
  • issm/trunk/src/c/objects/Elements/TriaHook.cpp

    r4401 r4410  
    5050        this->hmatpar=new Hook(&matpar_id,1);
    5151
    52         //Initialize hnodes
     52        //Initialize hnodes as NULL
    5353        for(int i=0;i<this->numanalyses;i++){
    54                 this->hnodes[i]=new Hook();
     54                this->hnodes[i]=NULL;
    5555        }
    5656
     
    6060void TriaHook::SetHookNodes(int* node_ids,int analysis_counter){
    6161
    62         /*Delete existing Hook (empty)*/
    63         delete this->hnodes[analysis_counter];
    64 
    65         /*Replace by new Hook*/
     62        /*initialize hook*/
    6663        this->hnodes[analysis_counter]=new Hook(node_ids,3);
    6764}
Note: See TracChangeset for help on using the changeset viewer.