QString ParameterizedCommand::GetName() const
{
  if (name.isEmpty())
  {
    QTextStream nameBuffer(&name);
    nameBuffer << command->GetName() << " (";
    const unsigned int parameterizationCount = (unsigned int) parameterizations.size();
    for (unsigned int i = 0; i < parameterizationCount; i++)
    {
      const Parameterization& parameterization = parameterizations[i];
      nameBuffer << parameterization.GetParameter()->GetName() << ": ";
      try
      {
        nameBuffer << parameterization.GetValueName();
      }
      catch (const ParameterValuesException& /*e*/)
      {
        /*
         * Just let it go for now. If someone complains we can
         * add more info later.
         */
      }

      // If there is another item, append a separator.
      if (i + 1 < parameterizationCount)
      {
        nameBuffer << ", ";
      }

      nameBuffer << ")";
    }
  }
  return name;
}
Exemple #2
0
std::vector<std::string> RegistryKey::keyNames()
{
   if (!hKey_)
      return std::vector<std::string>();

   LONG result;

   DWORD subKeys, maxLen;
   result = ::RegQueryInfoKey(hKey_, NULL, NULL, NULL, &subKeys, &maxLen,
                              NULL, NULL, NULL, NULL, NULL, NULL);


   std::vector<char> nameBuffer(maxLen+2);
   std::vector<std::string> results;
   results.reserve(subKeys);

   for (DWORD i = 0; ; i++)
   {
      DWORD size = nameBuffer.capacity();
      LONG result = ::RegEnumKeyEx(hKey_,
                                   i,
                                   &nameBuffer[0],
                                   &size,
                                   NULL, NULL, NULL, NULL);
      switch (result)
      {
      case ERROR_SUCCESS:
         results.push_back(std::string(&nameBuffer[0], size));
         break;
      case ERROR_NO_MORE_ITEMS:
         return results;
      default:
         Error error = systemError(result, ERROR_LOCATION);
         LOG_ERROR(error);
         break;
      }

   }

   return std::vector<std::string>();
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SurfaceMeshDataContainerWriter::writeXdmfGridHeader()
{
  if (m_WriteXdmfFile == false || m_XdmfPtr == NULL)
  {
    return;
  }
  DREAM3D::SurfaceMesh::FaceListPointer_t faces = getSurfaceMeshDataContainer()->getFaces();
  if (NULL == faces.get())
  {
    return;
  }
  DREAM3D::SurfaceMesh::VertListPointer_t verts = getSurfaceMeshDataContainer()->getVertices();
  if(NULL == verts.get())
  {
    return;
  }

  std::ostream& out = *m_XdmfPtr;
  out << "  <Grid Name=\"SurfaceMesh DataContainer\">" << std::endl;

  out << "    <Topology TopologyType=\"Triangle\" NumberOfElements=\"" << faces->GetNumberOfTuples() << "\">" << std::endl;
  out << "      <DataItem Format=\"HDF\" NumberType=\"Int\" Dimensions=\"" << faces->GetNumberOfTuples() << " 3\">" << std::endl;
  ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
  std::vector<char> nameBuffer(nameSize, 0);
  nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);
  std::string hdfFileName(&(nameBuffer.front()), nameSize);
  hdfFileName = MXAFileInfo::filename(hdfFileName);
  out << "        " << hdfFileName << ":/SurfaceMeshDataContainer/Faces" << std::endl;
  out << "      </DataItem>" << std::endl;
  out << "    </Topology>" << std::endl;

  out << "    <Geometry Type=\"XYZ\">" << std::endl;
  out << "      <DataItem Format=\"HDF\"  Dimensions=\"" << verts->GetNumberOfTuples() << " 3\" NumberType=\"Float\" Precision=\"4\">" << std::endl;
  out << "        " << hdfFileName << ":/SurfaceMeshDataContainer/Vertices" << std::endl;
  out << "      </DataItem>" << std::endl;
  out << "    </Geometry>" << std::endl;
  out << "" << std::endl;
}
// COM port and baud rate enumeration
int DFURequestsCOM::EnumeratePorts(CStringListX &ports)
{
#if !defined _WINCE && !defined _WIN32_WCE
	// Try to read the COM ports from the registry first
	ports.RemoveAll();
	HKEY handle;
	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DEVICEMAP\\SERIALCOMM"),
		             0, KEY_ENUMERATE_SUB_KEYS | KEY_EXECUTE | KEY_QUERY_VALUE | KEY_READ,
					 &handle)
		== ERROR_SUCCESS)
	{
		// Determine the maximum buffer sizes required
		DWORD maxNameLength;
		DWORD maxDataLength;
		if (RegQueryInfoKey(handle, 0, 0, 0, 0, 0, 0, 0,
			                &maxNameLength, &maxDataLength, 0, 0)
			== ERROR_SUCCESS)
		{
			// Allocate buffers to receive the key data
			SmartPtr<TCHAR, true> nameBuffer(new TCHAR[++maxNameLength]);
			SmartPtr<BYTE, true> dataBuffer(new BYTE[maxDataLength]);
			
			// Enumerate the values
			DWORD index = 0;
			DWORD type;
			DWORD nameBufferLength = maxNameLength;
			DWORD dataBufferLength = maxDataLength;
			while (RegEnumValue(handle, index++,
				                nameBuffer, &nameBufferLength, 0, &type,
								(BYTE *) dataBuffer, &dataBufferLength)
				   == ERROR_SUCCESS)
			{
				// Add this port if the type is correct
				if (type == REG_SZ) ports.AddTail((TCHAR *) (BYTE *) dataBuffer);

				// Restore the buffer lengths
				nameBufferLength = maxNameLength;
				dataBufferLength = maxDataLength;
			}
		}

		// Close the registry
		RegCloseKey(handle);
	}

	// If any ports found then check if they can be opened
	if (!ports.IsEmpty())
	{
		// Try to open all of the ports
		for (CStringListX::POSITION port = ports.GetHeadPosition(); port;)
		{
			CStringListX::POSITION portPos = port;
			if (!bool(Device(ports.GetNext(port))))
			{
				ports.RemoveAt(portPos);
			}
		}

		// Sort the list and return the number of ports found
		return Device::Sort(deviceFormat, firstPort, lastPort, ports);
	}
