ISAAR.MSolve.IGA/Postprocessing/ParaviewNurbs3D.cs
/// <summary>
/// Creates Paraview File of the 3D NURBS geometry.
/// </summary>
Creates Paraview File of the 3D NURBS geometry.
Creates Paraview File of the 3D NURBS geometry .
public void CreateParaviewFile()
		{
			var uniqueKnotsKsi = _model.PatchesDictionary[0].KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity();
			var uniqueKnotsHeta = _model.PatchesDictionary[0].KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity();
			var uniqueKnotsZeta = _model.PatchesDictionary[0].KnotValueVectorZeta.RemoveDuplicatesFindMultiplicity();
			var numberOfKnotsKsi = uniqueKnotsKsi[0].Length;
			var numberOfKnotsHeta = uniqueKnotsHeta[0].Length;
			var numberOfKnotsZeta = uniqueKnotsZeta[0].Length;
			var knots = new double[numberOfKnotsKsi * numberOfKnotsHeta * numberOfKnotsZeta, 3];
			var count = 0;
			var patch = _model.PatchesDictionary[0];
			var projectiveControlPoints = CalculateProjectiveControlPoints();
			for (int knotKsiIndex = 0; knotKsiIndex < numberOfKnotsKsi; knotKsiIndex++)
			{
				for (int knotHetaIndex = 0; knotHetaIndex < numberOfKnotsHeta; knotHetaIndex++)
				{
					for (int knotZetaIndex = 0; knotZetaIndex < numberOfKnotsZeta; knotZetaIndex++)
					{
						var ksiCoordinate = uniqueKnotsKsi[0][knotKsiIndex];
						var hetaCoordinate = uniqueKnotsHeta[0][knotHetaIndex];
						var zetaCoordinate = uniqueKnotsZeta[0][knotZetaIndex];
						var point3D = SolidPoint3D(
							patch.NumberOfControlPointsKsi - 1, patch.DegreeKsi, patch.KnotValueVectorKsi,
							patch.NumberOfControlPointsHeta - 1, patch.DegreeHeta, patch.KnotValueVectorHeta,
							patch.NumberOfControlPointsZeta - 1, patch.DegreeZeta, patch.KnotValueVectorZeta,
							projectiveControlPoints, ksiCoordinate, hetaCoordinate, zetaCoordinate);
						knots[count, 0] = point3D[0] / point3D[3];
						knots[count, 1] = point3D[1] / point3D[3];
						knots[count++, 2] = point3D[2] / point3D[3];
					}
				}
			}
			var numberOfElements = (numberOfKnotsKsi - 1) * (numberOfKnotsHeta - 1) * (numberOfKnotsZeta - 1);
			var elementConnectivity = new int[numberOfElements, 8];
			foreach (var element in _model.Elements)
				for (int i = 0; i < element.KnotsDictionary.Count; i++)
					elementConnectivity[element.ID, i] = element.Knots.ToArray()[i].ID;
			var knotDisplacements = new double[knots.GetLength(0), 3];
			foreach (var element in _model.Elements)
			{
				var localDisplacements = Matrix.CreateZero(element.ControlPointsDictionary.Count, 3);
				var counterCP = 0;
				foreach (var controlPoint in element.ControlPoints)
				{
					localDisplacements[counterCP, 0] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationX))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationX]];
					localDisplacements[counterCP, 1] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationY))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationY]];
					localDisplacements[counterCP, 2] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationZ))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationZ]];
					counterCP++;
				}
				var elementKnotDisplacements = element.ElementType.CalculateDisplacementsForPostProcessing(element, localDisplacements);
				for (int i = 0; i < elementConnectivity.GetLength(1); i++)
				{
					var knotConnectivity = elementConnectivity[element.ID, i];
					knotDisplacements[knotConnectivity, 0] = elementKnotDisplacements[i, 0];
					knotDisplacements[knotConnectivity, 1] = elementKnotDisplacements[i, 1];
					knotDisplacements[knotConnectivity, 2] = elementKnotDisplacements[i, 2];
				}
			}
			WriteParaviewFile3D(knots, knotDisplacements);
		}
