// Overridden from View:
    void SilverlightView::OnPaint(gfx::Canvas* canvas)
    {
        HDC dc = canvas->BeginPlatformPaint();

        skia::PlatformCanvas platform_canvas(width(), height(), false);
        HDC mem_dc = skia::BeginPlatformPaint(&platform_canvas);
        ax_host_->Draw(mem_dc, GetLocalBounds());
        skia::EndPlatformPaint(&platform_canvas);
        skia::DrawToNativeContext(&platform_canvas, dc, 0, 0,
            &GetLocalBounds().ToRECT());

        canvas->EndPlatformPaint();
    }
Esempio n. 2
0
	void WebBrowserView::OnPaint( gfx::Canvas* canvas )
	{
		HDC dc = canvas->BeginPlatformPaint();

		skia::RefPtr<skia::PlatformCanvas> platform_canvas = skia::AdoptRef(skia::CreatePlatformCanvas(width(), height(), false));
		HDC mem_dc = skia::BeginPlatformPaint(platform_canvas.get());
		ax_host_->Draw(mem_dc, GetLocalBounds());
		skia::EndPlatformPaint(platform_canvas.get());
		skia::DrawToNativeContext(platform_canvas.get(), dc, 0, 0,
			&GetLocalBounds().ToRECT());

		canvas->EndPlatformPaint();
	}
Esempio n. 3
0
void TSplitter::DoMouseUp(const TPoint& mouse, TMouseButton button, TModifierState state)
{
	if (fTracking && button == kLeftButton)
	{
		TPoint point;
		ConstrainMouse(mouse, point);

		if (!fLiveDrag)
		{
			TRect	rect;
			GetTrackingRect(fLastMouse, rect);
			DrawTrackingRect(rect);

			TRect bounds;
			GetLocalBounds(bounds);

			if (fVertical)
				fRatio = (float)point.h / (float)bounds.GetWidth();	
			else
				fRatio = (float)point.v / (float)bounds.GetHeight();
			
			if (fRatio < 0.0)
				fRatio = 0.0;
			else if (fRatio > 1.0)
				fRatio = 1.0;

			ResizeChildren();
		}

		fTracking = false;
	}
}
Esempio n. 4
0
void TSplitter::GetTrackingRect(const TPoint& point, TRect& rect)
{
	GetLocalBounds(rect);

	if (fVertical)
	{
		rect.left = point.h - kSplitterWidth/2;
		rect.right = rect.left + kSplitterWidth;

		if (rect.left < 0)
			rect.Offset(-rect.left, 0);
		else if (rect.right > fBounds.GetWidth())
			rect.Offset(fBounds.GetWidth() - rect.right, 0);
	}
	else
	{
		rect.top = point.v - kSplitterWidth/2;
		rect.bottom = rect.top + kSplitterWidth;

		if (rect.top < 0)
			rect.Offset(0, -rect.top);
		else if (rect.bottom > fBounds.GetHeight())
			rect.Offset(0, fBounds.GetHeight() - rect.bottom);
	}
}
Esempio n. 5
0
    void MediaPlayerView::OnAxInvalidate(const gfx::Rect& rect)
    {
		if (!visible())
			return;
		gfx::Rect boundRect = GetLocalBounds();

		SchedulePaintInRect( boundRect );
    }
Esempio n. 6
0
void TScrollBar::GetArrow1(TRect& r) const
{
	GetLocalBounds(r);

	if (IsVertical())
		r.bottom = kArrowSize;
	else
		r.right = kArrowSize;
}
Esempio n. 7
0
void TScrollBar::GetArrow2(TRect& r) const
{
	GetLocalBounds(r);

	if (IsVertical())
		r.top = r.bottom - kArrowSize;
	else
		r.left = r.right - kArrowSize;
}
Esempio n. 8
0
    void WebBrowserView::OnAxInvalidate(const gfx::Rect& rect) {
		//gfx::Rect invalidate = ConvertRectToWidget(rect);
		//SchedulePaintInRect(invalidate);
		if (!visible())
			return;
		gfx::Rect boundRect = GetLocalBounds();

		SchedulePaintInRect( boundRect );
	}
 bool MenuHostRootView::OnMousePressed(const MouseEvent& event)
 {
     forward_drag_to_menu_controller_ =
         !GetLocalBounds().Contains(event.location()) ||
         !RootView::OnMousePressed(event);
     if(forward_drag_to_menu_controller_ && GetMenuController())
     {
         GetMenuController()->OnMousePressed(submenu_, event);
     }
     return true;
 }