#endif

	// Try opening all possible COM ports
	return Device::Enumerate(deviceFormat, firstPort, lastPort, ports);
}
Exemple #5
0
	bool GraphicalPlane::GenerateBoard(const std::string& path, const int &width, const int &height, const TextureSP &texture)
	{
		// キーネーム設定
		std::stringstream nameBuffer("");
		// ファイルパス→生成番号→幅高さの順で追加
		nameBuffer << path << ++_createCount << width << height;
		std::string name = nameBuffer.str();
		// メッシュインスタンスの生成
		_mesh = Mesh::CreateEmpty(name);
		// サイズを記録
		_size.x = (float)width ;
		_size.y = (float)height ;
		//_size.z = 0 ;
		// テクスチャ指定がある場合そのサイズを取得
		if(texture != NULL)
		{
			while(UINT(_textureSize.x) < _texture->GetImageInfo().Width)
			{
				_textureSize.x *= 2;
			}
			while(UINT(_textureSize.y) < _texture->GetImageInfo().Height)
			{
				_textureSize.y *= 2;
			}
		}
		// シェーダー設定
		_shader = ShaderNormal::Create();
		// メッシュを生成する
		LPD3DXMESH mesh;
		if (FAILED(D3DXCreateMeshFVF(2, 4, D3DXMESH_MANAGED, Vertex::FVF, GraphicsManager::_device, &mesh)))
			return false;

		//頂点データの作成
		Vertex* vertex;
		mesh->LockVertexBuffer(0, (void**)&vertex);
		for (int y = 0 ; y < 2 ; y++) {
			for (int x = 0 ; x < 2 ; x++) {
				float x1 = (float)(x * width - ((float)width / 2));
				float y1 = (float)(y * height - ((float)height / 2));
				int index = y * 2 + x;
				vertex[index]._position.x = x1;
				vertex[index]._position.y = y1;
				vertex[index]._position.z = 0;
				vertex[index]._normal.x = 0;
				vertex[index]._normal.y = 0;
				vertex[index]._normal.z = 1;
				if( texture == NULL )
				{
					vertex[index]._uv.x = (float)x * 1.0f;
					vertex[index]._uv.y = 1.0f - ((float)y * 1.0f);
				}
			}
		}
		if(texture)
		{
			vertex[0]._uv.x = (float)_rects[_number].left / _texture->GetImageInfo().Width;
			vertex[0]._uv.y = (float)_rects[_number].bottom / _texture->GetImageInfo().Height;
			vertex[1]._uv.x = (float)_rects[_number].right / _texture->GetImageInfo().Width;
			vertex[1]._uv.y = (float)_rects[_number].bottom / _texture->GetImageInfo().Height;
			vertex[2]._uv.x = (float)_rects[_number].left / _texture->GetImageInfo().Width;
			vertex[2]._uv.y = (float)_rects[_number].top / _texture->GetImageInfo().Height;
			vertex[3]._uv.x = (float)_rects[_number].right / _texture->GetImageInfo().Width;
			vertex[3]._uv.y = (float)_rects[_number].top / _texture->GetImageInfo().Height;
		}
		mesh->UnlockVertexBuffer();
		//インデックスデータの作成
		WORD *index;
		mesh->LockIndexBuffer(0, (void **)&index);
		index[0] = 0;
		index[1] = 2;
		index[2] = 1;
		index[3] = 1;
		index[4] = 2;
		index[5] = 3;
		mesh->UnlockIndexBuffer();
	    _mesh->SetMesh(mesh);

		return true;
	}
