// file: lat_init_0.cc
//

// isip include files
//
#include "lattice.h"
#include "lattice_constants.h"

// method: init_nodes_cc
//
// arguments:
//  Lattice_node** lnodes: (input) array of lattice node pointers
//
// return: a logical_1 indicating status
//
// this method creates the necessary number of nodes in the lattice
// and places them in the hash table
//
logical_1 Lattice::init_nodes_cc(Lattice_node** lnodes_a) {

  //  if memory is not already defined return with error
  //
  if (lnodes_a == (Lattice_node**)NULL) {
    return ISIP_FALSE;
  }

  // memory manager
  //
  Memory_manager* manager = Link_list::get_manager_cc();

  // declare memory for each node and add index
  //
  for (int_4 i = 0; i < num_nodes_d; i++) {
    lnodes_a[i] = manager->new_lat_cc();
    lnodes_a[i]->set_node_index_cc(i);
    set_lat_node_cc(lnodes_a[i]);
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