Esempio n. 10
0
void TSplitter::GetChild2Rect(TRect& rect) const
{
	TRect	splitter;
	
	GetSplitterRect(fRatio, splitter);
	GetLocalBounds(rect);

	if (fVertical)
		rect.left = splitter.right - 1;
	else
		rect.top = splitter.bottom - 1;
}
Esempio n. 11
0
void TSplitter::GetChild1Rect(TRect& rect) const
{
	TRect	splitter;	
	GetSplitterRect(fRatio, splitter);
	
	GetLocalBounds(rect);

	if (fVertical)
		rect.right = splitter.left;
	else
		rect.bottom = splitter.top;
}
Esempio n. 12
0
void TButton::DoMouseMoved(const TPoint& point, TModifierState state)
{
	if (fTrackingMouse)
	{
		TRect bounds;
		GetLocalBounds(bounds);

		if (bounds.Contains(point) != fPressed)
		{
			fPressed = !fPressed;
			Redraw();
		}
	}
}
Esempio n. 13
0
void AppContainer::DoAnimate()
{
    show_ = !show_;
    for(int i=0; i<child_count(); ++i)
    {
        AppView* child = static_cast<AppView*>(child_at(i));
        if(show_)
        {
            bounds_animator_.AnimateViewTo(child, child->GetSaveBounds());
        }
        else
        {
            gfx::Point target_orign(-child->width(), -child->height());
            gfx::Rect layout_rect = child->bounds();
            gfx::Point app_view_center = layout_rect.CenterPoint();
            gfx::Point view_center = GetLocalBounds().CenterPoint();
            if(app_view_center.x() >= view_center.x() &&
                app_view_center.y() <= view_center.y())
            {
                target_orign.set_x(GetLocalBounds().right());
            }
            else if(app_view_center.x() <= view_center.x() &&
                app_view_center.y() >= view_center.y())
            {
                target_orign.set_y(GetLocalBounds().bottom());
            }
            else if(app_view_center.x() >= view_center.x() &&
                app_view_center.y() >= view_center.y())
            {
                target_orign.set_x(GetLocalBounds().right());
                target_orign.set_y(GetLocalBounds().bottom());
            }
            bounds_animator_.AnimateViewTo(child,
                gfx::Rect(target_orign, child->size()));
        }
    }
}
Esempio n. 14
0
void TScrollBar::GetThumbArea(TRect& r) const
{
	GetLocalBounds(r);

	if (IsVertical())
	{
		r.top = kArrowSize;
		r.bottom -= kArrowSize;
	}
	else
	{
		r.left = kArrowSize;
		r.right -= kArrowSize;
	}
}
Esempio n. 15
0
void TSplitter::GetSplitterRect(float ratio, TRect& rect) const
{
	ASSERT(ratio >= 0.0 && ratio <= 1.0);

	GetLocalBounds(rect);

	if (fVertical)
	{
		rect.left = (TCoord)((rect.GetWidth() - kSplitterWidth) * fRatio);
		rect.right = rect.left + kSplitterWidth;
	}
	else
	{
		rect.top = (TCoord)((rect.GetHeight() - kSplitterWidth) * fRatio);
		rect.bottom = rect.top + kSplitterWidth;
	}
}
Esempio n. 16
0
void TButton::Draw(TRegion* clip)
{
	TDrawContext	context(this, clip);
	
	TRect	r;
	GetLocalBounds(r);

	if (fPressed)
	{
		TGraphicsUtils::DrawPressed3DBorderAndInset(context, r, fDefault);
		context.SetBackColor(kMediumGrayColor);
	}
	else
		TGraphicsUtils::Draw3DBorderAndInset(context, r, fDefault && fEnabled);

	context.SetForeColor(fEnabled ? fForeColor : kDarkGrayColor);
	context.DrawTextBox(fTitle, fTitle.GetLength(), r, kTextAlignCenter);
}
Esempio n. 17
0
void TSplitter::DoMouseMoved(const TPoint& mouse, TModifierState state)
{
	if (fTracking)
	{
		TPoint point;
		ConstrainMouse(mouse, point);

		if ((fVertical && fLastMouse.h != point.h) ||
			(!fVertical && fLastMouse.v != point.v))
		{
			if (fLiveDrag)
			{
				TRect bounds;
				GetLocalBounds(bounds);

				if (fVertical)
					fRatio = (float)point.h / (float)bounds.GetWidth();	
				else
					fRatio = (float)point.v / (float)bounds.GetHeight();
				
				if (fRatio < 0.0)
					fRatio = 0.0;
				else if (fRatio > 1.0)
					fRatio = 1.0;

				ResizeChildren();

				TDrawContext	context(this);
				DrawSplitterRect(context);
			}
			else
			{
				TRect	rect;

				GetTrackingRect(fLastMouse, rect);
				DrawTrackingRect(rect);
				GetTrackingRect(point, rect);
				DrawTrackingRect(rect);
			}
		}

		fLastMouse = point;
	}
}
Esempio n. 18
0
 void SilverlightView::Layout()
 {
     View::Layout();
     gfx::Rect rect = View::ConvertRectToWidget(GetLocalBounds());
     ax_host_->SetRect(rect);
 }