Exemple #6
0
static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANGLEShaderSymbol>& symbols)
{
    ShShaderInfo symbolMaxNameLengthType;

    switch (symbolType) {
    case SH_ACTIVE_ATTRIBUTES:
        symbolMaxNameLengthType = SH_ACTIVE_ATTRIBUTE_MAX_LENGTH;
        break;
    case SH_ACTIVE_UNIFORMS:
        symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
        break;
    default:
        ASSERT_NOT_REACHED();
        return false;
    }

    ANGLEGetInfoType numSymbols = getValidationResultValue(compiler, symbolType);

    ANGLEGetInfoType maxNameLength = getValidationResultValue(compiler, symbolMaxNameLengthType);
    if (maxNameLength <= 1)
        return false;

    ANGLEGetInfoType maxMappedNameLength = getValidationResultValue(compiler, SH_MAPPED_NAME_MAX_LENGTH);
    if (maxMappedNameLength <= 1)
        return false;

    // The maximum allowed symbol name length is 256 characters.
    Vector<char, 256> nameBuffer(maxNameLength);
    Vector<char, 256> mappedNameBuffer(maxMappedNameLength);

    for (ANGLEGetInfoType i = 0; i < numSymbols; ++i) {
        ANGLEShaderSymbol symbol;
        ANGLEGetInfoType nameLength = 0;
        switch (symbolType) {
        case SH_ACTIVE_ATTRIBUTES:
            symbol.symbolType = SHADER_SYMBOL_TYPE_ATTRIBUTE;
#if ANGLE_SH_VERSION >= 112
            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, &symbol.staticUse, nameBuffer.data(), mappedNameBuffer.data());
#else
            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, nameBuffer.data(), mappedNameBuffer.data());
#endif
            break;
        case SH_ACTIVE_UNIFORMS:
            symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
#if ANGLE_SH_VERSION >= 112
            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, &symbol.staticUse, nameBuffer.data(), mappedNameBuffer.data());
#else
            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, nameBuffer.data(), mappedNameBuffer.data());
#endif
            break;
        default:
            ASSERT_NOT_REACHED();
            return false;
        }
        if (!nameLength)
            return false;

        // The ShGetActive* calls above are guaranteed to produce null-terminated strings for
        // nameBuffer and mappedNameBuffer. Also, the character set for symbol names
        // is a subset of Latin-1 as specified by the OpenGL ES Shading Language, Section 3.1 and
        // WebGL, Section "Characters Outside the GLSL Source Character Set".

        String name = String(nameBuffer.data());
        String mappedName = String(mappedNameBuffer.data());

        // ANGLE returns array names in the format "array[0]".
        // The only way to know if a symbol is an array is to check if it ends with "[0]".
        // We can't check the size because regular symbols and arrays of length 1 both have a size of 1.
        symbol.isArray = name.endsWith("[0]") && mappedName.endsWith("[0]");
        if (symbol.isArray) {
            // Add a symbol for the array name without the "[0]" suffix.
            name.truncate(name.length() - 3);
            mappedName.truncate(mappedName.length() - 3);
        }

        symbol.name = name;
        symbol.mappedName = mappedName;
        symbols.append(symbol);

        if (symbol.isArray) {
            // Add symbols for each array element.
            symbol.isArray = false;
            for (int i = 0; i < symbol.size; i++) {
                String arrayBrackets = "[" + String::number(i) + "]";
                symbol.name = name + arrayBrackets;
                symbol.mappedName = mappedName + arrayBrackets;
                symbols.append(symbol);
            }
        }
    }
    return true;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeFieldData(hid_t dcGid)
{
  std::stringstream ss;
  int err = 0;
  VoxelDataContainer* m = getVoxelDataContainer();

#if WRITE_FIELD_XDMF
// Get the name of the .dream3d file that we are writing to:
  ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
  std::vector<char> nameBuffer(nameSize, 0);
  nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);

  std::string hdfFileName(&(nameBuffer.front()), nameSize);
  hdfFileName = MXAFileInfo::filename(hdfFileName);
  std::string xdmfGroupPath = std::string(":/") + VoxelDataContainer::ClassName() + std::string("/") + H5_FIELD_DATA_GROUP_NAME;
