コード例 #1
0
ファイル: MosaicApi.cs プロジェクト: rokleM/NvAPIWrapper
        /// <summary>
        ///     This API returns information on the topologies and display resolutions supported by Mosaic mode.
        ///     NOTE: Not all topologies returned can be set immediately. Some of the topologies returned might not be valid for
        ///     one reason or another.  It could be due to mismatched or missing displays.  It could also be because the required
        ///     number of GPUs is not found.
        ///     Once you get the list of supported topologies, you can call GetTopologyGroup() with one of the Mosaic topologies if
        ///     you need more information about it.
        ///     It is possible for this function to return NVAPI_OK with no topologies listed in the return structure.  If this is
        ///     the case, it means that the current hardware DOES support Mosaic, but with the given configuration no valid
        ///     topologies were found.  This most likely means that SLI was not enabled for the hardware. Once enabled, you should
        ///     see valid topologies returned from this function.
        /// </summary>
        /// <param name="topologyType">The type of topologies the caller is interested in getting.</param>
        /// <returns>Information about what topologies and display resolutions are supported for Mosaic.</returns>
        /// <exception cref="NVIDIAApiException">Status.NotSupported: Mosaic is not supported with the existing hardware.</exception>
        /// <exception cref="NVIDIAApiException">Status.InvalidArgument: TopologyType is invalid.</exception>
        /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: The NvAPI API needs to be initialized first.</exception>
        /// <exception cref="NVIDIAApiException">Status.NoImplementation: This entry-point not available.</exception>
        /// <exception cref="NVIDIAApiException">Status.Error: Miscellaneous error occurred.</exception>
        /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static ISupportedTopologiesInfo GetSupportedTopologiesInfo(TopologyType topologyType)
        {
            var mosaicGetSupportedTopoInfo =
                DelegateFactory.GetDelegate <Delegates.Mosaic.NvAPI_Mosaic_GetSupportedTopoInfo>();

            foreach (var acceptType in mosaicGetSupportedTopoInfo.Accepts())
            {
                var instance = acceptType.Instantiate <ISupportedTopologiesInfo>();

                using (var supportedTopologiesInfoByRef = ValueTypeReference.FromValueType(instance, acceptType))
                {
                    var status = mosaicGetSupportedTopoInfo(supportedTopologiesInfoByRef, topologyType);

                    if (status == Status.IncompatibleStructureVersion)
                    {
                        continue;
                    }

                    if (status != Status.Ok)
                    {
                        throw new NVIDIAApiException(status);
                    }

                    return(supportedTopologiesInfoByRef.ToValueType <ISupportedTopologiesInfo>(acceptType));
                }
            }

            throw new NVIDIANotSupportedException("This operation is not supported.");
        }
コード例 #2
0
ファイル: Topology.cs プロジェクト: vanattab/NvAPIWrapper
 /// <summary>
 ///     Retrieves all the supported topology modes that are now possible to apply
 /// </summary>
 /// <param name="type">The type of the topology mode to limit quary</param>
 /// <returns>An array of Topology modes</returns>
 public static Native.Mosaic.Topology[] GetSupportedTopologyModes(TopologyType type = TopologyType.All)
 {
     return
         (MosaicApi.GetSupportedTopologiesInfo(type)
          .TopologyBriefs.Where(topologyBrief => topologyBrief.IsPossible)
          .Select(topologyBrief => topologyBrief.Topology)
          .ToArray());
 }
コード例 #3
0
 public void Add(TopologyType type, int from, int to)
 {
     if (!m_borders.ContainsKey(type))
     {
         m_borders.Add(type, new List <Tuple <int, int> >());
     }
     m_borders[type].Add(new Tuple <int, int>(from, to));
 }
コード例 #4
0
        public IGeode CreateCube(VertexType vertexType, TopologyType topologyType)
        {
            if (vertexType == VertexType.Position3Texture2Color3Normal3 &&
                topologyType == TopologyType.IndexedTriangleList)
            {
                return(CubeGeometry.CreatePosition3Texture2Color3Normal3_IndexedTriangleList());
            }

            throw new ArgumentException("Invalid arguments");
        }
コード例 #5
0
 public IEnumerable <Tuple <int, int> > GetBorders(TopologyType type)
 {
     if (m_borders.ContainsKey(type))
     {
         foreach (Tuple <int, int> range in m_borders[type])
         {
             yield return(range);
         }
     }
 }