void FGeometryCacheSceneProxy::GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily& ViewFamily, uint32 VisibilityMap, FMeshElementCollector& Collector) const
{
	SCOPE_CYCLE_COUNTER(STAT_GeometryCacheSceneProxy_GetMeshElements);

	// Set up wireframe material (if needed)
	const bool bWireframe = AllowDebugViewmodes() && ViewFamily.EngineShowFlags.Wireframe;

	FColoredMaterialRenderProxy* WireframeMaterialInstance = NULL;
	if (bWireframe)
	{
		WireframeMaterialInstance = new FColoredMaterialRenderProxy(
			GEngine->WireframeMaterial ? GEngine->WireframeMaterial->GetRenderProxy(IsSelected()) : NULL,
			FLinearColor(0, 0.5f, 1.f)
			);

		Collector.RegisterOneFrameMaterialProxy(WireframeMaterialInstance);
	}
	
	// Iterate over sections	
	for (const FGeomCacheTrackProxy* TrackProxy : Sections )
	{
		// QQQ
		if (TrackProxy != nullptr)
		{
			INC_DWORD_STAT_BY(STAT_GeometryCacheSceneProxy_MeshBatchCount, TrackProxy->MeshData->BatchesInfo.Num());

			int32 BatchIndex = 0;
			for (FGeometryCacheMeshBatchInfo& BatchInfo : TrackProxy->MeshData->BatchesInfo)
			{
				FMaterialRenderProxy* MaterialProxy = bWireframe ? WireframeMaterialInstance : TrackProxy->Materials[BatchIndex]->GetRenderProxy(IsSelected());

				for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
				{
					if (VisibilityMap & (1 << ViewIndex))
					{
						const FSceneView* View = Views[ViewIndex];
						// Draw the mesh.
						FMeshBatch& Mesh = Collector.AllocateMesh();
						FMeshBatchElement& BatchElement = Mesh.Elements[0];
						BatchElement.IndexBuffer = &TrackProxy->IndexBuffer;
						Mesh.bWireframe = bWireframe;
						Mesh.VertexFactory = &TrackProxy->VertexFactory;
						Mesh.MaterialRenderProxy = MaterialProxy;
						BatchElement.PrimitiveUniformBuffer = CreatePrimitiveUniformBufferImmediate(TrackProxy->WorldMatrix * GetLocalToWorld(), GetBounds(), GetLocalBounds(), true, UseEditorDepthTest());
						BatchElement.FirstIndex = BatchInfo.StartIndex;
						BatchElement.NumPrimitives = BatchInfo.NumTriangles;
						BatchElement.MinVertexIndex = 0;
						BatchElement.MaxVertexIndex = TrackProxy->VertexBuffer.Vertices.Num() - 1;
						Mesh.ReverseCulling = IsLocalToWorldDeterminantNegative();
						Mesh.Type = PT_TriangleList;
						Mesh.DepthPriorityGroup = SDPG_World;
						Mesh.bCanApplyViewModeOverrides = false;
						Collector.AddMesh(ViewIndex, Mesh);

						INC_DWORD_STAT_BY(STAT_GeometryCacheSceneProxy_TriangleCount, BatchElement.NumPrimitives);
					}
				}

				++BatchIndex;
			}			
		}
		
	}

	// Draw bounds
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
	{
		if (VisibilityMap & (1 << ViewIndex))
		{
			// Render bounds
			RenderBounds(Collector.GetPDI(ViewIndex), ViewFamily.EngineShowFlags, GetBounds(), IsSelected());
		}
	}
#endif
}
Esempio n. 20
0
int main(int argc, char* argv[])
{
    char c;
    int ix, iy, iz, i;
    MPI_Comm mpicomm;
    MPI_Info mpiinfo;
    int mpirank;
    int mpisize;
    double *data3d, *data2d, *x, *y, *z, t;
    int localx, localy, localwidth, localheight;
    int maxwidth, maxheight;
    const char* filename = "output.h5";
    hid_t fileid, plist, filespace, memspace, dimvar, varid;
    hsize_t size[NDIMS], maxsize[NDIMS], chunksize[NDIMS];
    hsize_t start[NDIMS], count[NDIMS];
    char varname[32];

    mpicomm = MPI_COMM_WORLD;
    mpiinfo = MPI_INFO_NULL;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(mpicomm, &mpisize);
    MPI_Comm_rank(mpicomm, &mpirank);

    if(! mpirank) printf("Creating some data...\n");

    // Distribute our data values in a pism-y way
    GetLocalBounds(XSIZE, YSIZE, mpirank, mpisize,
                   &localx, &localy, &localwidth, &localheight);
    printf("Rank%02d: x=%d, y=%d, width=%d, height=%d\n",
           mpirank, localx, localy, localwidth, localheight);

    data2d = (double*)malloc(localwidth * localheight * sizeof(double));
    data3d = (double*)malloc(localwidth * localheight * ZSIZE * sizeof(double));
    x = (double*)malloc(localwidth * sizeof(double));
    y = (double*)malloc(localheight * sizeof(double));
    z = (double*)malloc(ZSIZE * sizeof(double));
    t = 0.0;
    for(ix = 0; ix < localwidth; ix++)
    {
        x[ix] = ix + localx;
        for(iy = 0; iy < localheight; iy++)
        {
            y[iy] = iy + localy;
            data2d[ix*localheight + iy] = (ix+localx)*localheight + iy+localy;
            for(iz = 0; iz < ZSIZE; iz++)
            {
                z[iz] = iz;
                data3d[ix*localheight*ZSIZE + iy*ZSIZE + iz] =
                    (ix+localx)*YSIZE*ZSIZE + (iy+localy)*ZSIZE + iz;
            }
        }
    }

    if(! mpirank) printf("Creating HDF5 file...\n");

    plist = H5Pcreate(H5P_FILE_ACCESS);
    H5Pset_fapl_mpio(plist, mpicomm, mpiinfo);

    // TODO: this seems like a good place to put optimizations, and indeed
    // PISM is adding several additional properties, like setting block sizes,
    // cache eviction policies, fs striping parameters, etc.

    fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
    H5Pclose(plist);

    if(! mpirank) printf("Setting up dimensions...\n");

    if(! mpirank) printf("Creating time dimension...\n");

    // Define the time dimension
    size[0] = 1;
    maxsize[0] = H5S_UNLIMITED;
    chunksize[0] = 1;

    filespace = H5Screate_simple(1, size, maxsize);
    plist = H5Pcreate(H5P_DATASET_CREATE);
    H5Pset_chunk(plist, 1, chunksize);  // It is strictly required to set chunksize when using
    // the low-level api.  Contiguous datasets are not allowed
    // to use the unlimited dimension.
    dimvar = H5Dcreate(fileid, TNAME, H5T_NATIVE_DOUBLE, filespace,
                       H5P_DEFAULT, plist, H5P_DEFAULT);
    H5Pclose(plist);
    H5DSset_scale(dimvar, TNAME);
    H5Dclose(dimvar);
    H5Sclose(filespace);

#ifdef OLD_WRITE_PATTERN
    if(! mpirank) printf("Writing time dimension...\n");
    dimvar = H5Dopen(fileid, TNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, size, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); // TODO: Pism does this, but comments suggest it is questionable
    start[0] = 0;
    count[0] = 1;
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, &t);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);
#endif

    if(! mpirank) printf("Creating x dimension...\n");

    size[0] = XSIZE;

    filespace = H5Screate_simple(1, size, 0);
    dimvar = H5Dcreate(fileid, XNAME, H5T_NATIVE_DOUBLE, filespace,
                       H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    H5DSset_scale(dimvar, XNAME);
    H5Dclose(dimvar);
    H5Sclose(filespace);

#ifdef OLD_WRITE_PATTERN
    if(! mpirank) printf("Writing x dimension...\n");
    dimvar = H5Dopen(fileid, XNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, size, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    start[0] = 0;
    count[0] = XSIZE;
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, x);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);
#endif

    if(! mpirank) printf("Creating y dimension...\n");

    size[0] = YSIZE;

    filespace = H5Screate_simple(1, size, 0);
    dimvar = H5Dcreate(fileid, YNAME, H5T_NATIVE_DOUBLE, filespace,
                       H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    H5DSset_scale(dimvar, YNAME);
    H5Dclose(dimvar);
    H5Sclose(filespace);

#ifdef OLD_WRITE_PATTERN
    if(! mpirank) printf("Writing y dimension...\n");
    dimvar = H5Dopen(fileid, YNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, size, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    start[0] = 0;
    count[0] = YSIZE;
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, y);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);
#endif

    if(! mpirank) printf("Creating z dimension...\n");

    size[0] = ZSIZE;

    filespace = H5Screate_simple(1, size, 0);
    dimvar = H5Dcreate(fileid, ZNAME, H5T_NATIVE_DOUBLE, filespace,
                       H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    H5DSset_scale(dimvar, ZNAME);
    H5Dclose(dimvar);
    H5Sclose(filespace);

#ifdef OLD_WRITE_PATTERN
    if(! mpirank) printf("Writing z dimension...\n");
    dimvar = H5Dopen(fileid, ZNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, size, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    start[0] = 0;
    count[0] = ZSIZE;
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, z);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);
#endif

    if(! mpirank) printf("Defining variables...\n");

    MPI_Allreduce(&localwidth, &maxwidth, 1, MPI_INT, MPI_MAX, mpicomm);
    MPI_Allreduce(&localheight, &maxheight, 1, MPI_INT, MPI_MAX, mpicomm);

    size[TDIM] = 1;
    size[XDIM] = XSIZE;
    size[YDIM] = YSIZE;
    size[ZDIM] = ZSIZE;

    maxsize[TDIM] = H5S_UNLIMITED;
    maxsize[XDIM] = XSIZE;
    maxsize[YDIM] = YSIZE;
    maxsize[ZDIM] = ZSIZE;

    chunksize[TDIM] = 1;
    chunksize[XDIM] = maxwidth;
    chunksize[YDIM] = maxheight;
    chunksize[ZDIM] = ZSIZE;  // Looks like pism might use 1 here...

    for(i = 0; i < NVARS; i++)
    {
        sprintf(varname, "var3d-%02d", i);
        plist = H5Pcreate(H5P_DATASET_CREATE);
        H5Pset_chunk(plist, NDIMS, chunksize);
        filespace = H5Screate_simple(NDIMS, size, maxsize);
        varid = H5Dcreate(fileid, varname, H5T_NATIVE_DOUBLE, filespace,
                          H5P_DEFAULT, plist, H5P_DEFAULT);
        H5Pclose(plist);
        H5Sclose(filespace);
        H5Dclose(varid);

        sprintf(varname, "var2d-%02d", i);
        plist = H5Pcreate(H5P_DATASET_CREATE);
        H5Pset_chunk(plist, NDIMS-1, chunksize);
        filespace = H5Screate_simple(NDIMS-1, size, maxsize);
        varid = H5Dcreate(fileid, varname, H5T_NATIVE_DOUBLE, filespace,
                          H5P_DEFAULT, plist, H5P_DEFAULT);
        H5Pclose(plist);
        H5Sclose(filespace);
        H5Dclose(varid);
    }