#endif

  int64_t volDims[3] = { 0,0,0 };


  // Write the Field Data
  err = H5Utilities::createGroupsFromPath(H5_FIELD_DATA_GROUP_NAME, dcGid);
  if(err < 0)
  {
    std::cout << "Error creating HDF Group " << H5_FIELD_DATA_GROUP_NAME << std::endl;
    return err;
  }
  err = H5Lite::writeStringAttribute(dcGid, H5_FIELD_DATA_GROUP_NAME, H5_NAME, H5_FIELD_DATA_DEFAULT);
  if(err < 0)
  {
    return err;
  }

  hid_t fieldGroupId = H5Gopen(dcGid, H5_FIELD_DATA_GROUP_NAME, H5P_DEFAULT);
  if(err < 0)
  {
    ss.str("");
    ss << "Error opening field Group " << H5_FIELD_DATA_GROUP_NAME << std::endl;
    setErrorCondition(-65);
    notifyErrorMessage( ss.str(), err);
    H5Gclose(dcGid); // Close the Data Container Group
    return err;
  }

  size_t total = 0;
  typedef std::vector<IDataArray*> VectorOfIDataArrays_t;
  VectorOfIDataArrays_t neighborListArrays;

  NameListType names = m->getFieldArrayNameList();
  if (names.size() > 0)
  {
    IDataArray::Pointer array = m->getFieldData(names.front());
    total = array->GetSize();
    volDims[0] = total;
    volDims[1] = 1;
    volDims[2] = 1;
#if WRITE_FIELD_XDMF
    ss.str("");
    ss << "Field Data (" << total << ")";
    writeFieldXdmfGridHeader(total, ss.str());
#endif
  }
  // Now loop over all the field data and write it out, possibly wrapping it with XDMF code also.
  for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
  {
    IDataArray::Pointer array = m->getFieldData(*iter);
    if (array->getTypeAsString().compare(NeighborList<int>::ClassName()) == 0)
    {
      neighborListArrays.push_back(array.get());
    }
    else if (NULL != array.get())
    {
      err = array->writeH5Data(fieldGroupId);
      if(err < 0)
      {
        ss.str("");
        ss << "Error writing field array '" << (*iter).c_str() << "' to the HDF5 File";
        notifyErrorMessage( ss.str(), err);
        setErrorCondition(err);
        H5Gclose(fieldGroupId); // Close the Cell Group
        H5Gclose(dcGid); // Close the Data Container Group
        return err;
      }
#if WRITE_FIELD_XDMF
      array->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Field)");
#endif
    }
  }


#if WRITE_FIELD_XDMF
  if (names.size() > 0)
  {
    writeXdmfGridFooter("Field Data");
  }
#endif

  // Write the NeighborLists onto their own grid
  // We need to determine how many total elements we are going to end up with and group the arrays by
  // those totals so we can minimize the number of grids
  typedef std::map<size_t, VectorOfIDataArrays_t> SizeToIDataArrays_t;
  SizeToIDataArrays_t sizeToDataArrays;

  for(VectorOfIDataArrays_t::iterator iter = neighborListArrays.begin(); iter < neighborListArrays.end(); ++iter)
  {
    IDataArray* array = (*iter);
    sizeToDataArrays[array->GetSize()].push_back(array);
  }

  // Now loop over each pair in the map creating a section in the XDMF and also writing the data to the HDF5 file
  for(SizeToIDataArrays_t::iterator pair = sizeToDataArrays.begin(); pair != sizeToDataArrays.end(); ++pair)
  {
    total = (*pair).first;
    VectorOfIDataArrays_t& arrays = (*pair).second;
    volDims[0] = total;
    volDims[1] = 1;
    volDims[2] = 1;
    #if WRITE_FIELD_XDMF
    ss.str("");
    ss << "Neighbor Data (" << total << ")";
    writeFieldXdmfGridHeader(total, ss.str());
    #endif
    for(VectorOfIDataArrays_t::iterator iter = arrays.begin(); iter < arrays.end(); ++iter)
    {
      err = (*iter)->writeH5Data(fieldGroupId);
      if(err < 0)
      {
        ss.str("");
        ss << "Error writing neighbor list field array '" << (*iter)->GetName() << "' to the HDF5 File";
        notifyErrorMessage( ss.str(), err);
        setErrorCondition(err);
        H5Gclose(fieldGroupId); // Close the Cell Group
        H5Gclose(dcGid); // Close the Data Container Group
        return err;
      }
#if WRITE_FIELD_XDMF
      (*iter)->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Neighbor Data)");
#endif
    }