コード例 #6
0
    IEnumerator UpdateFromAlembic()
    {
        Debug.Log("Get time from Alembic!");
        VariableTopology = TopologyType.Undefined;

        SerializedObject alembic = InitAlembic();

        if (alembic != null)
        {
            maxTriangleCount = 0;
            minTriangleCount = 10000000;

            {
                Debug.Log("Checking max triangle count");
                int framesCount = Mathf.RoundToInt((EndTime - StartTime) * SampleRate + 0.5f);

                for (int frame = 0; frame < framesCount; frame++)
                {
                    float timing = StartTime + ((float)frame) / SampleRate;
                    timeProp.floatValue = timing;
                    alembicObject.ApplyModifiedProperties();
                    yield return(null);

                    int triangleCount = 0;
                    for (int i = 0; i < MeshToBake.childCount; i++)
                    {
                        MeshFilter localMeshFilter = MeshToBake.GetChild(i).GetComponent <MeshFilter>();
                        if (localMeshFilter != null)
                        {
                            triangleCount += localMeshFilter.sharedMesh.triangles.Length / 3;
                        }
                    }
                    if (triangleCount > maxTriangleCount)
                    {
                        maxTriangleCount = triangleCount;
                    }
                    if (triangleCount < minTriangleCount)
                    {
                        minTriangleCount = triangleCount;
                    }
                }
                Debug.Log("Max triangles count : " + maxTriangleCount);
                Debug.Log("Min triangles count : " + minTriangleCount);
            }
            yield return(null);

            StartTime        = 0.0f;
            SampleRate       = 1.0f / startTimeProp.floatValue;
            EndTime          = endTimeProp.floatValue;
            VariableTopology = (maxTriangleCount == minTriangleCount) ? TopologyType.Fixed : TopologyType.Variable;
            yield return(null);
        }
    }
コード例 #7
0
        public static Topology GetTopology(TopologyType pTopology)
        {
            switch (pTopology)
            {
                case TopologyType.SingleHopStar:
                    return new StarTopology();

                case TopologyType.Mesh:
                    return new MeshTopology();

                default:
                    throw new NotImplementedException();
            }
        }
コード例 #8
0
    void Start()
    {
        topologyType     = new TopologyType();
        topologyType     = TopologyType.lines;
        mesh             = this.GetComponent <MeshFilter>().mesh;
        index            = new List <int>();
        indexCount       = mesh.GetIndexCount(0);
        bufferIndexArray = new int [indexCount];
        bufferIndexArray = mesh.GetIndices(0);
        mesh.GetIndices(0).CopyTo(bufferIndexArray, 0);

        if (topologyType == TopologyType.lines)
        {
            mesh.SetIndices(index.ToArray(), MeshTopology.LineStrip, 0);
        }
        else if (topologyType == TopologyType.triangles)
        {
            mesh.SetIndices(index.ToArray(), MeshTopology.Triangles, 0);
        }
    }
コード例 #9
0
ファイル: Topology.cs プロジェクト: vanattab/NvAPIWrapper
 /// <summary>
 ///     Retrieves all the supported display settings
 /// </summary>
 /// <param name="type">The type of the topology mode to limit quary</param>
 /// <returns>An array of IDisplaySettings implamented objects</returns>
 public static IDisplaySettings[] GetSupportedTopologySettings(TopologyType type = TopologyType.All)
 {
     return(MosaicApi.GetSupportedTopologiesInfo(type).DisplaySettings.ToArray());
 }
コード例 #10
0
 public Mesh(TopologyType topology = TopologyType.Triangles)
 {
     Topology = topology;
 }
コード例 #11
0
 public static IMFTopologyNode MFCreateTopologyNode(TopologyType nodeType)
 {
     MFCreateTopologyNode(nodeType, out IMFTopologyNode node).CheckError();
     return(node);
 }