#ifndef OLD_WRITE_PATTERN
    if(! mpirank) printf("Writing time dimension...\n");
    start[0] = 0;
    count[0] = 1;
    dimvar = H5Dopen(fileid, TNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, count, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); // TODO: Pism does this, but comments suggest it is questionable
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, &t);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);

    if(! mpirank) printf("Writing x dimension...\n");
    start[0] = 0;
    count[0] = XSIZE;
    dimvar = H5Dopen(fileid, XNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, count, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, x);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);

    if(! mpirank) printf("Writing y dimension...\n");
    start[0] = 0;
    count[0] = YSIZE;
    dimvar = H5Dopen(fileid, YNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, count, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, y);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);

    if(! mpirank) printf("Writing z dimension...\n");
    start[0] = 0;
    count[0] = ZSIZE;
    dimvar = H5Dopen(fileid, ZNAME, H5P_DEFAULT);
    filespace = H5Dget_space(dimvar);
    memspace = H5Screate_simple(1, count, 0);
    plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
    H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
    H5Dwrite(dimvar, H5T_NATIVE_DOUBLE, memspace, filespace, plist, z);
    H5Pclose(plist);
    H5Sclose(filespace);
    H5Sclose(memspace);
    H5Dclose(dimvar);
#endif

    if(! mpirank) printf("Writing variable data...\n");

    for(i = 0; i < NVARS; i++)
    {
        sprintf(varname, "var3d-%02d", i);
        if(! mpirank) printf("Writing %s...\n", varname);
        start[TDIM] = 0;
        start[XDIM] = localx;
        start[YDIM] = localy;
        start[ZDIM] = 0;
        count[TDIM] = 1;
        count[XDIM] = localwidth;
        count[YDIM] = localheight;
        count[ZDIM] = ZSIZE;
        varid = H5Dopen(fileid, varname, H5P_DEFAULT);
        filespace = H5Dget_space(varid);
        memspace = H5Screate_simple(NDIMS, count, 0);
        plist = H5Pcreate(H5P_DATASET_XFER);
        H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
        H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
        H5Dwrite(varid, H5T_NATIVE_DOUBLE, memspace, filespace, plist, data3d);
        H5Pclose(plist);
        H5Sclose(filespace);
        H5Sclose(memspace);
        H5Dclose(varid);

        sprintf(varname, "var2d-%02d", i);
        if(! mpirank) printf("Writing %s...\n", varname);
        start[TDIM] = 0;
        start[XDIM] = localx;
        start[YDIM] = localy;
        count[TDIM] = 1;
        count[XDIM] = localwidth;
        count[YDIM] = localheight;
        varid = H5Dopen(fileid, varname, H5P_DEFAULT);
        filespace = H5Dget_space(varid);
        memspace = H5Screate_simple(NDIMS-1, count, 0);
        plist = H5Pcreate(H5P_DATASET_XFER);
        H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
        H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, 0, count, 0);
        H5Dwrite(varid, H5T_NATIVE_DOUBLE, memspace, filespace, plist, data2d);
        H5Pclose(plist);
        H5Sclose(filespace);
        H5Sclose(memspace);
        H5Dclose(varid);
    }

    if(! mpirank) printf("Closing file...\n");

    H5Fclose(fileid);

    if(! mpirank) printf("Done.\n");

    free(data2d);
    free(data3d);
    free(x);
    free(y);
    free(z);

    MPI_Finalize();

    return 0;
}
void FTangoPointCloudSceneProxy::GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily & ViewFamily, uint32 VisibilityMap, FMeshElementCollector & Collector) const
{
	for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
	{
		if (VisibilityMap & (1 << ViewIndex))
		{
			//Essentially, which camera we are using
			const FSceneView* View = Views[ViewIndex];
			
			//Ask for a new render batch and link it to our data
			FMeshBatch& Mesh = Collector.AllocateMesh();
			Mesh.VertexFactory = &VertexFactory;
			Mesh.MaterialRenderProxy = Material->GetRenderProxy(IsSelected());
			Mesh.ReverseCulling = IsLocalToWorldDeterminantNegative();
			Mesh.DepthPriorityGroup = SDPG_World;
			Mesh.bCanApplyViewModeOverrides = false;
			
			//GL_Points render, still need to work out how to set GL_PointSize
			Mesh.Type = PT_PointList;

			//Tell the render object how to index our data.
			FMeshBatchElement& BatchElement = Mesh.Elements[0];
			BatchElement.IndexBuffer = &IndexBuffer;
			
			//Give all the "default" uniforms to help render. (Transform etc.)
			BatchElement.PrimitiveUniformBuffer = CreatePrimitiveUniformBufferImmediate(GetLocalToWorld(), GetBounds(), GetLocalBounds(), true, UseEditorDepthTest());
			BatchElement.FirstIndex = 0;
			BatchElement.NumPrimitives = IndexBuffer.Indices.Num() / 3;
			BatchElement.MinVertexIndex = 0;
			BatchElement.MaxVertexIndex = VertexBuffer.Vertices.Num() - 1;

			//All done!
			Collector.AddMesh(ViewIndex, Mesh);
		}
	}
}
Esempio n. 22
0
 // Overridden from View:
 void FlashView::OnPaint(gfx::Canvas* canvas)
 {
     HDC dc = canvas->BeginPlatformPaint();
     ax_host_->Draw(dc, GetLocalBounds());
     canvas->EndPlatformPaint();
 }
Esempio n. 23
0
File: Text.cpp Progetto: EugenT/SFML
FloatRect Text::GetGlobalBounds() const
{
    return GetTransform().TransformRect(GetLocalBounds());
}
Esempio n. 24
0
void TWindow::GetRootBounds(TRect& bounds) const
{
	GetLocalBounds(bounds);
	LocalToRoot(bounds);
}
Esempio n. 25
0
 // Overridden from View:
 void WebBrowserView::Layout()
 {
     View::Layout();
     gfx::Rect rect = View::ConvertRectToWidget(GetLocalBounds());
     ax_host_->SetRect(rect);
 }
Esempio n. 26
0
sf::FloatRect BigSprite::GetGlobalBounds() const
{
	return getTransform().transformRect(GetLocalBounds());
}