~corrado-maurini/dolfin/tao

« back to all changes in this revision

Viewing changes to dolfin/io/XMLArray.h

  • Committer: corrado maurini
  • Date: 2012-12-18 12:16:08 UTC
  • mfrom: (6685.78.207 trunk)
  • Revision ID: corrado.maurini@upmc.fr-20121218121608-nk82ly9jgsld9u84
updating with trunk, fix uint in TAO solver and hacking the check for tao FindTAO.cmake

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
    }
70
70
 
71
71
    // Get size and type
72
 
    const unsigned int size = array.attribute("size").as_uint();
 
72
    const std::size_t size = array.attribute("size").as_uint();
73
73
    const std::string type  = array.attribute("type").value();
74
74
    if (type != "double")
75
75
    {
80
80
 
81
81
    // Iterate over array entries
82
82
    x.resize(size);
83
 
    Array<unsigned int> indices(size);
 
83
    Array<std::size_t> indices(size);
84
84
    for (pugi::xml_node_iterator it = array.begin(); it != array.end(); ++it)
85
85
    {
86
 
      const unsigned int index = it->attribute("index").as_uint();
 
86
      const std::size_t index = it->attribute("index").as_uint();
87
87
      const double value = it->attribute("value").as_double();
88
88
      dolfin_assert(index < size);
89
89
      indices[index] = index;
99
99
    pugi::xml_node array_node = xml_node.append_child("array");
100
100
 
101
101
    // Add attributes
102
 
    const unsigned int size = x.size();
 
102
    const std::size_t size = x.size();
103
103
    array_node.append_attribute("type") = type.c_str();
104
 
    array_node.append_attribute("size") = size;
 
104
    array_node.append_attribute("size") = (unsigned int) size;
105
105
 
106
106
    // Add data
107
 
    for (uint i = 0; i < size; ++i)
 
107
    for (std::size_t i = 0; i < size; ++i)
108
108
    {
109
109
      pugi::xml_node element_node = array_node.append_child("element");
110
 
      element_node.append_attribute("index") = i;
 
110
      element_node.append_attribute("index") = (unsigned int) i;
111
111
      // NOTE: Casting to a string to avoid loss of precision when
112
112
      //       pugixml performs double-to-char conversion
113
113
      element_node.append_attribute("value")