public void CreateParaviewFile ( ) { var uniqueKnotsKsi = _model . PatchesDictionary [ 0 ] . KnotValueVectorKsi . RemoveDuplicatesFindMultiplicity ( ) ; var uniqueKnotsHeta = _model . PatchesDictionary [ 0 ] . KnotValueVectorHeta . RemoveDuplicatesFindMultiplicity ( ) ; var uniqueKnotsZeta = _model . PatchesDictionary [ 0 ] . KnotValueVectorZeta . RemoveDuplicatesFindMultiplicity ( ) ; var numberOfKnotsKsi = uniqueKnotsKsi [ 0 ] . Length ; var numberOfKnotsHeta = uniqueKnotsHeta [ 0 ] . Length ; var numberOfKnotsZeta = uniqueKnotsZeta [ 0 ] . Length ; var knots = new double [ numberOfKnotsKsi * numberOfKnotsHeta * numberOfKnotsZeta , 3 ] ; var count = 0 ; var patch = _model . PatchesDictionary [ 0 ] ; var projectiveControlPoints = CalculateProjectiveControlPoints ( ) ; for ( int knotKsiIndex = 0 ; knotKsiIndex < numberOfKnotsKsi ; knotKsiIndex ++ ) { for ( int knotHetaIndex = 0 ; knotHetaIndex < numberOfKnotsHeta ; knotHetaIndex ++ ) { for ( int knotZetaIndex = 0 ; knotZetaIndex < numberOfKnotsZeta ; knotZetaIndex ++ ) { var ksiCoordinate = uniqueKnotsKsi [ 0 ] [ knotKsiIndex ] ; var hetaCoordinate = uniqueKnotsHeta [ 0 ] [ knotHetaIndex ] ; var zetaCoordinate = uniqueKnotsZeta [ 0 ] [ knotZetaIndex ] ; var point3D = SolidPoint3D ( patch . NumberOfControlPointsKsi - 1 , patch . DegreeKsi , patch . KnotValueVectorKsi , patch . NumberOfControlPointsHeta - 1 , patch . DegreeHeta , patch . KnotValueVectorHeta , patch . NumberOfControlPointsZeta - 1 , patch . DegreeZeta , patch . KnotValueVectorZeta , projectiveControlPoints , ksiCoordinate , hetaCoordinate , zetaCoordinate ) ; knots [ count , 0 ] = point3D [ 0 ] / point3D [ 3 ] ; knots [ count , 1 ] = point3D [ 1 ] / point3D [ 3 ] ; knots [ count ++ , 2 ] = point3D [ 2 ] / point3D [ 3 ] ; } } } var numberOfElements = ( numberOfKnotsKsi - 1 ) * ( numberOfKnotsHeta - 1 ) * ( numberOfKnotsZeta - 1 ) ; var elementConnectivity = new int [ numberOfElements , 8 ] ; foreach ( var element in _model . Elements ) for ( int i = 0 ; i < element . KnotsDictionary . Count ; i ++ ) elementConnectivity [ element . ID , i ] = element . Knots . ToArray ( ) [ i ] . ID ; var knotDisplacements = new double [ knots . GetLength ( 0 ) , 3 ] ; foreach ( var element in _model . Elements ) { var localDisplacements = Matrix . CreateZero ( element . ControlPointsDictionary . Count , 3 ) ; var counterCP = 0 ; foreach ( var controlPoint in element . ControlPoints ) { localDisplacements [ counterCP , 0 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationX ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationX ] ] ; localDisplacements [ counterCP , 1 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationY ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationY ] ] ; localDisplacements [ counterCP , 2 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationZ ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationZ ] ] ; counterCP ++ ; } var elementKnotDisplacements = element . ElementType . CalculateDisplacementsForPostProcessing ( element , localDisplacements ) ; for ( int i = 0 ; i < elementConnectivity . GetLength ( 1 ) ; i ++ ) { var knotConnectivity = elementConnectivity [ element . ID , i ] ; knotDisplacements [ knotConnectivity , 0 ] = elementKnotDisplacements [ i , 0 ] ; knotDisplacements [ knotConnectivity , 1 ] = elementKnotDisplacements [ i , 1 ] ; knotDisplacements [ knotConnectivity , 2 ] = elementKnotDisplacements [ i , 2 ] ; } } WriteParaviewFile3D ( knots , knotDisplacements ) ; }
Creates Paraview File of the 3D NURBS geometry.
Creates Paraview File of the 3D NURBS geometry .