#if WRITE_FIELD_XDMF
    writeXdmfGridFooter(ss.str());
#endif

  }

  H5Gclose(fieldGroupId);
  return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeCellData(hid_t dcGid)
{
  std::stringstream ss;
  int err = 0;
  VoxelDataContainer* m = getVoxelDataContainer();
  int64_t volDims[3] =
  { m->getXPoints(), m->getYPoints(), m->getZPoints() };
  float spacing[3] =
  { m->getXRes(), m->getYRes(), m->getZRes() };
  float origin[3] =
  { 0.0f, 0.0f, 0.0f };
  m->getOrigin(origin);

  writeCellXdmfGridHeader(origin, spacing, volDims);


  // Get the name of the .dream3d file that we are writing to:
  ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
  std::vector<char> nameBuffer(nameSize, 0);
  nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);

  std::string hdfFileName(&(nameBuffer.front()), nameSize);
  hdfFileName = MXAFileInfo::filename(hdfFileName);
  std::string xdmfGroupPath = std::string(":/") + VoxelDataContainer::ClassName() + std::string("/") + H5_CELL_DATA_GROUP_NAME;

  // Write the Voxel Data
  err = H5Utilities::createGroupsFromPath(H5_CELL_DATA_GROUP_NAME, dcGid);
  if(err < 0)
  {
    ss.str("");
    ss << "Error creating HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
    setErrorCondition(-63);
    notifyErrorMessage(ss.str(), err);
    H5Gclose(dcGid); // Close the Data Container Group
    return err;
  }
  hid_t cellGroupId = H5Gopen(dcGid, H5_CELL_DATA_GROUP_NAME, H5P_DEFAULT);
  if(err < 0)
  {
    ss.str("");
    ss << "Error writing string attribute to HDF Group " << H5_CELL_DATA_GROUP_NAME << std::endl;
    setErrorCondition(-64);
    notifyErrorMessage(ss.str(), err);
    H5Gclose(dcGid); // Close the Data Container Group
    return err;
  }
  NameListType names = m->getCellArrayNameList();
  for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
  {
    ss.str("");
    ss << "Writing Cell Data '" << *iter << "' to HDF5 File" << std::endl;
    notifyStatusMessage(ss.str());
    IDataArray::Pointer array = m->getCellData(*iter);
    err = array->writeH5Data(cellGroupId);
    if(err < 0)
    {
      ss.str("");
      ss << "Error writing array '" << *iter << "' to the HDF5 File";
      notifyErrorMessage(ss.str(), err);
      setErrorCondition(err);
      H5Gclose(cellGroupId); // Close the Cell Group
      H5Gclose(dcGid); // Close the Data Container Group
      return err;
    }
    array->writeXdmfAttribute( *m_XdmfPtr, volDims, hdfFileName, xdmfGroupPath, " (Cell)");
  }
  H5Gclose(cellGroupId); // Close the Cell Group
  writeXdmfGridFooter("Cell Data");
  return err;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
