/// <summary> /// Set of lines in 3D space. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale">Scaling the field extent.</param> /// <param name="field"></param> public LineBall(Plane plane, LineSet lines, RenderEffect effect = RenderEffect.DEFAULT, Colormap colormap = Colormap.Parula, bool flatten = false) { _thickness = lines.Thickness * plane.PointSize; _color = lines.Color; this._vertexSizeBytes = Marshal.SizeOf(typeof(Vector4)); this._numVertices = lines.NumPoints * 2 - lines.Lines.Length * 2; // Linelist means, all points are there twice, minus the endpoints. if (_numVertices == 0) return; this._topology = PrimitiveTopology.LineList; // Setting up the vertex buffer. if (!flatten) GenerateGeometry(plane, lines); else GenerateGeometryFlatXY(plane, lines); //this._technique = _lineEffect.GetTechniqueByName("Render"); UsedMap = colormap; _planeNormal = plane.ZAxis; _planeNormal.Normalize(); _effect = _lineEffect; SetRenderEffect(effect); this._vertexLayout = new InputLayout(_device, _technique.GetPassByIndex(0).Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0), new InputElement("SCALAR", 0, Format.R32_Float, 12, 0) }); }
/// <summary> /// Plane to display scalar/vector field data on. Condition: Fields domain is 2D. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale">Scaling the field extent.</param> /// <param name="field"></param> public FieldPlane(Plane plane, VectorField fields, RenderEffect effect = RenderEffect.DEFAULT, Colormap map = Colormap.Parula) { #if DEBUG // Assert that the fields are 2 dimensional. foreach(Field field in fields.Scalars) System.Diagnostics.Debug.Assert(field.Size.Length >= 2); #endif this._effect = _planeEffect; this._vertexSizeBytes = 32; this._numVertices = 6; this.UsedMap = map; this._width = fields[0].Size[0]; this._height = fields[0].Size[1]; this._invalid = fields.InvalidValue ?? float.MaxValue; this._field = fields; // Setting up the vertex buffer. GenerateGeometry(plane, fields[0].Size.ToInt2(), fields.TimeSlice??0); // Generating Textures from the fields. _fieldTextures = new ShaderResourceView[fields.Scalars.Length]; for(int f = 0; f < _field.NumVectorDimensions; ++f) { Texture2D tex = ColorMapping.GenerateTextureFromField(_device, fields[f]); _fieldTextures[f] = new ShaderResourceView(_device, tex); } this.SetRenderEffect(effect); this._vertexLayout = new InputLayout(_device, _technique.GetPassByIndex(0).Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), new InputElement("TEXTURE", 0, Format.R32G32B32A32_Float, 16, 0) }); }
public LineStatisticsMapper(VectorFieldUnsteady velocity, Plane plane) : base(plane, velocity.Size.ToInt2()) { Velocity = velocity; Mapping = ComputeStatistics; Plane = plane; int time = velocity.Size.T; }
public CriticalPointTracking(CriticalPointSet2D[] cp, VectorFieldUnsteady velocity, Plane plane) { Debug.Assert(cp.Length == velocity.Size.T); CP = cp; Velocity = velocity; SlicesToRender = new VectorField[velocity.Size.T]; for (int slice = 0; slice < velocity.Size.T; ++slice) { SlicesToRender[slice] = velocity.GetSlice(slice); } Mapping = TrackCP; Plane = plane; }
/// <summary> /// Set of points in 3D space. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale">Scaling the field extent.</param> /// <param name="field"></param> public PointCloud(Plane plane, PointSet<Point> points) { this._vertexSizeBytes = 32; this._numVertices = points.Points.Length; if (_numVertices == 0) return; this._topology = PrimitiveTopology.PointList; // Setting up the vertex buffer. GenerateGeometry(plane, points); Debug.Assert(_cloudEffect != null); this._technique = _cloudEffect.GetTechniqueByName("Render"); this._vertexLayout = new InputLayout(_device, _technique.GetPassByIndex(0).Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), new InputElement("COLOR", 0, Format.R32G32B32_Float, 16, 0), new InputElement("RADIUS", 0, Format.R32_Float, 28, 0) }); }
//private Buffer _indices; /// <summary> /// Set of lines in 3D space. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale">Scaling the field extent.</param> /// <param name="field"></param> public Mesh(Plane plane, TileSurface surf, RenderEffect effect = RenderEffect.DEFAULT, Colormap colormap = Colormap.Parula) { _color = surf.Color; this._vertexSizeBytes = Marshal.SizeOf(typeof(Vector4)); this._topology = PrimitiveTopology.TriangleList; this. // Setting up the vertex buffer. UsedMap = colormap; _planeNormal = plane.ZAxis; _planeNormal.Normalize(); _effect = _meshEffect; SetRenderEffect(effect); GenerateGeometry(plane, surf); this._vertexLayout = new InputLayout(_device, _technique.GetPassByIndex(0).Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0), new InputElement("SCALAR", 0, Format.R32_Float, 12, 0) }); }
public PathlineLengthMapper(VectorFieldUnsteady velocity, Plane plane) : base(plane, velocity.Size.ToInt2()) { Velocity = velocity; Mapping = ShowPaths; Plane = plane; int time = velocity.Size.T; _intersectTimeSlices = new PointSet<EndPoint>[time]; _pathlineSegments = new LineSet[time - 1]; _intersectTimeSlices[0] = FieldAnalysis.ValidDataPoints<EndPoint>(velocity.GetTimeSlice(0));//FieldAnalysis.SomePoints2D<EndPoint>(velocity, 100);// _points = new PointCloud[velocity.Size.T]; _points[0] = new PointCloud(Plane, _intersectTimeSlices[0].ToBasicSet()); _fieldPositionOfValidCell = new int[_intersectTimeSlices[0].Length]; for(int i = 0; i < _fieldPositionOfValidCell.Length; ++i) { Vector3 pos = _intersectTimeSlices[0].Points[i].Position; _fieldPositionOfValidCell[i] = (int)(pos.X + 0.5) + (int)(pos.Y + 0.5) * Velocity.Size[0]; } }
public FieldPlane(Plane plane, Texture2D field, Int2 texSize, float timeSlice = 0, float invalidValue = float.MaxValue, RenderEffect effect = RenderEffect.DEFAULT, Colormap map = Colormap.Parula) { this._effect = _planeEffect; this._vertexSizeBytes = 32; this._numVertices = 6; this.UsedMap = map; this._width = texSize.X; this._height = texSize.Y; this._invalid = invalidValue; // Setting up the vertex buffer. GenerateGeometry(plane, texSize, timeSlice); // Generating Textures from the fields. _fieldTextures = new ShaderResourceView[1]; _fieldTextures[0] = new ShaderResourceView(_device, field); this.SetRenderEffect(effect); this._vertexLayout = new InputLayout(_device, _technique.GetPassByIndex(0).Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), new InputElement("TEXTURE", 0, Format.R32G32B32A32_Float, 16, 0) }); }
public PlaygroundMapper(Plane plane) : base(new Plane(plane, 1), new Int2(NUM_CELLS)) { Mapping = Map; _velocity = Tests.CreateBowl(new Vec2(NUM_CELLS/2, 0), NUM_CELLS, new Vec2(-10, 0), 22, 200); _selections = new List<LineBall>(10); _selectionsAngle = new List<LineBall>(10); _steadySelection = new List<LineBall>(10); // Core. _core = new Line() { Positions = new Vector3[] { new Vector3(50, 100, 0), new Vector3(155, 100, _velocity.Size.T-1) } }; LineSet set = new LineSet(new Line[] { _core }) { Color = new Vector3(0.2f) }; set.Thickness *= 3; _coreBall = new LineBall(plane, set, LineBall.RenderEffect.DEFAULT); // Straight core. set = new LineSet(new Line[] { new Line() { Positions = new Vector3[] { _core[0], _core[0] + Vector3.UnitZ * (_velocity.Size.T - 1) } } }) { Color = new Vector3(0.2f) }; set.Thickness *= 3; _straightCoreBall = new LineBall(Plane, set); var center = Tests.CreatePerfect(new Vec2(0, 0), NUM_CELLS, new Vec2(0), 1, 200); _steadyField = center.GetTimeSlice(0); //[0] as ScalarField; }
public SubstepViewer(Plane plane) { //_ranges = ranges; _fields = new FieldPlane[1]; Plane = plane; Mapping = LoadMembers; }
public override void EndSelection(Vector2[] points) { base.EndSelection(points); // When currently a subrange is selected, switch to full range on click. if (_subrange) { _startPoint += _minPlane; _algorithm.CompleteRange(_startPoint); _subrangePlane = Plane; } // Select subrange. else { Vector2 minV = new Vector2( Math.Min(points[0].X, points[1].X), Math.Min(points[0].Y, points[1].Y)); // Int2 values. Int2 min = (Int2)minV; Vector2 maxV = points[0] + points[1] - minV; Int2 max = (Int2)maxV; min = Int2.Max(min, new Int2(0)).AsInt2(); min = Int2.Min(min, _globalMaxPlane).AsInt2(); max = Int2.Min(max, _globalMaxPlane).AsInt2(); max = Int2.Max((Int2)max, new Int2(0)).AsInt2(); if (min.X - max.X == 0 || min.Y - max.Y == 0) { return; } _startPoint = _startPoint - min; if (!_startPoint.IsPositive() || _startPoint > max - min) _startPoint = (max - min) / 2; _algorithm.Subrange(min, max - min, _startPoint); _subrangePlane = new Plane(Plane, new Vector3(min.X, min.Y, 0)); _minPlane = min; _maxPlane = max; } _subrange = !_subrange; }
public SelectionMapper(Plane plane, Int2 fieldSize2D) { Plane = plane; _subrangePlane = Plane; _maxPlane = fieldSize2D; _globalMaxPlane = fieldSize2D; }
public List<Renderable> AdvectLines() { List<Renderable> renderables = new List<Renderable>(3 + _currentSetting.LineX); int numLines = _currentSetting.LineX; // Update / create underlying plane. if (_lastSetting == null || SliceTimeMainChanged) { _timeSlice = new FieldPlane(Plane, _velocity.GetTimeSlice(_currentSetting.SliceTimeMain), _currentSetting.Shader, _currentSetting.Colormap); _intersectionPlane = new Plane(_intersectionPlane, new Vector3(0, 0, _currentSetting.SliceTimeMain - (_lastSetting?.SliceTimeMain) ?? 0)); } else if (ColormapChanged || ShaderChanged) { _timeSlice.SetRenderEffect(_currentSetting.Shader); _timeSlice.UsedMap = _currentSetting.Colormap; } // First item in list: plane. renderables.Add(_timeSlice); // Add Point to indicate clicked position. renderables.Add(new PointCloud(Plane, new PointSet<Point>(new Point[] { new Point() { Position = new Vector3(_selection, _currentSetting.SliceTimeMain + _velocity.Grid.TimeOrigin ?? 0), Color = new Vector3(1, 0, 1), Radius = 0.5f } }))); bool rebuilt = false; // Recompute lines if necessary. if (_lastSetting == null || LineXChanged || AlphaStableChanged || StepSizeChanged || IntegrationTypeChanged || IntegrationTimeChanged || FlatChanged || _selectionChanged) { if (_velocity.IsValid((Vec2)_selection)) { // Compute starting positions. Point[] circle = new Point[numLines]; float offset = _currentSetting.AlphaStable; float angleDiff = 2 * (float)(Math.PI / numLines); for (int dir = 0; dir < numLines; ++dir) { float x = (float)(Math.Sin(angleDiff * dir + Math.PI / 2)); float y = (float)(Math.Cos(angleDiff * dir + Math.PI / 2)); circle[dir] = new Point() { Position = new Vector3(_selection.X + x * offset, _selection.Y + y * offset, _currentSetting.SliceTimeMain + (_velocity.Grid.TimeOrigin ?? 0)) }; } VectorField.Integrator integrator = VectorField.Integrator.CreateIntegrator(_velocity, _currentSetting.IntegrationType); integrator.StepSize = _currentSetting.StepSize; //bool pos = _velocity.SampleDerivative(new Vec3((Vec2)_selection, _currentSetting.SliceTimeMain)).EigenvaluesReal()[0] > 0; //integrator.Direction = pos ? Sign.POSITIVE : Sign.NEGATIVE; LineSet[] lineSets = integrator.Integrate<Point>(new PointSet<Point>(circle), true); /*, _currentSetting.AlphaStable * 10); PointSet<EndPoint> ends = lineSets[0].GetEndPoints(); lineSets[0] = integrator.Integrate(ends, false)[0]; ends = lineSets[1].GetEndPoints(); lineSets[1] = integrator.Integrate(ends, false)[0];*/ // COmpute and show statistics. if (_currentSetting.Flat) { lineSets[0].FlattenLines(_currentSetting.SliceTimeMain); lineSets[1].FlattenLines(_currentSetting.SliceTimeMain); _graph = new Renderable[0]; // Compute values (distance to start point). foreach (LineSet lines in lineSets) { Line[] starLines = new Line[lines.Lines.Length]; int count = 0; float[] values = new float[lines.NumExistentPoints]; for (int l = 0; l < lines.Lines.Length; ++l) { Line line = lines.Lines[l]; // Outgoing direction. Vector3 start = line.Positions[0]; Vector3 dir = line.Positions[0] - new Vector3(_selection, line.Positions[0].Z); ; dir.Normalize(); // Scale such that step size does not scale. dir *= _currentSetting.StepSize / _velocity.Size.T * 40; // Write star coordinates here. Vector3[] starPos = new Vector3[line.Length]; for (int p = 0; p < line.Length; ++p) { values[count++] = new Vector2(line.Positions[p].X - _selection.X, line.Positions[p].Y - _selection.Y).Length(); starPos[p] = start + p * dir; } starLines[l] = new Line() { Positions = starPos }; } var graph = FieldAnalysis.BuildGraph(Plane, new LineSet(starLines), values, _currentSetting.IntegrationTime, _currentSetting.LineSetting, _currentSetting.Colormap); _graph = graph.Concat(_graph).ToArray(); } } else _graph = null; _pathlines = new LineBall[] { new LineBall(Plane, lineSets[0]), new LineBall(Plane, lineSets[1]) }; } _selectionChanged = false; rebuilt = true; } if (_graph != null && _currentSetting.LineSetting == RedSea.DisplayLines.LINE && ( _lastSetting == null || rebuilt || WindowWidthChanged || WindowStartChanged || ColormapChanged)) { foreach (Renderable ball in _graph) { (ball as LineBall).LowerBound = _currentSetting.WindowStart + _currentSetting.AlphaStable * _currentSetting.IntegrationTime + _currentSetting.SliceTimeMain; (ball as LineBall).UpperBound = _currentSetting.WindowStart + _currentSetting.AlphaStable * _currentSetting.IntegrationTime + _currentSetting.SliceTimeMain + _currentSetting.WindowWidth; (ball as LineBall).UsedMap = _currentSetting.Colormap; } } // Add the lineball. if (_pathlines != null) renderables.AddRange(_pathlines); if (_graph != null && _currentSetting.Graph) renderables = renderables.Concat(_graph.ToList()).ToList(); return renderables; }
public Plane(Plane cpy) { Origin = cpy.Origin; XAxis = cpy.XAxis; YAxis = cpy.YAxis; ZAxis = cpy.ZAxis; PointSize = cpy.PointSize; }
public ConcentricDistanceMapper(int everyNthField, Plane plane) : base(everyNthField, plane) { Mapping = Map; }
protected override void UpdateBoundary() { if (_lastSetting != null && (_rebuilt || FlatChanged || GraphChanged)) { Graph2D[] dist = FieldAnalysis.GraphDifferenceForward(_distanceAngleGraph); Plane zPlane = new Plane(_graphPlane, Vector3.UnitZ * 2); _graph = new LineBall(_graphPlane, FieldAnalysis.WriteGraphToSun(_errorGraph, new Vector3(_selection.X, _selection.Y, 0)), LineBall.RenderEffect.HEIGHT, Colormap, Flat); // _graph = new LineBall(zPlane, FieldAnalysis.WriteGraphsToCircles(dist, new Vector3(_selection.X, _selection.Y, SliceTimeMain)), LineBall.RenderEffect.HEIGHT, Colormap, false); _rebuilt = false; } if (_lastSetting != null && (IntegrationTimeChanged || _rebuilt || Graph && GraphChanged && Flat)) BuildGraph(); //_graph = new LineBall(_graphPlane, FieldAnalysis.WriteGraphToSun(_errorGraph, new Vector3(_selection.X, _selection.Y, 0)), LineBall.RenderEffect.HEIGHT, Colormap, false); // new LineBall(_graphPlane, FieldAnalysis.WriteGraphsToCircles(_distanceAngleGraph, new Vector3(_selection.X, _selection.Y, SliceTimeMain)), LineBall.RenderEffect.HEIGHT, Colormap, false); //LineSet cutLines; ////if (SliceTimeReference > SliceTimeMain) ////{ //// // _graph = cut version of _coreAngleGraph. //// int length = SliceTimeReference - SliceTimeMain; //// length = (int)((float)length / StepSize + 0.5f); //// cutLines = FieldAnalysis.CutLength(new LineSet(_coreDistanceGraph), length); ////} ////else //// cutLines = new LineSet(_coreDistanceGraph); //cutLines = new LineSet(FieldAnalysis.); //_graph = new LineBall[] { new LineBall(_graphPlane, cutLines, LineBall.RenderEffect.HEIGHT, Colormap) }; }
/// <summary> /// Setting up the vertex buffer. Vertex size and number has to be known. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale"></param> protected void GenerateGeometry(Plane plane, Int2 size, float timeOffset) { SetToSubrange(plane, size, Vector3.Zero, (Vector3)(Vector)size, timeOffset); //Vector Extent = grid.Extent; //Vector3 maximum = plane.Origin + plane.XAxis * (Extent[0] + grid.Origin[0]) + plane.YAxis * (Extent[1] + grid.Origin[1]); //Vector3 origin = plane.Origin + plane.ZAxis * timeOffset + plane.XAxis * grid.Origin[0] + plane.YAxis * grid.Origin[1]; //// Offset, becaue the grid data points shall be OUTSIDE of the grid cells. //float uMin = 1.0f / (grid.Size[0] - 1) * 0.5f; //float vMin = 1.0f / (grid.Size[1] - 1) * 0.5f; //float uMax = 1 - uMin; //float vMax = 1 - vMin; //// Write poition and UV-map data. //var stream = new DataStream(_numVertices * _vertexSizeBytes, true, true); //stream.WriteRange(new[] { // new Vector4( origin[0], maximum[1], origin[2], 1.0f), new Vector4(uMin, vMax, 0.0f, 1.0f), // new Vector4(maximum[0], maximum[1], origin[2], 1.0f), new Vector4(uMax, vMax, 0.0f, 1.0f), // new Vector4(maximum[0], origin[1], origin[2], 1.0f), new Vector4(uMax, vMin, 0.0f, 1.0f), // new Vector4( origin[0], maximum[1], origin[2], 1.0f), new Vector4(uMin, vMax, 0.0f, 1.0f), // new Vector4(maximum[0], origin[1], origin[2], 1.0f), new Vector4(uMax, vMin, 0.0f, 1.0f), // new Vector4( origin[0], origin[1], origin[2], 1.0f), new Vector4(uMin, vMin, 0.0f, 1.0f) //}); //stream.Position = 0; //// Create and fill buffer. //_vertices = new Buffer(_device, stream, new BufferDescription() //{ // BindFlags = BindFlags.VertexBuffer, // CpuAccessFlags = CpuAccessFlags.None, // OptionFlags = ResourceOptionFlags.None, // SizeInBytes = _numVertices * _vertexSizeBytes, // Usage = ResourceUsage.Default //}); //stream.Dispose(); }
public LocalDiffusionMapper(VectorFieldUnsteady velocity, Plane plane) : base(plane, velocity.Size.ToInt2()) { _diffusionMap = new LocalDiffusion(velocity, 0, 0.3f); _algorithm = _diffusionMap; // _ftleMap = new FTLE(velocity, 0, 0.3f); Plane = plane; _subrangePlane = Plane; Mapping = GetCurrentMap; _velocity = velocity; _maxPlane = velocity.Size.ToInt2(); }
public FlowMapMapper(LoaderNCF.SliceRange[] uv, Plane plane, VectorFieldUnsteady velocity) : base(plane, velocity.Size.ToInt2()) { _flowMap = new FlowMapUncertain(_startPoint, uv, 0, 9); _algorithm = _flowMap; Plane = plane; _subrangePlane = Plane; Mapping = GetCurrentMap; _velocity = velocity; _maxPlane = velocity.Size.ToInt2(); }
public DiffusionMapper(VectorFieldUnsteady velocity, Plane plane) : base(plane, velocity.Size.ToInt2()) { _diffusionMap = new CutDiffusion(velocity, 0, 0.3f); _algorithm = _diffusionMap; Plane = plane; _subrangePlane = Plane; Mapping = GetCurrentMap; _velocity = velocity; _maxPlane = velocity.Size.ToInt2(); _scaledPlane = new Plane(_subrangePlane.Origin, _subrangePlane.XAxis, _subrangePlane.YAxis, _subrangePlane.ZAxis, 1.0f/_cellToSeedRatio, _subrangePlane.PointSize); }
public static void LoadData() { System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; Console.WriteLine("Output works."); Console.WriteLine("Using " + (Environment.Is64BitProcess ? "x64" : "x32")); bool loadData = true; int numTimeSlices = 60; RedSea.Singleton.NumTimeSlices = numTimeSlices; //string locDataFolder = "E:/Anke/Dev/Data/Shaheen_8/s"; //"E:/Anke/Dev/Data/First/s"; //string locFileName = "/Posterior_Diag.nc"; //string locFolderName = "/advance_temp"; //string locWFileName = ".0000000108.data"; RedSea.Singleton.GetLoader = RedSeaLoader; //= (step, substep, var) => locDataFolder + (step + 1) + ((substep == null)?(var == RedSea.Variable.VELOCITY_Z? "/W" + locWFileName : locFileName) : (locFolderName + substep) + "/" + "S" + locWFileName); RedSea.Singleton.GetFilename = RedSeaFilenames; RedSea.Singleton.DonutFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Donut"; RedSea.Singleton.CoreFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Core"; RedSea.Singleton.SnapFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Screenshots/"; RedSea.Singleton.RingFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Rings/"; //Tests.CopyBeginningOfFile(RedSea.Singleton.GetFilename(0), 100000); //LoaderNCF ncFile = RedSea.Singleton.GetLoaderNCF(0); //ScalarField[] u = new ScalarField[numTimeSlices]; //LoaderNCF.SliceRange sliceU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X); //sliceU.SetMember(RedSea.Dimension.MEMBER, 0); // Average //sliceU.SetMember(RedSea.Dimension.TIME, 0); //sliceU.SetMember(RedSea.Dimension.CENTER_Z, 0); ////sliceU.SetRange(RedSea.Dimension.GRID_X, 300, 100); ////sliceU.SetRange(RedSea.Dimension.CENTER_Y, 20, 100); //ScalarField[] v = new ScalarField[numTimeSlices]; //LoaderNCF.SliceRange sliceV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y); //sliceV.SetMember(RedSea.Dimension.MEMBER, 0); //sliceV.SetMember(RedSea.Dimension.TIME, 0); //sliceV.SetMember(RedSea.Dimension.CENTER_Z, 0); ////sliceV.SetRange(RedSea.Dimension.CENTER_X, 300, 100); ////sliceV.SetRange(RedSea.Dimension.GRID_Y, 20, 100); //ensembleU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X); //ensembleU.SetMember(RedSea.Dimension.TIME, 0); //ensembleU.SetMember(RedSea.Dimension.CENTER_Z, 0); //ensembleU.SetRange(RedSea.Dimension.MEMBER, 2, 50); ////ensembleU.SetRange(RedSea.Dimension.GRID_X, 100, 160); ////ensembleU.SetRange(RedSea.Dimension.CENTER_Y, 10, 70); //ensembleV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y); //ensembleV.SetMember(RedSea.Dimension.TIME, 0); //ensembleV.SetMember(RedSea.Dimension.CENTER_Z, 0); //ensembleV.SetRange(RedSea.Dimension.MEMBER, 2, 50); ////ensembleV.SetRange(RedSea.Dimension.CENTER_X, 100, 160); ////ensembleV.SetRange(RedSea.Dimension.GRID_Y, 10, 70); Loader.SliceRange rawU = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_X); rawU.SetMember(RedSea.Dimension.GRID_Z, 0); rawU.SetMember(RedSea.Dimension.MEMBER, 0); rawU.SetMember(RedSea.Dimension.SUBTIME, 0); Loader.SliceRange rawV = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_Y); rawV.SetMember(RedSea.Dimension.GRID_Z, 0); rawV.SetMember(RedSea.Dimension.MEMBER, 0); rawV.SetMember(RedSea.Dimension.SUBTIME, 0); //rawU.SetMember(RedSea.Dimension.TIME, 40); //rawV.SetMember(RedSea.Dimension.TIME, 40); //ncFile.Close(); //if (loadData) //{ // //velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { sliceU, sliceV }, 0, numTimeSlices); // velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { rawU, rawV }); // // Scale the field from m/s to (0.1 degree per 3 days). // velocity.ScaleToGrid(new Vec2(RedSea.Singleton.TimeScale)); //} //else //{ // velocity = Tests.CreateCircle(new Vec2(0), 100, new Vec2(0/*.2f*/), numTimeSlices, 8); // //velocity = Tests.CreatePathlineSpiral(99, 100, 2); // velocity.ScaleToGrid(new Vec2(RedSea.Singleton.DomainScale)); //} Console.WriteLine("Completed loading data."); CriticalPointSet2D[] cps = new CriticalPointSet2D[numTimeSlices]; for (int time = 0; time < numTimeSlices; ++time) { // cps[time] = FieldAnalysis.ComputeCriticalPointsRegularSubdivision2D(velocity.GetTimeSlice(time), 5, 0.3f); // cps[time].SelectTypes(new CriticalPoint2D.TypeCP[] { CriticalPoint2D.TypeCP.ATTRACTING_FOCUS, CriticalPoint2D.TypeCP.REPELLING_FOCUS }).ToBasicSet(); Console.WriteLine("Completed processing step " + time + '.'); } redSea = new Plane(new Vector3(-10, -3, -5), Vector3.UnitX * 0.1f, Vector3.UnitY * 0.1f, -Vector3.UnitZ, 0.4f/*10f/size*/, 0.1f); // mapperCP = new CriticalPointTracking(cps, velocity, redSea); //Console.WriteLine("Found CP."); //mapperPathCore = new PathlineCoreTracking(velocity, redSea); //Console.WriteLine("Found Pathline Cores."); mapperComparison = new MemberComparison(/*new LoaderNCF.SliceRange[] { sliceU, sliceV },*/ redSea); if (velocity != null) { mapperOW = new OkuboWeiss(velocity, redSea); Console.WriteLine("Computed Okubo-Weiss."); } Console.WriteLine("Computed all data necessary."); }
public Plane(Plane cpy, Vector3 offset) { Origin = cpy.Origin + offset.X * cpy.XAxis + offset.Y * cpy.YAxis + offset.Z * cpy.ZAxis; XAxis = cpy.XAxis; YAxis = cpy.YAxis; ZAxis = cpy.ZAxis; PointSize = cpy.PointSize; }
public ConcentricDifference(int everyNthField, Plane plane) : base(everyNthField, plane) { Mapping = Map; }
public PathlineCoreTracking(VectorFieldUnsteady velocity, /*VectorField fffPos, VectorField fffNeg,*/ Plane plane) { Velocity = new VectorField(velocity, FieldAnalysis.PathlineCore, 3); CP = new CriticalPointSet2D[velocity.Size.T]; for (int slice = 0; slice < velocity.Size.T; ++slice) { CP[slice] = FieldAnalysis.ComputeCriticalPointsRegularSubdivision2D(Velocity.GetSlicePlanarVelocity(slice), 5, 0.3f); } // Render original field. SlicesToRender = new VectorField[velocity.Size.T]; for (int slice = 0; slice < velocity.Size.T; ++slice) { SlicesToRender[slice] = Velocity.GetSlice(slice); } Mapping = TrackCP; Plane = plane; }
public ConcentricTubeMapper(int everyNthField, Plane plane) : base(everyNthField, plane) { Mapping = Map; Plane = new Plane(Plane, 12); }
// : base(plane, velocity.Size.ToInt2()) public PathlineRadius(VectorFieldUnsteady velocity, Plane plane) { _velocity = velocity; Plane = plane; _intersectionPlane = new Plane(Plane, (velocity.TimeSlice ?? 0) * Plane.ZAxis); Mapping = AdvectLines; }
public MemberComparison(/*LoaderNCF.SliceRange[] ranges,*/ Plane plane) { //Debug.Assert(ranges.Length == 2); //_ranges = ranges; _fields = new FieldPlane[2]; Plane = plane; Mapping = LoadMembers; //LoaderNCF ncFile = RedSea.Singleton.GetLoaderNCF(0); //int sizeVar = ncFile.GetNumVariables(); //_variableRanges = new LoaderNCF.SliceRange[sizeVar]; ////LoaderNCF.SliceRange ensembleU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X); ////ensembleU.SetMember(RedSea.Dimension.TIME, 0); ////LoaderNCF.SliceRange ensembleV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y); ////ensembleV.SetMember(RedSea.Dimension.TIME, 0); ////LoaderNCF.SliceRange ensembleSal = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.SALINITY); ////ensembleSal.SetMember(RedSea.Dimension.TIME, 0); ////LoaderNCF.SliceRange ensembleTemp = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.TEMPERATURE); ////ensembleTemp.SetMember(RedSea.Dimension.TIME, 0); ////LoaderNCF.SliceRange ensembleHeight = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.SURFACE_HEIGHT); ////ensembleHeight.SetMember(RedSea.Dimension.TIME, 0); ////_variableRanges[(int)RedSea.Variable.VELOCITY_X] = ensembleU; ////_variableRanges[(int)RedSea.Variable.VELOCITY_Y] = ensembleV; ////_variableRanges[(int)RedSea.Variable.SALINITY] = ensembleSal; ////_variableRanges[(int)RedSea.Variable.TEMPERATURE] = ensembleTemp; ////_variableRanges[(int)RedSea.Variable.SURFACE_HEIGHT] = ensembleHeight; //_variableRange = new LoaderRaw.SliceRangeRaw(); //_variableRange.SetMember(RedSea.Dimension.TIME, 0); _loader = new LoaderRaw(); _loader.Range.SetMember(RedSea.Dimension.SUBTIME, 0); //ncFile.Close(); }
public Plane(Plane cpy, float zScale) { Origin = cpy.Origin; XAxis = cpy.XAxis; YAxis = cpy.YAxis; ZAxis = cpy.ZAxis * zScale; PointSize = cpy.PointSize; }
/// <summary> /// Setting up the vertex buffer. Vertex size and number has to be known. /// </summary> /// <param name="origin"></param> /// <param name="xAxis"></param> /// <param name="yAxis"></param> /// <param name="scale"></param> protected void GenerateGeometry(Plane plane, PointSet<Point> points) { // Write poition and UV-map data. var stream = new DataStream(_numVertices * _vertexSizeBytes, true, true); Vector3 zAxis = plane.ZAxis; foreach(Point point in points.Points) { var test = new Vector4(plane.Origin + (plane.XAxis * point.Position[0] + plane.YAxis * point.Position[1] + zAxis * point.Position[2]), 1.0f); stream.Write(new Vector4(plane.Origin + (plane.XAxis * point.Position[0] + plane.YAxis * point.Position[1] + zAxis * point.Position[2]), 1.0f)); stream.Write(point.Color); stream.Write(point.Radius * plane.PointSize); } stream.Position = 0; // Create and fill buffer. _vertices = new Buffer(Renderable._device, stream, new BufferDescription() { BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None, SizeInBytes = _numVertices * _vertexSizeBytes, Usage = ResourceUsage.Default }); stream.Dispose(); }
public OkuboWeiss(VectorFieldUnsteady velocity, Plane plane) { Debug.Assert(velocity.NumVectorDimensions == 2 + 1); _fieldOW = velocity; Plane = plane; Mapping = GetTimeSlice; }