void Structure::find_load_resistance()
{
  Ext_Node_Pair *ext_node_pair;
  Resistance *resist;
  char * nodeName1, *nodeName2;

  for (resist = list_resistances.initialize(); resist!=NULL;
       resist=list_resistances.iterate())
  {
    if ((resist->get_node(1) !=NULL) && (resist->get_node(2) !=NULL))
    {
      nodeName1=resist->node_name(1);
      nodeName2=resist->node_name(2);
      ext_node_pair=get_ext_node_pair_from_node_names(nodeName1, nodeName2);
      ext_node_pair->connect_to_resistance(resist);
    }
  }

}
void Structure::connect_resistances_meshes()
{
  Resistance *resist;
  List<Internal_Node> *list_int_nodes;
  Internal_Node *int_node_ptr;
  panel<double> *panel1_ptr, *panel2_ptr;
  long int mesh_number_Mps, mesh_number_Mrs;

  // precaution
/*  if (mesh_mats.Mp_ptr == NULL)
  {
    printf ("Errare humanum est: Structure::connect_resistances_meshes()\n");
    exit (-1);
  }
*/
  // get number of already existing meshes (in Mp); number of meshes in Mrs is 0;
 // mesh_number_Mps = (mesh_mats.Mps_ptr->get_n_lines()) + 1;
  mesh_number_Mps = (mesh_mats.Mps_ptr.numRow()) + 1;
  mesh_number_Mrs = 0+1;

  for (resist=list_resistances.initialize(); resist != NULL;
       resist=list_resistances.iterate() )
  {

    // get panel connected to 1st node of this resistance
    if ((int_node_ptr = ((((resist->get_node(1))->real_node())->
                          get_list_internal_nodes())->initialize())) == NULL)
    {
      printf ("Error: Structure::connect_resistances_meshes() - nothing "
              "is connects to node %s of Resistance %s.\n",
              resist->node_name(1), resist->name() );
      exit(-1);
    }
    if ((panel1_ptr = int_node_ptr->get_first_panel_ptr()) == NULL)
    {
      printf ("Error: Structure::connect_resistances_meshes() - no panels "
              "on this internal node ?\n");
      exit(-1);
    }

    // get panel connected to 2nd node of this resistance
    if ((int_node_ptr = ((((resist->get_node(2))->real_node())->
                          get_list_internal_nodes())->initialize())) == NULL)
    {
      printf ("Error: Structure::connect_resistances_meshes() - nothing "
              "is connects to node %s of Resistance %s.\n",
              resist->node_name(2), resist->name() );
      exit(-1);
    }
    if ((panel2_ptr = int_node_ptr->get_first_panel_ptr()) == NULL)
    {
      printf ("Error: Structure::connect_resistances_meshes() - no panels "
              "on this internal node ?\n");
      exit(-1);
    }

    // add mesh in Mps and Mrs
    //mesh_mats.Mps_ptr->add_entry (0,mesh_number_Mps++, panel1_ptr, -1, panel2_ptr, 1, NULL);
    //mesh_mats.Mrs_ptr->add_entry (0, mesh_number_Mrs++, resist, 1, NULL);
	mesh_mats.Mps_ptr.resize_insertElement(mesh_number_Mps, panel1_ptr->get_number(), -1);
	mesh_mats.Mps_ptr.insertElement(mesh_number_Mps-1, panel2_ptr->get_number(), 1);
		mesh_number_Mps++;
	mesh_mats.Mrs_ptr.resize_insertElement(mesh_number_Mrs++, resist->get_number(),1);
  
  }
}