예제 #1
0
    /**
     * @brief writeXdmfAttribute
     * @param out
     * @param volDims
     * @param hdfFileName
     * @param groupPath
     * @return
     */
    virtual int writeXdmfAttribute(std::ostream &out, int64_t* volDims, const std::string &hdfFileName,
            const std::string &groupPath, const std::string &label)
    {

      std::stringstream dimStr;
      dimStr << volDims[0] << " " << volDims[1] << " " << volDims[2] << " ";
      int precision = 0;
      std::string xdmfTypeName;
      GetXdmfTypeAndSize(xdmfTypeName, precision);

      /*
     <Attribute Name="MisorientationList" AttributeType="Scalar" Center="Cell">
      <DataItem Format="HDF" Dimensions="52140" NumberType="Float" Precision="4" >
        test40638_01.dream3d:/VoxelDataContainer/FIELD_DATA/MisorientationList
      </DataItem>
    </Attribute>
    */
      out << "    <Attribute Name=\"" << GetName() << label << "\" AttributeType=\"Scalar\" Center=\"Node\">" << std::endl;
      out << "      <DataItem Format=\"HDF\" Dimensions=\"" << dimStr.str() <<  "\" ";
      out << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
      out << "        " << hdfFileName << groupPath << "/" << GetName() << std::endl;
      out << "      </DataItem>" << std::endl;
      out << "    </Attribute>" << std::endl << std::endl;
      return 1;
    }
예제 #2
0
    /**
     * @brief writeXdmfAttribute
     * @param out
     * @param volDims
     * @return
     */
    virtual int writeXdmfAttribute(std::ostream &out, int64_t* volDims, const std::string &hdfFileName, const std::string &groupPath,
    const std::string &label)
    {
      if (Array == NULL) { return -85648; }
      std::stringstream dimStr;
      int precision = 0;
      std::string xdmfTypeName;
      GetXdmfTypeAndSize(xdmfTypeName, precision);
      if (0 == precision)
      {
        out << "<!-- " << GetName() << " has unkown type or unsupported type or precision for XDMF to understand" << " -->" << std::endl;
        return -100;
      }

      int numComp = GetNumberOfComponents();
      out << "    <Attribute Name=\"" << GetName() << label  << "\" ";
      if (numComp == 1)
      {
        out << "AttributeType=\"Scalar\" ";
        dimStr << volDims[2] << " " << volDims[1] << " " << volDims[0] << " ";
      }
      else
      {
        out << "AttributeType=\"Vector\" ";
        dimStr << volDims[2] << " " << volDims[1] << " " << volDims[0] << " " << numComp << " ";
      }
      out << "Center=\"Cell\">" << std::endl;
      // Open the <DataItem> Tag
      out << "      <DataItem Format=\"HDF\" Dimensions=\"" << dimStr.str() <<  "\" ";
      out << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;


      out << "        " << hdfFileName << groupPath << "/" << GetName() << std::endl;
      out << "      </DataItem>" << std::endl;
      out << "    </Attribute>" << std::endl << std::endl;
      return 1;
    }