コード例 #12
0
        public GsaMember2d Duplicate()
        {
            if (this == null)
            {
                return(null);
            }
            GsaMember2d dup = new GsaMember2d()
            {
                Member = new Member()
                {
                    Group            = m_member.Group,
                    IsDummy          = m_member.IsDummy,
                    MeshSize         = m_member.MeshSize,
                    Name             = m_member.Name.ToString(),
                    Offset           = m_member.Offset,
                    OrientationAngle = m_member.OrientationAngle,
                    OrientationNode  = m_member.OrientationNode,
                    Property         = m_member.Property,
                    Topology         = m_member.Topology.ToString(),
                    Type             = m_member.Type,  // GsaToModel.Member2dType((int)Member.Type),
                    Type2D           = m_member.Type2D //GsaToModel.AnalysisOrder((int) Member.Type2D)
                }
            };

            if ((System.Drawing.Color)m_member.Colour != System.Drawing.Color.FromArgb(0, 0, 0)) // workaround to handle that System.Drawing.Color is non-nullable type
            {
                dup.m_member.Colour = m_member.Colour;
            }

            dup.Member.Offset.X1 = m_member.Offset.X1;
            dup.Member.Offset.X2 = m_member.Offset.X2;
            dup.Member.Offset.Y  = m_member.Offset.Y;
            dup.Member.Offset.Z  = m_member.Offset.Z;

            if (m_brep == null)
            {
                return(dup);
            }

            if (m_brep != null)
            {
                dup.m_brep = Brep.DuplicateBrep();
            }
            if (m_crv != null)
            {
                dup.m_crv = PolyCurve.DuplicatePolyCurve();
            }

            Point3dList point3Ds = new Point3dList(Topology);

            dup.Topology     = new List <Point3d>(point3Ds.Duplicate());
            dup.TopologyType = TopologyType.ToList();

            if (void_crvs != null)
            {
                dup.void_crvs     = new List <PolyCurve>();
                dup.void_topo     = new List <List <Point3d> >();
                dup.void_topoType = new List <List <string> >();
                for (int i = 0; i < void_crvs.Count; i++)
                {
                    dup.void_crvs.Add(void_crvs[i].DuplicatePolyCurve());
                    Point3dList voidpoint3Ds = new Point3dList(void_topo[i]);
                    dup.void_topo.Add(new List <Point3d>(voidpoint3Ds.Duplicate()));
                    dup.void_topoType.Add(void_topoType[i].ToList());
                }
            }

            if (incl_Lines != null)
            {
                dup.incl_Lines         = new List <PolyCurve>();
                dup.incLines_topo      = new List <List <Point3d> >();
                dup.inclLines_topoType = new List <List <string> >();
                for (int i = 0; i < incl_Lines.Count; i++)
                {
                    dup.incl_Lines.Add(incl_Lines[i].DuplicatePolyCurve());
                    Point3dList inclLinepoint3Ds = new Point3dList(incLines_topo[i]);
                    dup.incLines_topo.Add(new List <Point3d>(inclLinepoint3Ds.Duplicate()));
                    dup.inclLines_topoType.Add(inclLines_topoType[i].ToList());
                }
            }
            if (m_prop != null)
            {
                dup.Property = Property.Duplicate();
            }

            Point3dList inclpoint3Ds = new Point3dList(incl_pts);

            dup.incl_pts = new List <Point3d>(inclpoint3Ds.Duplicate());

            dup.ID = ID;

            return(dup);
        }
コード例 #13
0
        public static string[] GetDestinationDevicesFromTopology(string sourceDeviceId, TopologyType topology, ILogger log)
        {
            List <string> results = new List <string>();

            if (sourceDeviceId != topology.Item1.Item1)
            {
                var s = topology.Item1.Item1;
                log.LogInformation("source is not master. adding master {0} to dest list", s);
                results = results.Append(s).ToList <string>();
            }
            else
            {
                log.LogInformation("source is master. ignoring master");
            }
            //var slaves = topology.Item2.Where(s => s.Item1 != sourceDeviceId).Select(s => results.Append(s.Item1));
            var slavelist = topology.Item2.Where(s => s.Item1 != sourceDeviceId);

            log.LogInformation("found {0} slave topo entries", slavelist.Count());
            var slavenames = slavelist.Select(s => s.Item1);

            log.LogInformation("found {0} slavenames", slavenames.Count());
            results = results.Concat(slavenames).ToList <string>();
            //foreach (string s in slavenames)
            //{
            //    results.Add(s);
            //}
            log.LogInformation("found {0} destination device", results.Count);
            return(results.ToArray());
        }