std::string SurfaceMeshDataContainerWriter::writeXdmfAttributeDataHelper(int numComp, const std::string &attrType,
                                                                              const std::string &groupName,
                                                                              IDataArray::Pointer array,
                                                                              const std::string &centering,
                                                                              int precision, const std::string &xdmfTypeName)
{
  std::stringstream out;
  std::stringstream dimStr;
  std::stringstream dimStr1;
  std::stringstream dimStr1half;
  std::stringstream dimStr2;
  std::stringstream dimStr2half;

  if((numComp%2) == 1)
  {
    out << "    <Attribute Name=\"" << array->GetName() << "\" ";
    out << "AttributeType=\"" << attrType << "\" ";
    dimStr << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
    out << "Center=\"" << centering << "\">" << std::endl;
    // Open the <DataItem> Tag
    out << "      <DataItem Format=\"HDF\" Dimensions=\"" << dimStr.str() <<  "\" ";
    out << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;

    ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
    std::vector<char> nameBuffer(nameSize, 0);
    nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);

    std::string hdfFileName(&(nameBuffer.front()), nameSize);
    hdfFileName = MXAFileInfo::filename(hdfFileName);

    out << "        " << hdfFileName << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
    out << "      </DataItem>" << std::endl;
    out << "    </Attribute>" << std::endl << std::endl;
  }
  else
  {
    //First Slab
    out << "    <Attribute Name=\"" << array->GetName() << " (Field 0)\" ";
    out << "AttributeType=\"" << attrType << "\" ";
    dimStr1 << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
    dimStr1half << array->GetNumberOfTuples() << " " << (array->GetNumberOfComponents()/2);
    out << "Center=\"" << centering << "\">" << std::endl;
    // Open the <DataItem> Tag
    out << "      <DataItem ItemType=\"HyperSlab\" Dimensions=\"" << dimStr1half.str() <<  "\" ";
    out << "Type=\"HyperSlab\" " << "Name=\"" << array->GetName() << " (Field 0)\" >" << std::endl;
    out << "        <DataItem Dimensions=\"3 2\" " << "Format=\"XML\" >" << std::endl;
    out << "          0        0" << std::endl;
    out << "          1        1" << std::endl;
    out << "          " << dimStr1half.str() << " </DataItem>" << std::endl;
    out << std::endl;
    out << "        <DataItem Format=\"HDF\" Dimensions=\"" << dimStr1.str() << "\" " << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
    ssize_t nameSize = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
    std::vector<char> nameBuffer(nameSize, 0);
    nameSize = H5Fget_name(m_HdfFileId, &(nameBuffer.front()), nameSize);
    std::string hdfFileName(&(nameBuffer.front()), nameSize);
    hdfFileName = MXAFileInfo::filename(hdfFileName);
    out << "        " << hdfFileName << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
    out << "        </DataItem>" << std::endl;
    out << "      </DataItem>" << std::endl;
    out << "    </Attribute>" << std::endl << std::endl;

    //Second Slab
    out << "    <Attribute Name=\"" << array->GetName() << " (Field 1)\" ";
    out << "AttributeType=\"" << attrType << "\" ";
    dimStr2 << array->GetNumberOfTuples() << " " << array->GetNumberOfComponents();
    dimStr2half << array->GetNumberOfTuples() << " " << (array->GetNumberOfComponents()/2);
    out << "Center=\"" << centering << "\">" << std::endl;
    // Open the <DataItem> Tag
    out << "      <DataItem ItemType=\"HyperSlab\" Dimensions=\"" << dimStr2half.str() <<  "\" ";
    out << "Type=\"HyperSlab\" " << "Name=\"" << array->GetName() << " (Field 1)\" >" << std::endl;
    out << "        <DataItem Dimensions=\"3 2\" " << "Format=\"XML\" >" << std::endl;
    out << "          0        " << (array->GetNumberOfComponents()/2) << std::endl;
    out << "          1        1" << std::endl;
    out << "          " << dimStr2half.str() << " </DataItem>" << std::endl;
    out << std::endl;
    out << "        <DataItem Format=\"HDF\" Dimensions=\"" << dimStr2.str() << "\" " << "NumberType=\"" << xdmfTypeName << "\" " << "Precision=\"" << precision << "\" >" << std::endl;
    ssize_t nameSize2 = H5Fget_name(m_HdfFileId, NULL, 0) + 1;
    std::vector<char> nameBuffer2(nameSize2, 0);
    nameSize2 = H5Fget_name(m_HdfFileId, &(nameBuffer2.front()), nameSize2);
    std::string hdfFileName2(&(nameBuffer2.front()), nameSize2);
    hdfFileName2 = MXAFileInfo::filename(hdfFileName2);
    out << "        " << hdfFileName2 << ":/SurfaceMeshDataContainer/" << groupName << "/" << array->GetName() << std::endl;
    out << "        </DataItem>" << std::endl;
    out << "      </DataItem>" << std::endl;
    out << "    </Attribute>" << std::endl << std::endl;
  }
  return out.str();
}