From bef9beee88cac57394b8dc3bc914381c1a2fff83 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 19 May 2003 14:07:01 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'IMPORT'. Cherrypick from master 2003-05-19 14:07:00 UTC nri 'NRI : First integration.': idl/SMESH_BasicHypothesis.idl idl/SMESH_Gen.idl idl/SMESH_Hypothesis.idl idl/SMESH_Mesh.idl src/Driver/Document_Reader.cxx src/Driver/Document_Reader.h src/Driver/Document_Writer.cxx src/Driver/Document_Writer.h src/Driver/Driver_dl.cxx src/Driver/Makefile.in src/Driver/Mesh_Reader.cxx src/Driver/Mesh_Reader.h src/Driver/Mesh_Writer.cxx src/Driver/Mesh_Writer.h src/Driver/SMESHDriver.cxx src/Driver/SMESHDriver.h src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx src/DriverDAT/DriverDAT_R_SMDS_Mesh.h src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx src/DriverDAT/DriverDAT_R_SMESHDS_Document.h src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx src/DriverDAT/DriverDAT_W_SMDS_Mesh.h src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx src/DriverDAT/DriverDAT_W_SMESHDS_Document.h src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h src/DriverDAT/Makefile.in src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx src/DriverUNV/DriverUNV_R_SMDS_Mesh.h src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx src/DriverUNV/DriverUNV_R_SMESHDS_Document.h src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx src/DriverUNV/DriverUNV_W_SMDS_Mesh.h src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx src/DriverUNV/DriverUNV_W_SMESHDS_Document.h src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h src/DriverUNV/Makefile.in src/MEFISTO2/Makefile.in src/MEFISTO2/Rn.h src/MEFISTO2/aptrte.cxx src/MEFISTO2/aptrte.h src/MEFISTO2/areteideale.f src/MEFISTO2/trte.f src/Makefile.in src/OBJECT/Makefile.in src/OBJECT/SMESH_Actor.cxx src/OBJECT/SMESH_Actor.h src/OBJECT/SMESH_Grid.cxx src/OBJECT/SMESH_Grid.h src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx src/SMDS/Handle_SMDSControl_MeshBoundary.hxx src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx src/SMDS/Handle_SMDS_EdgePosition.hxx src/SMDS/Handle_SMDS_FacePosition.hxx src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx src/SMDS/Handle_SMDS_ListNodeOfListOfMeshElement.hxx src/SMDS/Handle_SMDS_ListNodeOfListOfMeshGroup.hxx src/SMDS/Handle_SMDS_Mesh.hxx src/SMDS/Handle_SMDS_MeshEdge.hxx src/SMDS/Handle_SMDS_MeshElement.hxx src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx src/SMDS/Handle_SMDS_MeshFace.hxx src/SMDS/Handle_SMDS_MeshGroup.hxx src/SMDS/Handle_SMDS_MeshHexahedron.hxx src/SMDS/Handle_SMDS_MeshIDFactory.hxx src/SMDS/Handle_SMDS_MeshNode.hxx src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx src/SMDS/Handle_SMDS_MeshObject.hxx src/SMDS/Handle_SMDS_MeshPrism.hxx src/SMDS/Handle_SMDS_MeshPyramid.hxx src/SMDS/Handle_SMDS_MeshQuadrangle.hxx src/SMDS/Handle_SMDS_MeshTetrahedron.hxx src/SMDS/Handle_SMDS_MeshTriangle.hxx src/SMDS/Handle_SMDS_MeshVolume.hxx src/SMDS/Handle_SMDS_Position.hxx src/SMDS/Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx src/SMDS/Handle_SMDS_SpacePosition.hxx src/SMDS/Handle_SMDS_StdMapNodeOfExtendedMap.hxx src/SMDS/Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx src/SMDS/Handle_SMDS_VertexPosition.hxx src/SMDS/Makefile.in src/SMDS/SMDS.cdl src/SMDS/SMDSAbs.cdl src/SMDS/SMDSAbs_ElementType.hxx src/SMDS/SMDSControl.cdl src/SMDS/SMDSControl.cxx src/SMDS/SMDSControl.hxx src/SMDS/SMDSControl.ixx src/SMDS/SMDSControl.jxx src/SMDS/SMDSControl_BoundaryEdges.cdl src/SMDS/SMDSControl_BoundaryEdges.cxx src/SMDS/SMDSControl_BoundaryEdges.hxx src/SMDS/SMDSControl_BoundaryEdges.ixx src/SMDS/SMDSControl_BoundaryEdges.jxx src/SMDS/SMDSControl_BoundaryFaces.cdl src/SMDS/SMDSControl_BoundaryFaces.cxx src/SMDS/SMDSControl_BoundaryFaces.hxx src/SMDS/SMDSControl_BoundaryFaces.ixx src/SMDS/SMDSControl_BoundaryFaces.jxx src/SMDS/SMDSControl_MeshBoundary.cdl src/SMDS/SMDSControl_MeshBoundary.cxx src/SMDS/SMDSControl_MeshBoundary.hxx src/SMDS/SMDSControl_MeshBoundary.ixx src/SMDS/SMDSControl_MeshBoundary.jxx src/SMDS/SMDSEdit.cdl src/SMDS/SMDSEdit_Transform.cdl src/SMDS/SMDSEdit_Transform.cxx src/SMDS/SMDSEdit_Transform.hxx src/SMDS/SMDSEdit_Transform.ixx src/SMDS/SMDSEdit_Transform.jxx src/SMDS/SMDS_BasicMap.lxx src/SMDS/SMDS_BasicMapIterator.lxx src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger.hxx src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx src/SMDS/SMDS_DataMapOfIntegerMeshElement_0.cxx src/SMDS/SMDS_DataMapOfPntInteger.hxx src/SMDS/SMDS_DataMapOfPntInteger_0.cxx src/SMDS/SMDS_EdgePosition.cdl src/SMDS/SMDS_EdgePosition.cxx src/SMDS/SMDS_EdgePosition.hxx src/SMDS/SMDS_EdgePosition.ixx src/SMDS/SMDS_EdgePosition.jxx src/SMDS/SMDS_EdgePosition.lxx src/SMDS/SMDS_ExtendedMap.hxx src/SMDS/SMDS_ExtendedMap_0.cxx src/SMDS/SMDS_ExtendedOrientedMap.hxx src/SMDS/SMDS_ExtendedOrientedMap_0.cxx src/SMDS/SMDS_FacePosition.cdl src/SMDS/SMDS_FacePosition.cxx src/SMDS/SMDS_FacePosition.hxx src/SMDS/SMDS_FacePosition.ixx src/SMDS/SMDS_FacePosition.jxx src/SMDS/SMDS_FacePosition.lxx src/SMDS/SMDS_HSequenceOfMesh.hxx src/SMDS/SMDS_HSequenceOfMesh_0.cxx src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx src/SMDS/SMDS_ListIteratorOfListOfMeshElement.hxx src/SMDS/SMDS_ListIteratorOfListOfMeshElement_0.cxx src/SMDS/SMDS_ListIteratorOfListOfMeshGroup.hxx src/SMDS/SMDS_ListIteratorOfListOfMeshGroup_0.cxx src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx src/SMDS/SMDS_ListNodeOfListOfMesh.hxx src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx src/SMDS/SMDS_ListNodeOfListOfMeshElement_0.cxx src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx src/SMDS/SMDS_ListOfMesh.hxx src/SMDS/SMDS_ListOfMeshElement.hxx src/SMDS/SMDS_ListOfMeshElement_0.cxx src/SMDS/SMDS_ListOfMeshGroup.hxx src/SMDS/SMDS_ListOfMeshGroup_0.cxx src/SMDS/SMDS_ListOfMesh_0.cxx src/SMDS/SMDS_Map.gxx src/SMDS/SMDS_MapHasher.gxx src/SMDS/SMDS_MapIterator.gxx src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap.hxx src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap_0.cxx src/SMDS/SMDS_MapNode.lxx src/SMDS/SMDS_MapOfMeshElement.cdl src/SMDS/SMDS_MapOfMeshElement.cxx src/SMDS/SMDS_MapOfMeshElement.hxx src/SMDS/SMDS_MapOfMeshElement.ixx src/SMDS/SMDS_MapOfMeshElement.jxx src/SMDS/SMDS_MapOfMeshElement.lxx src/SMDS/SMDS_MapOfMeshOrientedElement.cdl src/SMDS/SMDS_MapOfMeshOrientedElement.cxx src/SMDS/SMDS_MapOfMeshOrientedElement.hxx src/SMDS/SMDS_MapOfMeshOrientedElement.ixx src/SMDS/SMDS_MapOfMeshOrientedElement.jxx src/SMDS/SMDS_MapOfMeshOrientedElement.lxx src/SMDS/SMDS_Mesh.cdl src/SMDS/SMDS_Mesh.cxx src/SMDS/SMDS_Mesh.hxx src/SMDS/SMDS_Mesh.ixx src/SMDS/SMDS_Mesh.jxx src/SMDS/SMDS_Mesh.lxx src/SMDS/SMDS_MeshEdge.cdl src/SMDS/SMDS_MeshEdge.cxx src/SMDS/SMDS_MeshEdge.hxx src/SMDS/SMDS_MeshEdge.ixx src/SMDS/SMDS_MeshEdge.jxx src/SMDS/SMDS_MeshEdge.lxx src/SMDS/SMDS_MeshEdgesIterator.cdl src/SMDS/SMDS_MeshEdgesIterator.cxx src/SMDS/SMDS_MeshEdgesIterator.hxx src/SMDS/SMDS_MeshEdgesIterator.ixx src/SMDS/SMDS_MeshEdgesIterator.jxx src/SMDS/SMDS_MeshElement.cdl src/SMDS/SMDS_MeshElement.cxx src/SMDS/SMDS_MeshElement.hxx src/SMDS/SMDS_MeshElement.ixx src/SMDS/SMDS_MeshElement.jxx src/SMDS/SMDS_MeshElement.lxx src/SMDS/SMDS_MeshElementIDFactory.cdl src/SMDS/SMDS_MeshElementIDFactory.cxx src/SMDS/SMDS_MeshElementIDFactory.hxx src/SMDS/SMDS_MeshElementIDFactory.ixx src/SMDS/SMDS_MeshElementIDFactory.jxx src/SMDS/SMDS_MeshElementIDFactory.lxx src/SMDS/SMDS_MeshElementMapHasher.cdl src/SMDS/SMDS_MeshElementMapHasher.cxx src/SMDS/SMDS_MeshElementMapHasher.hxx src/SMDS/SMDS_MeshElementMapHasher.ixx src/SMDS/SMDS_MeshElementMapHasher.jxx src/SMDS/SMDS_MeshElementMapHasher.lxx src/SMDS/SMDS_MeshElementsIterator.cdl src/SMDS/SMDS_MeshElementsIterator.cxx src/SMDS/SMDS_MeshElementsIterator.hxx src/SMDS/SMDS_MeshElementsIterator.ixx src/SMDS/SMDS_MeshElementsIterator.jxx src/SMDS/SMDS_MeshElementsIterator.lxx src/SMDS/SMDS_MeshFace.cdl src/SMDS/SMDS_MeshFace.cxx src/SMDS/SMDS_MeshFace.hxx src/SMDS/SMDS_MeshFace.ixx src/SMDS/SMDS_MeshFace.jxx src/SMDS/SMDS_MeshFace.lxx src/SMDS/SMDS_MeshFacesIterator.cdl src/SMDS/SMDS_MeshFacesIterator.cxx src/SMDS/SMDS_MeshFacesIterator.hxx src/SMDS/SMDS_MeshFacesIterator.ixx src/SMDS/SMDS_MeshFacesIterator.jxx src/SMDS/SMDS_MeshGroup.cdl src/SMDS/SMDS_MeshGroup.cxx src/SMDS/SMDS_MeshGroup.hxx src/SMDS/SMDS_MeshGroup.ixx src/SMDS/SMDS_MeshGroup.jxx src/SMDS/SMDS_MeshGroup.lxx src/SMDS/SMDS_MeshHexahedron.cdl src/SMDS/SMDS_MeshHexahedron.cxx src/SMDS/SMDS_MeshHexahedron.hxx src/SMDS/SMDS_MeshHexahedron.ixx src/SMDS/SMDS_MeshHexahedron.jxx src/SMDS/SMDS_MeshHexahedron.lxx src/SMDS/SMDS_MeshIDFactory.cdl src/SMDS/SMDS_MeshIDFactory.cxx src/SMDS/SMDS_MeshIDFactory.hxx src/SMDS/SMDS_MeshIDFactory.ixx src/SMDS/SMDS_MeshIDFactory.jxx src/SMDS/SMDS_MeshIDFactory.lxx src/SMDS/SMDS_MeshNode.cdl src/SMDS/SMDS_MeshNode.cxx src/SMDS/SMDS_MeshNode.hxx src/SMDS/SMDS_MeshNode.ixx src/SMDS/SMDS_MeshNode.jxx src/SMDS/SMDS_MeshNode.lxx src/SMDS/SMDS_MeshNodeIDFactory.cdl src/SMDS/SMDS_MeshNodeIDFactory.cxx src/SMDS/SMDS_MeshNodeIDFactory.hxx src/SMDS/SMDS_MeshNodeIDFactory.ixx src/SMDS/SMDS_MeshNodeIDFactory.jxx src/SMDS/SMDS_MeshNodeIDFactory.lxx src/SMDS/SMDS_MeshNodesIterator.cdl src/SMDS/SMDS_MeshNodesIterator.cxx src/SMDS/SMDS_MeshNodesIterator.hxx src/SMDS/SMDS_MeshNodesIterator.ixx src/SMDS/SMDS_MeshNodesIterator.jxx src/SMDS/SMDS_MeshObject.cdl src/SMDS/SMDS_MeshObject.cxx src/SMDS/SMDS_MeshObject.hxx src/SMDS/SMDS_MeshObject.ixx src/SMDS/SMDS_MeshObject.jxx src/SMDS/SMDS_MeshOrientedElementMapHasher.cdl src/SMDS/SMDS_MeshOrientedElementMapHasher.cxx src/SMDS/SMDS_MeshOrientedElementMapHasher.hxx src/SMDS/SMDS_MeshOrientedElementMapHasher.ixx src/SMDS/SMDS_MeshOrientedElementMapHasher.jxx src/SMDS/SMDS_MeshOrientedElementMapHasher.lxx src/SMDS/SMDS_MeshPrism.cdl src/SMDS/SMDS_MeshPrism.cxx src/SMDS/SMDS_MeshPrism.hxx src/SMDS/SMDS_MeshPrism.ixx src/SMDS/SMDS_MeshPrism.jxx src/SMDS/SMDS_MeshPrism.lxx src/SMDS/SMDS_MeshPyramid.cdl src/SMDS/SMDS_MeshPyramid.cxx src/SMDS/SMDS_MeshPyramid.hxx src/SMDS/SMDS_MeshPyramid.ixx src/SMDS/SMDS_MeshPyramid.jxx src/SMDS/SMDS_MeshPyramid.lxx src/SMDS/SMDS_MeshQuadrangle.cdl src/SMDS/SMDS_MeshQuadrangle.cxx src/SMDS/SMDS_MeshQuadrangle.hxx src/SMDS/SMDS_MeshQuadrangle.ixx src/SMDS/SMDS_MeshQuadrangle.jxx src/SMDS/SMDS_MeshQuadrangle.lxx src/SMDS/SMDS_MeshTetrahedron.cdl src/SMDS/SMDS_MeshTetrahedron.cxx src/SMDS/SMDS_MeshTetrahedron.hxx src/SMDS/SMDS_MeshTetrahedron.ixx src/SMDS/SMDS_MeshTetrahedron.jxx src/SMDS/SMDS_MeshTetrahedron.lxx src/SMDS/SMDS_MeshTriangle.cdl src/SMDS/SMDS_MeshTriangle.cxx src/SMDS/SMDS_MeshTriangle.hxx src/SMDS/SMDS_MeshTriangle.ixx src/SMDS/SMDS_MeshTriangle.jxx src/SMDS/SMDS_MeshTriangle.lxx src/SMDS/SMDS_MeshVolume.cdl src/SMDS/SMDS_MeshVolume.cxx src/SMDS/SMDS_MeshVolume.hxx src/SMDS/SMDS_MeshVolume.ixx src/SMDS/SMDS_MeshVolume.jxx src/SMDS/SMDS_MeshVolume.lxx src/SMDS/SMDS_MeshVolumesIterator.cdl src/SMDS/SMDS_MeshVolumesIterator.cxx src/SMDS/SMDS_MeshVolumesIterator.hxx src/SMDS/SMDS_MeshVolumesIterator.ixx src/SMDS/SMDS_MeshVolumesIterator.jxx src/SMDS/SMDS_PntHasher.cdl src/SMDS/SMDS_PntHasher.cxx src/SMDS/SMDS_PntHasher.hxx src/SMDS/SMDS_PntHasher.ixx src/SMDS/SMDS_PntHasher.jxx src/SMDS/SMDS_PntHasher.lxx src/SMDS/SMDS_Position.cdl src/SMDS/SMDS_Position.cxx src/SMDS/SMDS_Position.hxx src/SMDS/SMDS_Position.ixx src/SMDS/SMDS_Position.jxx src/SMDS/SMDS_Position.lxx src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh.hxx src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh_0.cxx src/SMDS/SMDS_SequenceOfMesh.hxx src/SMDS/SMDS_SequenceOfMesh_0.cxx src/SMDS/SMDS_SpacePosition.cdl src/SMDS/SMDS_SpacePosition.cxx src/SMDS/SMDS_SpacePosition.hxx src/SMDS/SMDS_SpacePosition.ixx src/SMDS/SMDS_SpacePosition.jxx src/SMDS/SMDS_SpacePosition.lxx src/SMDS/SMDS_StdMapNode.gxx src/SMDS/SMDS_StdMapNode.lxx src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap.hxx src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx src/SMDS/SMDS_TypeOfPosition.hxx src/SMDS/SMDS_VertexPosition.cdl src/SMDS/SMDS_VertexPosition.cxx src/SMDS/SMDS_VertexPosition.hxx src/SMDS/SMDS_VertexPosition.ixx src/SMDS/SMDS_VertexPosition.jxx src/SMESH/Makefile.in src/SMESH/SMESH_1D_Algo.cxx src/SMESH/SMESH_1D_Algo.hxx src/SMESH/SMESH_2D_Algo.cxx src/SMESH/SMESH_2D_Algo.hxx src/SMESH/SMESH_3D_Algo.cxx src/SMESH/SMESH_3D_Algo.hxx src/SMESH/SMESH_Algo.cxx src/SMESH/SMESH_Algo.hxx src/SMESH/SMESH_Gen.cxx src/SMESH/SMESH_Gen.hxx src/SMESH/SMESH_Hexa_3D.cxx src/SMESH/SMESH_Hexa_3D.hxx src/SMESH/SMESH_Hypothesis.cxx src/SMESH/SMESH_Hypothesis.hxx src/SMESH/SMESH_HypothesisCreator.hxx src/SMESH/SMESH_HypothesisFactory.cxx src/SMESH/SMESH_HypothesisFactory.hxx src/SMESH/SMESH_LengthFromEdges.cxx src/SMESH/SMESH_LengthFromEdges.hxx src/SMESH/SMESH_LocalLength.cxx src/SMESH/SMESH_LocalLength.hxx src/SMESH/SMESH_MEFISTO_2D.cxx src/SMESH/SMESH_MEFISTO_2D.hxx src/SMESH/SMESH_MaxElementArea.cxx src/SMESH/SMESH_MaxElementArea.hxx src/SMESH/SMESH_MaxElementVolume.cxx src/SMESH/SMESH_MaxElementVolume.hxx src/SMESH/SMESH_Mesh.cxx src/SMESH/SMESH_Mesh.hxx src/SMESH/SMESH_NumberOfSegments.cxx src/SMESH/SMESH_NumberOfSegments.hxx src/SMESH/SMESH_Quadrangle_2D.cxx src/SMESH/SMESH_Quadrangle_2D.hxx src/SMESH/SMESH_Regular_1D.cxx src/SMESH/SMESH_Regular_1D.hxx src/SMESH/SMESH_subMesh.cxx src/SMESH/SMESH_subMesh.hxx src/SMESHDS/Handle_SMESHDS_Command.hxx src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx src/SMESHDS/Handle_SMESHDS_Document.hxx src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfCommand.hxx src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx src/SMESHDS/Handle_SMESHDS_Mesh.hxx src/SMESHDS/Handle_SMESHDS_Script.hxx src/SMESHDS/Handle_SMESHDS_SubMesh.hxx src/SMESHDS/Makefile.in src/SMESHDS/SMESHDS.cdl src/SMESHDS/SMESHDS_Command.cdl src/SMESHDS/SMESHDS_Command.cxx src/SMESHDS/SMESHDS_Command.hxx src/SMESHDS/SMESHDS_Command.ixx src/SMESHDS/SMESHDS_Command.jxx src/SMESHDS/SMESHDS_CommandType.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx src/SMESHDS/SMESHDS_DataMapOfIntegerMesh_0.cxx src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh.hxx src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh_0.cxx src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh_0.cxx src/SMESHDS/SMESHDS_Document.cdl src/SMESHDS/SMESHDS_Document.cxx src/SMESHDS/SMESHDS_Document.hxx src/SMESHDS/SMESHDS_Document.ixx src/SMESHDS/SMESHDS_Document.jxx src/SMESHDS/SMESHDS_Hypothesis.cxx src/SMESHDS/SMESHDS_Hypothesis.hxx src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString.hxx src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString_0.cxx src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand.hxx src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand_0.cxx src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString.hxx src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString_0.cxx src/SMESHDS/SMESHDS_ListNodeOfListOfCommand.hxx src/SMESHDS/SMESHDS_ListNodeOfListOfCommand_0.cxx src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_ListOfAsciiString.hxx src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx src/SMESHDS/SMESHDS_ListOfCommand.hxx src/SMESHDS/SMESHDS_ListOfCommand_0.cxx src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx src/SMESHDS/SMESHDS_Mesh.cdl src/SMESHDS/SMESHDS_Mesh.cxx src/SMESHDS/SMESHDS_Mesh.hxx src/SMESHDS/SMESHDS_Mesh.ixx src/SMESHDS/SMESHDS_Mesh.jxx src/SMESHDS/SMESHDS_PtrHypothesis.hxx src/SMESHDS/SMESHDS_Script.cdl src/SMESHDS/SMESHDS_Script.cxx src/SMESHDS/SMESHDS_Script.hxx src/SMESHDS/SMESHDS_Script.ixx src/SMESHDS/SMESHDS_Script.jxx src/SMESHDS/SMESHDS_SubMesh.cdl src/SMESHDS/SMESHDS_SubMesh.cxx src/SMESHDS/SMESHDS_SubMesh.hxx src/SMESHDS/SMESHDS_SubMesh.ixx src/SMESHDS/SMESHDS_SubMesh.jxx src/SMESHFiltersSelection/Handle_SMESH_TypeFilter.hxx src/SMESHFiltersSelection/Makefile.in src/SMESHFiltersSelection/SMESH_Type.h src/SMESHFiltersSelection/SMESH_TypeFilter.cxx src/SMESHFiltersSelection/SMESH_TypeFilter.hxx src/SMESHFiltersSelection/SMESH_TypeFilter.ixx src/SMESHFiltersSelection/SMESH_TypeFilter.jxx src/SMESHGUI/Makefile.in src/SMESHGUI/SMESHGUI.cxx src/SMESHGUI/SMESHGUI.h src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx src/SMESHGUI/SMESHGUI_AddEdgeDlg.h src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx src/SMESHGUI/SMESHGUI_AddFaceDlg.h src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx src/SMESHGUI/SMESHGUI_AddVolumeDlg.h src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx src/SMESHGUI/SMESHGUI_ComputeScalarValue.h src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.cxx src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.cxx src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx src/SMESHGUI/SMESHGUI_InitMeshDlg.h src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx src/SMESHGUI/SMESHGUI_LocalLengthDlg.h src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx src/SMESHGUI/SMESHGUI_MeshInfosDlg.h src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx src/SMESHGUI/SMESHGUI_MoveNodesDlg.h src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h src/SMESHGUI/SMESHGUI_NodesDlg.cxx src/SMESHGUI/SMESHGUI_NodesDlg.h src/SMESHGUI/SMESHGUI_OrientationElementsDlg.cxx src/SMESHGUI/SMESHGUI_OrientationElementsDlg.h src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h src/SMESHGUI/SMESHGUI_SpinBox.cxx src/SMESHGUI/SMESHGUI_SpinBox.h src/SMESHGUI/SMESHGUI_StudyAPI.cxx src/SMESHGUI/SMESHGUI_StudyAPI.h src/SMESHGUI/SMESHGUI_Swig.cxx src/SMESHGUI/SMESHGUI_Swig.hxx src/SMESHGUI/SMESHGUI_Swig.i src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx src/SMESHGUI/SMESHGUI_TransparencyDlg.h src/SMESHGUI/SMESHGUI_aParameterDlg.cxx src/SMESHGUI/SMESHGUI_aParameterDlg.h src/SMESH_I/Makefile.in src/SMESH_I/SMESH_1D_Algo_i.cxx src/SMESH_I/SMESH_1D_Algo_i.hxx src/SMESH_I/SMESH_2D_Algo_i.cxx src/SMESH_I/SMESH_2D_Algo_i.hxx src/SMESH_I/SMESH_3D_Algo_i.cxx src/SMESH_I/SMESH_3D_Algo_i.hxx src/SMESH_I/SMESH_Algo_i.cxx src/SMESH_I/SMESH_Algo_i.hxx src/SMESH_I/SMESH_Gen_i.cxx src/SMESH_I/SMESH_Gen_i.hxx src/SMESH_I/SMESH_Hexa_3D_i.cxx src/SMESH_I/SMESH_Hexa_3D_i.hxx src/SMESH_I/SMESH_HypothesisFactory_i.cxx src/SMESH_I/SMESH_HypothesisFactory_i.hxx src/SMESH_I/SMESH_Hypothesis_i.cxx src/SMESH_I/SMESH_Hypothesis_i.hxx src/SMESH_I/SMESH_LocalLength_i.cxx src/SMESH_I/SMESH_LocalLength_i.hxx src/SMESH_I/SMESH_MEDFamily_i.cxx src/SMESH_I/SMESH_MEDFamily_i.hxx src/SMESH_I/SMESH_MEDMesh_i.cxx src/SMESH_I/SMESH_MEDMesh_i.hxx src/SMESH_I/SMESH_MEDSupport_i.cxx src/SMESH_I/SMESH_MEDSupport_i.hxx src/SMESH_I/SMESH_MEFISTO_2D_i.cxx src/SMESH_I/SMESH_MEFISTO_2D_i.hxx src/SMESH_I/SMESH_MaxElementArea_i.cxx src/SMESH_I/SMESH_MaxElementArea_i.hxx src/SMESH_I/SMESH_MaxElementVolume_i.cxx src/SMESH_I/SMESH_MaxElementVolume_i.hxx src/SMESH_I/SMESH_MeshEditor_i.cxx src/SMESH_I/SMESH_MeshEditor_i.hxx src/SMESH_I/SMESH_Mesh_i.cxx src/SMESH_I/SMESH_Mesh_i.hxx src/SMESH_I/SMESH_NumberOfSegments_i.cxx src/SMESH_I/SMESH_NumberOfSegments_i.hxx src/SMESH_I/SMESH_Quadrangle_2D_i.cxx src/SMESH_I/SMESH_Quadrangle_2D_i.hxx src/SMESH_I/SMESH_Regular_1D_i.cxx src/SMESH_I/SMESH_Regular_1D_i.hxx src/SMESH_I/SMESH_subMesh_i.cxx src/SMESH_I/SMESH_subMesh_i.hxx src/SMESH_I/SMESH_test.py src/SMESH_I/SMESH_topo.cxx src/SMESH_I/SMESH_topo.hxx src/SMESH_I/smeshpy.py src/SMESH_I/sstream src/SMESH_SWIG/Makefile.in src/SMESH_SWIG/SMESH_fixation.py src/SMESH_SWIG/SMESH_mechanic.py src/SMESH_SWIG/SMESH_test0.py src/SMESH_SWIG/SMESH_test1.py src/SMESH_SWIG/SMESH_test2.py src/SMESH_SWIG/SMESH_test3.py src/SMESH_SWIG/batchmode_smesh.py src/SMESH_SWIG/libSMESH_Swig.i --- idl/SMESH_BasicHypothesis.idl | 64 + idl/SMESH_Gen.idl | 96 + idl/SMESH_Hypothesis.idl | 71 + idl/SMESH_Mesh.idl | 262 + src/Driver/Document_Reader.cxx | 13 + src/Driver/Document_Reader.h | 18 + src/Driver/Document_Writer.cxx | 11 + src/Driver/Document_Writer.h | 19 + src/Driver/Driver_dl.cxx | 183 + src/Driver/Makefile.in | 39 + src/Driver/Mesh_Reader.cxx | 3 + src/Driver/Mesh_Reader.h | 17 + src/Driver/Mesh_Writer.cxx | 2 + src/Driver/Mesh_Writer.h | 17 + src/Driver/SMESHDriver.cxx | 113 + src/Driver/SMESHDriver.h | 19 + src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx | 175 + src/DriverDAT/DriverDAT_R_SMDS_Mesh.h | 30 + .../DriverDAT_R_SMESHDS_Document.cxx | 86 + src/DriverDAT/DriverDAT_R_SMESHDS_Document.h | 24 + src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx | 52 + src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h | 30 + src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx | 164 + src/DriverDAT/DriverDAT_W_SMDS_Mesh.h | 31 + .../DriverDAT_W_SMESHDS_Document.cxx | 78 + src/DriverDAT/DriverDAT_W_SMESHDS_Document.h | 25 + src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx | 175 + src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h | 31 + src/DriverDAT/Makefile.in | 39 + src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx | 153 + src/DriverUNV/DriverUNV_R_SMDS_Mesh.h | 30 + .../DriverUNV_R_SMESHDS_Document.cxx | 85 + src/DriverUNV/DriverUNV_R_SMESHDS_Document.h | 24 + src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx | 48 + src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h | 30 + src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx | 196 + src/DriverUNV/DriverUNV_W_SMDS_Mesh.h | 31 + .../DriverUNV_W_SMESHDS_Document.cxx | 78 + src/DriverUNV/DriverUNV_W_SMESHDS_Document.h | 25 + src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx | 207 + src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h | 31 + src/DriverUNV/Makefile.in | 41 + src/MEFISTO2/Makefile.in | 36 + src/MEFISTO2/Rn.h | 204 + src/MEFISTO2/aptrte.cxx | 760 ++ src/MEFISTO2/aptrte.h | 229 + src/MEFISTO2/areteideale.f | 5 + src/MEFISTO2/trte.f | 8319 +++++++++++++++++ src/Makefile.in | 22 + src/OBJECT/Makefile.in | 33 + src/OBJECT/SMESH_Actor.cxx | 598 ++ src/OBJECT/SMESH_Actor.h | 137 + src/OBJECT/SMESH_Grid.cxx | 141 + src/OBJECT/SMESH_Grid.h | 61 + src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx | 89 + src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx | 89 + src/SMDS/Handle_SMDSControl_MeshBoundary.hxx | 89 + ...taMapNodeOfDataMapOfIntegerMeshElement.hxx | 89 + ..._SMDS_DataMapNodeOfDataMapOfPntInteger.hxx | 89 + src/SMDS/Handle_SMDS_EdgePosition.hxx | 89 + src/SMDS/Handle_SMDS_FacePosition.hxx | 89 + src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx | 89 + src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx | 89 + ...andle_SMDS_ListNodeOfListOfMeshElement.hxx | 89 + .../Handle_SMDS_ListNodeOfListOfMeshGroup.hxx | 89 + src/SMDS/Handle_SMDS_Mesh.hxx | 89 + src/SMDS/Handle_SMDS_MeshEdge.hxx | 89 + src/SMDS/Handle_SMDS_MeshElement.hxx | 89 + src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx | 89 + src/SMDS/Handle_SMDS_MeshFace.hxx | 89 + src/SMDS/Handle_SMDS_MeshGroup.hxx | 89 + src/SMDS/Handle_SMDS_MeshHexahedron.hxx | 89 + src/SMDS/Handle_SMDS_MeshIDFactory.hxx | 89 + src/SMDS/Handle_SMDS_MeshNode.hxx | 89 + src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx | 89 + src/SMDS/Handle_SMDS_MeshObject.hxx | 89 + src/SMDS/Handle_SMDS_MeshPrism.hxx | 89 + src/SMDS/Handle_SMDS_MeshPyramid.hxx | 89 + src/SMDS/Handle_SMDS_MeshQuadrangle.hxx | 89 + src/SMDS/Handle_SMDS_MeshTetrahedron.hxx | 89 + src/SMDS/Handle_SMDS_MeshTriangle.hxx | 89 + src/SMDS/Handle_SMDS_MeshVolume.hxx | 89 + src/SMDS/Handle_SMDS_Position.hxx | 89 + ...ndle_SMDS_SequenceNodeOfSequenceOfMesh.hxx | 89 + src/SMDS/Handle_SMDS_SpacePosition.hxx | 89 + .../Handle_SMDS_StdMapNodeOfExtendedMap.hxx | 89 + ...e_SMDS_StdMapNodeOfExtendedOrientedMap.hxx | 89 + src/SMDS/Handle_SMDS_VertexPosition.hxx | 89 + src/SMDS/Makefile.in | 263 + src/SMDS/SMDS.cdl | 148 + src/SMDS/SMDSAbs.cdl | 24 + src/SMDS/SMDSAbs_ElementType.hxx | 31 + src/SMDS/SMDSControl.cdl | 39 + src/SMDS/SMDSControl.cxx | 214 + src/SMDS/SMDSControl.hxx | 104 + src/SMDS/SMDSControl.ixx | 19 + src/SMDS/SMDSControl.jxx | 9 + src/SMDS/SMDSControl_BoundaryEdges.cdl | 29 + src/SMDS/SMDSControl_BoundaryEdges.cxx | 59 + src/SMDS/SMDSControl_BoundaryEdges.hxx | 104 + src/SMDS/SMDSControl_BoundaryEdges.ixx | 71 + src/SMDS/SMDSControl_BoundaryEdges.jxx | 6 + src/SMDS/SMDSControl_BoundaryFaces.cdl | 31 + src/SMDS/SMDSControl_BoundaryFaces.cxx | 82 + src/SMDS/SMDSControl_BoundaryFaces.hxx | 104 + src/SMDS/SMDSControl_BoundaryFaces.ixx | 71 + src/SMDS/SMDSControl_BoundaryFaces.jxx | 6 + src/SMDS/SMDSControl_MeshBoundary.cdl | 35 + src/SMDS/SMDSControl_MeshBoundary.cxx | 40 + src/SMDS/SMDSControl_MeshBoundary.hxx | 104 + src/SMDS/SMDSControl_MeshBoundary.ixx | 69 + src/SMDS/SMDSControl_MeshBoundary.jxx | 6 + src/SMDS/SMDSEdit.cdl | 24 + src/SMDS/SMDSEdit_Transform.cdl | 47 + src/SMDS/SMDSEdit_Transform.cxx | 100 + src/SMDS/SMDSEdit_Transform.hxx | 104 + src/SMDS/SMDSEdit_Transform.ixx | 19 + src/SMDS/SMDSEdit_Transform.jxx | 12 + src/SMDS/SMDS_BasicMap.lxx | 1 + src/SMDS/SMDS_BasicMapIterator.lxx | 1 + ...pIteratorOfDataMapOfIntegerMeshElement.hxx | 106 + ...teratorOfDataMapOfIntegerMeshElement_0.cxx | 50 + ...S_DataMapIteratorOfDataMapOfPntInteger.hxx | 103 + ...DataMapIteratorOfDataMapOfPntInteger_0.cxx | 50 + ...taMapNodeOfDataMapOfIntegerMeshElement.hxx | 141 + ...MapNodeOfDataMapOfIntegerMeshElement_0.cxx | 99 + .../SMDS_DataMapNodeOfDataMapOfPntInteger.hxx | 141 + ...MDS_DataMapNodeOfDataMapOfPntInteger_0.cxx | 99 + src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx | 135 + .../SMDS_DataMapOfIntegerMeshElement_0.cxx | 53 + src/SMDS/SMDS_DataMapOfPntInteger.hxx | 132 + src/SMDS/SMDS_DataMapOfPntInteger_0.cxx | 53 + src/SMDS/SMDS_EdgePosition.cdl | 36 + src/SMDS/SMDS_EdgePosition.cxx | 41 + src/SMDS/SMDS_EdgePosition.hxx | 108 + src/SMDS/SMDS_EdgePosition.ixx | 71 + src/SMDS/SMDS_EdgePosition.jxx | 6 + src/SMDS/SMDS_EdgePosition.lxx | 24 + src/SMDS/SMDS_ExtendedMap.hxx | 122 + src/SMDS/SMDS_ExtendedMap_0.cxx | 48 + src/SMDS/SMDS_ExtendedOrientedMap.hxx | 122 + src/SMDS/SMDS_ExtendedOrientedMap_0.cxx | 48 + src/SMDS/SMDS_FacePosition.cdl | 44 + src/SMDS/SMDS_FacePosition.cxx | 43 + src/SMDS/SMDS_FacePosition.hxx | 111 + src/SMDS/SMDS_FacePosition.ixx | 71 + src/SMDS/SMDS_FacePosition.jxx | 6 + src/SMDS/SMDS_FacePosition.lxx | 44 + src/SMDS/SMDS_HSequenceOfMesh.hxx | 155 + src/SMDS/SMDS_HSequenceOfMesh_0.cxx | 91 + src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx | 131 + .../SMDS_ListIteratorOfListOfMeshElement.hxx | 131 + ...SMDS_ListIteratorOfListOfMeshElement_0.cxx | 46 + .../SMDS_ListIteratorOfListOfMeshGroup.hxx | 131 + .../SMDS_ListIteratorOfListOfMeshGroup_0.cxx | 46 + src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx | 46 + src/SMDS/SMDS_ListNodeOfListOfMesh.hxx | 127 + src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx | 127 + .../SMDS_ListNodeOfListOfMeshElement_0.cxx | 92 + src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx | 127 + src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx | 92 + src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx | 92 + src/SMDS/SMDS_ListOfMesh.hxx | 155 + src/SMDS/SMDS_ListOfMeshElement.hxx | 155 + src/SMDS/SMDS_ListOfMeshElement_0.cxx | 43 + src/SMDS/SMDS_ListOfMeshGroup.hxx | 155 + src/SMDS/SMDS_ListOfMeshGroup_0.cxx | 43 + src/SMDS/SMDS_ListOfMesh_0.cxx | 43 + src/SMDS/SMDS_Map.gxx | 1 + src/SMDS/SMDS_MapHasher.gxx | 1 + src/SMDS/SMDS_MapIterator.gxx | 1 + src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx | 102 + src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx | 48 + .../SMDS_MapIteratorOfExtendedOrientedMap.hxx | 102 + ...MDS_MapIteratorOfExtendedOrientedMap_0.cxx | 48 + src/SMDS/SMDS_MapNode.lxx | 1 + src/SMDS/SMDS_MapOfMeshElement.cdl | 60 + src/SMDS/SMDS_MapOfMeshElement.cxx | 131 + src/SMDS/SMDS_MapOfMeshElement.hxx | 119 + src/SMDS/SMDS_MapOfMeshElement.ixx | 19 + src/SMDS/SMDS_MapOfMeshElement.jxx | 9 + src/SMDS/SMDS_MapOfMeshElement.lxx | 12 + src/SMDS/SMDS_MapOfMeshOrientedElement.cdl | 60 + src/SMDS/SMDS_MapOfMeshOrientedElement.cxx | 131 + src/SMDS/SMDS_MapOfMeshOrientedElement.hxx | 119 + src/SMDS/SMDS_MapOfMeshOrientedElement.ixx | 19 + src/SMDS/SMDS_MapOfMeshOrientedElement.jxx | 9 + src/SMDS/SMDS_MapOfMeshOrientedElement.lxx | 12 + src/SMDS/SMDS_Mesh.cdl | 408 + src/SMDS/SMDS_Mesh.cxx | 1472 +++ src/SMDS/SMDS_Mesh.hxx | 224 + src/SMDS/SMDS_Mesh.ixx | 71 + src/SMDS/SMDS_Mesh.jxx | 36 + src/SMDS/SMDS_Mesh.lxx | 57 + src/SMDS/SMDS_MeshEdge.cdl | 38 + src/SMDS/SMDS_MeshEdge.cxx | 53 + src/SMDS/SMDS_MeshEdge.hxx | 113 + src/SMDS/SMDS_MeshEdge.ixx | 73 + src/SMDS/SMDS_MeshEdge.jxx | 3 + src/SMDS/SMDS_MeshEdge.lxx | 51 + src/SMDS/SMDS_MeshEdgesIterator.cdl | 35 + src/SMDS/SMDS_MeshEdgesIterator.cxx | 42 + src/SMDS/SMDS_MeshEdgesIterator.hxx | 96 + src/SMDS/SMDS_MeshEdgesIterator.ixx | 19 + src/SMDS/SMDS_MeshEdgesIterator.jxx | 12 + src/SMDS/SMDS_MeshElement.cdl | 115 + src/SMDS/SMDS_MeshElement.cxx | 177 + src/SMDS/SMDS_MeshElement.hxx | 148 + src/SMDS/SMDS_MeshElement.ixx | 71 + src/SMDS/SMDS_MeshElement.jxx | 18 + src/SMDS/SMDS_MeshElement.lxx | 131 + src/SMDS/SMDS_MeshElementIDFactory.cdl | 45 + src/SMDS/SMDS_MeshElementIDFactory.cxx | 18 + src/SMDS/SMDS_MeshElementIDFactory.hxx | 114 + src/SMDS/SMDS_MeshElementIDFactory.ixx | 73 + src/SMDS/SMDS_MeshElementIDFactory.jxx | 6 + src/SMDS/SMDS_MeshElementIDFactory.lxx | 56 + src/SMDS/SMDS_MeshElementMapHasher.cdl | 31 + src/SMDS/SMDS_MeshElementMapHasher.cxx | 8 + src/SMDS/SMDS_MeshElementMapHasher.hxx | 97 + src/SMDS/SMDS_MeshElementMapHasher.ixx | 19 + src/SMDS/SMDS_MeshElementMapHasher.jxx | 6 + src/SMDS/SMDS_MeshElementMapHasher.lxx | 27 + src/SMDS/SMDS_MeshElementsIterator.cdl | 56 + src/SMDS/SMDS_MeshElementsIterator.cxx | 24 + src/SMDS/SMDS_MeshElementsIterator.hxx | 109 + src/SMDS/SMDS_MeshElementsIterator.ixx | 19 + src/SMDS/SMDS_MeshElementsIterator.jxx | 15 + src/SMDS/SMDS_MeshElementsIterator.lxx | 28 + src/SMDS/SMDS_MeshFace.cdl | 34 + src/SMDS/SMDS_MeshFace.cxx | 45 + src/SMDS/SMDS_MeshFace.hxx | 107 + src/SMDS/SMDS_MeshFace.ixx | 73 + src/SMDS/SMDS_MeshFace.jxx | 3 + src/SMDS/SMDS_MeshFace.lxx | 16 + src/SMDS/SMDS_MeshFacesIterator.cdl | 34 + src/SMDS/SMDS_MeshFacesIterator.cxx | 42 + src/SMDS/SMDS_MeshFacesIterator.hxx | 96 + src/SMDS/SMDS_MeshFacesIterator.ixx | 19 + src/SMDS/SMDS_MeshFacesIterator.jxx | 12 + src/SMDS/SMDS_MeshGroup.cdl | 116 + src/SMDS/SMDS_MeshGroup.cxx | 162 + src/SMDS/SMDS_MeshGroup.hxx | 142 + src/SMDS/SMDS_MeshGroup.ixx | 71 + src/SMDS/SMDS_MeshGroup.jxx | 21 + src/SMDS/SMDS_MeshGroup.lxx | 14 + src/SMDS/SMDS_MeshHexahedron.cdl | 69 + src/SMDS/SMDS_MeshHexahedron.cxx | 196 + src/SMDS/SMDS_MeshHexahedron.hxx | 114 + src/SMDS/SMDS_MeshHexahedron.ixx | 75 + src/SMDS/SMDS_MeshHexahedron.jxx | 6 + src/SMDS/SMDS_MeshHexahedron.lxx | 63 + src/SMDS/SMDS_MeshIDFactory.cdl | 32 + src/SMDS/SMDS_MeshIDFactory.cxx | 19 + src/SMDS/SMDS_MeshIDFactory.hxx | 105 + src/SMDS/SMDS_MeshIDFactory.ixx | 71 + src/SMDS/SMDS_MeshIDFactory.jxx | 3 + src/SMDS/SMDS_MeshIDFactory.lxx | 34 + src/SMDS/SMDS_MeshNode.cdl | 64 + src/SMDS/SMDS_MeshNode.cxx | 83 + src/SMDS/SMDS_MeshNode.hxx | 137 + src/SMDS/SMDS_MeshNode.ixx | 73 + src/SMDS/SMDS_MeshNode.jxx | 12 + src/SMDS/SMDS_MeshNode.lxx | 103 + src/SMDS/SMDS_MeshNodeIDFactory.cdl | 26 + src/SMDS/SMDS_MeshNodeIDFactory.cxx | 18 + src/SMDS/SMDS_MeshNodeIDFactory.hxx | 101 + src/SMDS/SMDS_MeshNodeIDFactory.ixx | 73 + src/SMDS/SMDS_MeshNodeIDFactory.jxx | 3 + src/SMDS/SMDS_MeshNodeIDFactory.lxx | 34 + src/SMDS/SMDS_MeshNodesIterator.cdl | 34 + src/SMDS/SMDS_MeshNodesIterator.cxx | 42 + src/SMDS/SMDS_MeshNodesIterator.hxx | 96 + src/SMDS/SMDS_MeshNodesIterator.ixx | 19 + src/SMDS/SMDS_MeshNodesIterator.jxx | 12 + src/SMDS/SMDS_MeshObject.cdl | 15 + src/SMDS/SMDS_MeshObject.cxx | 8 + src/SMDS/SMDS_MeshObject.hxx | 94 + src/SMDS/SMDS_MeshObject.ixx | 69 + src/SMDS/SMDS_MeshObject.jxx | 3 + .../SMDS_MeshOrientedElementMapHasher.cdl | 31 + .../SMDS_MeshOrientedElementMapHasher.cxx | 8 + .../SMDS_MeshOrientedElementMapHasher.hxx | 97 + .../SMDS_MeshOrientedElementMapHasher.ixx | 19 + .../SMDS_MeshOrientedElementMapHasher.jxx | 6 + .../SMDS_MeshOrientedElementMapHasher.lxx | 27 + src/SMDS/SMDS_MeshPrism.cdl | 67 + src/SMDS/SMDS_MeshPrism.cxx | 161 + src/SMDS/SMDS_MeshPrism.hxx | 114 + src/SMDS/SMDS_MeshPrism.ixx | 75 + src/SMDS/SMDS_MeshPrism.jxx | 6 + src/SMDS/SMDS_MeshPrism.lxx | 62 + src/SMDS/SMDS_MeshPyramid.cdl | 68 + src/SMDS/SMDS_MeshPyramid.cxx | 147 + src/SMDS/SMDS_MeshPyramid.hxx | 114 + src/SMDS/SMDS_MeshPyramid.ixx | 75 + src/SMDS/SMDS_MeshPyramid.jxx | 6 + src/SMDS/SMDS_MeshPyramid.lxx | 61 + src/SMDS/SMDS_MeshQuadrangle.cdl | 43 + src/SMDS/SMDS_MeshQuadrangle.cxx | 62 + src/SMDS/SMDS_MeshQuadrangle.hxx | 108 + src/SMDS/SMDS_MeshQuadrangle.ixx | 75 + src/SMDS/SMDS_MeshQuadrangle.jxx | 3 + src/SMDS/SMDS_MeshQuadrangle.lxx | 53 + src/SMDS/SMDS_MeshTetrahedron.cdl | 67 + src/SMDS/SMDS_MeshTetrahedron.cxx | 128 + src/SMDS/SMDS_MeshTetrahedron.hxx | 114 + src/SMDS/SMDS_MeshTetrahedron.ixx | 75 + src/SMDS/SMDS_MeshTetrahedron.jxx | 6 + src/SMDS/SMDS_MeshTetrahedron.lxx | 62 + src/SMDS/SMDS_MeshTriangle.cdl | 44 + src/SMDS/SMDS_MeshTriangle.cxx | 50 + src/SMDS/SMDS_MeshTriangle.hxx | 108 + src/SMDS/SMDS_MeshTriangle.ixx | 75 + src/SMDS/SMDS_MeshTriangle.jxx | 3 + src/SMDS/SMDS_MeshTriangle.lxx | 56 + src/SMDS/SMDS_MeshVolume.cdl | 35 + src/SMDS/SMDS_MeshVolume.cxx | 34 + src/SMDS/SMDS_MeshVolume.hxx | 107 + src/SMDS/SMDS_MeshVolume.ixx | 73 + src/SMDS/SMDS_MeshVolume.jxx | 6 + src/SMDS/SMDS_MeshVolume.lxx | 16 + src/SMDS/SMDS_MeshVolumesIterator.cdl | 34 + src/SMDS/SMDS_MeshVolumesIterator.cxx | 42 + src/SMDS/SMDS_MeshVolumesIterator.hxx | 96 + src/SMDS/SMDS_MeshVolumesIterator.ixx | 19 + src/SMDS/SMDS_MeshVolumesIterator.jxx | 12 + src/SMDS/SMDS_PntHasher.cdl | 26 + src/SMDS/SMDS_PntHasher.cxx | 8 + src/SMDS/SMDS_PntHasher.hxx | 94 + src/SMDS/SMDS_PntHasher.ixx | 19 + src/SMDS/SMDS_PntHasher.jxx | 6 + src/SMDS/SMDS_PntHasher.lxx | 42 + src/SMDS/SMDS_Position.cdl | 48 + src/SMDS/SMDS_Position.cxx | 19 + src/SMDS/SMDS_Position.hxx | 109 + src/SMDS/SMDS_Position.ixx | 69 + src/SMDS/SMDS_Position.jxx | 6 + src/SMDS/SMDS_Position.lxx | 34 + .../SMDS_SequenceNodeOfSequenceOfMesh.hxx | 122 + .../SMDS_SequenceNodeOfSequenceOfMesh_0.cxx | 87 + src/SMDS/SMDS_SequenceOfMesh.hxx | 157 + src/SMDS/SMDS_SequenceOfMesh_0.cxx | 41 + src/SMDS/SMDS_SpacePosition.cdl | 38 + src/SMDS/SMDS_SpacePosition.cxx | 50 + src/SMDS/SMDS_SpacePosition.hxx | 109 + src/SMDS/SMDS_SpacePosition.ixx | 71 + src/SMDS/SMDS_SpacePosition.jxx | 6 + src/SMDS/SMDS_SpacePosition.lxx | 26 + src/SMDS/SMDS_StdMapNode.gxx | 1 + src/SMDS/SMDS_StdMapNode.lxx | 1 + src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx | 132 + src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx | 97 + .../SMDS_StdMapNodeOfExtendedOrientedMap.hxx | 132 + ...SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx | 97 + src/SMDS/SMDS_TypeOfPosition.hxx | 31 + src/SMDS/SMDS_VertexPosition.cdl | 26 + src/SMDS/SMDS_VertexPosition.cxx | 41 + src/SMDS/SMDS_VertexPosition.hxx | 101 + src/SMDS/SMDS_VertexPosition.ixx | 71 + src/SMDS/SMDS_VertexPosition.jxx | 6 + src/SMESH/Makefile.in | 81 + src/SMESH/SMESH_1D_Algo.cxx | 82 + src/SMESH/SMESH_1D_Algo.hxx | 30 + src/SMESH/SMESH_2D_Algo.cxx | 117 + src/SMESH/SMESH_2D_Algo.hxx | 34 + src/SMESH/SMESH_3D_Algo.cxx | 83 + src/SMESH/SMESH_3D_Algo.hxx | 30 + src/SMESH/SMESH_Algo.cxx | 224 + src/SMESH/SMESH_Algo.hxx | 60 + src/SMESH/SMESH_Gen.cxx | 390 + src/SMESH/SMESH_Gen.hxx | 76 + src/SMESH/SMESH_Hexa_3D.cxx | 960 ++ src/SMESH/SMESH_Hexa_3D.hxx | 119 + src/SMESH/SMESH_Hypothesis.cxx | 116 + src/SMESH/SMESH_Hypothesis.hxx | 33 + src/SMESH/SMESH_HypothesisCreator.hxx | 49 + src/SMESH/SMESH_HypothesisFactory.cxx | 154 + src/SMESH/SMESH_HypothesisFactory.hxx | 50 + src/SMESH/SMESH_LengthFromEdges.cxx | 117 + src/SMESH/SMESH_LengthFromEdges.hxx | 37 + src/SMESH/SMESH_LocalLength.cxx | 117 + src/SMESH/SMESH_LocalLength.hxx | 37 + src/SMESH/SMESH_MEFISTO_2D.cxx | 631 ++ src/SMESH/SMESH_MEFISTO_2D.hxx | 67 + src/SMESH/SMESH_MaxElementArea.cxx | 117 + src/SMESH/SMESH_MaxElementArea.hxx | 37 + src/SMESH/SMESH_MaxElementVolume.cxx | 9 + src/SMESH/SMESH_MaxElementVolume.hxx | 8 + src/SMESH/SMESH_Mesh.cxx | 572 ++ src/SMESH/SMESH_Mesh.hxx | 146 + src/SMESH/SMESH_NumberOfSegments.cxx | 115 + src/SMESH/SMESH_NumberOfSegments.hxx | 37 + src/SMESH/SMESH_Quadrangle_2D.cxx | 650 ++ src/SMESH/SMESH_Quadrangle_2D.hxx | 81 + src/SMESH/SMESH_Regular_1D.cxx | 305 + src/SMESH/SMESH_Regular_1D.hxx | 43 + src/SMESH/SMESH_subMesh.cxx | 1397 +++ src/SMESH/SMESH_subMesh.hxx | 109 + src/SMESHDS/Handle_SMESHDS_Command.hxx | 89 + ...SHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx | 89 + ...MapNodeOfDataMapOfIntegerPtrHypothesis.hxx | 89 + ...S_DataMapNodeOfDataMapOfIntegerSubMesh.hxx | 89 + ...odeOfDataMapOfShapeListOfPtrHypothesis.hxx | 89 + ...HDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx | 89 + src/SMESHDS/Handle_SMESHDS_Document.hxx | 89 + ...le_SMESHDS_ListNodeOfListOfAsciiString.hxx | 89 + ...Handle_SMESHDS_ListNodeOfListOfCommand.hxx | 89 + ..._SMESHDS_ListNodeOfListOfPtrHypothesis.hxx | 89 + src/SMESHDS/Handle_SMESHDS_Mesh.hxx | 89 + src/SMESHDS/Handle_SMESHDS_Script.hxx | 89 + src/SMESHDS/Handle_SMESHDS_SubMesh.hxx | 89 + src/SMESHDS/Makefile.in | 117 + src/SMESHDS/SMESHDS.cdl | 70 + src/SMESHDS/SMESHDS_Command.cdl | 62 + src/SMESHDS/SMESHDS_Command.cxx | 287 + src/SMESHDS/SMESHDS_Command.hxx | 131 + src/SMESHDS/SMESHDS_Command.ixx | 69 + src/SMESHDS/SMESHDS_Command.jxx | 9 + src/SMESHDS/SMESHDS_CommandType.hxx | 37 + ..._DataMapIteratorOfDataMapOfIntegerMesh.hxx | 106 + ...ataMapIteratorOfDataMapOfIntegerMesh_0.cxx | 50 + ...teratorOfDataMapOfIntegerPtrHypothesis.hxx | 105 + ...ratorOfDataMapOfIntegerPtrHypothesis_0.cxx | 47 + ...taMapIteratorOfDataMapOfIntegerSubMesh.hxx | 106 + ...MapIteratorOfDataMapOfIntegerSubMesh_0.cxx | 50 + ...torOfDataMapOfShapeListOfPtrHypothesis.hxx | 101 + ...rOfDataMapOfShapeListOfPtrHypothesis_0.cxx | 53 + ...DataMapIteratorOfDataMapOfShapeSubMesh.hxx | 104 + ...taMapIteratorOfDataMapOfShapeSubMesh_0.cxx | 53 + ...SHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx | 141 + ...DS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx | 99 + ...MapNodeOfDataMapOfIntegerPtrHypothesis.hxx | 140 + ...pNodeOfDataMapOfIntegerPtrHypothesis_0.cxx | 96 + ...S_DataMapNodeOfDataMapOfIntegerSubMesh.hxx | 141 + ...DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx | 99 + ...odeOfDataMapOfShapeListOfPtrHypothesis.hxx | 142 + ...eOfDataMapOfShapeListOfPtrHypothesis_0.cxx | 102 + ...HDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx | 142 + ...S_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx | 102 + src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx | 135 + .../SMESHDS_DataMapOfIntegerMesh_0.cxx | 53 + .../SMESHDS_DataMapOfIntegerPtrHypothesis.hxx | 134 + ...MESHDS_DataMapOfIntegerPtrHypothesis_0.cxx | 50 + .../SMESHDS_DataMapOfIntegerSubMesh.hxx | 135 + .../SMESHDS_DataMapOfIntegerSubMesh_0.cxx | 53 + ...SHDS_DataMapOfShapeListOfPtrHypothesis.hxx | 133 + ...DS_DataMapOfShapeListOfPtrHypothesis_0.cxx | 56 + src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx | 136 + .../SMESHDS_DataMapOfShapeSubMesh_0.cxx | 56 + src/SMESHDS/SMESHDS_Document.cdl | 66 + src/SMESHDS/SMESHDS_Document.cxx | 173 + src/SMESHDS/SMESHDS_Document.hxx | 141 + src/SMESHDS/SMESHDS_Document.ixx | 69 + src/SMESHDS/SMESHDS_Document.jxx | 6 + src/SMESHDS/SMESHDS_Hypothesis.cxx | 80 + src/SMESHDS/SMESHDS_Hypothesis.hxx | 47 + ...MESHDS_ListIteratorOfListOfAsciiString.hxx | 128 + ...SHDS_ListIteratorOfListOfAsciiString_0.cxx | 43 + .../SMESHDS_ListIteratorOfListOfCommand.hxx | 131 + .../SMESHDS_ListIteratorOfListOfCommand_0.cxx | 46 + ...SHDS_ListIteratorOfListOfPtrHypothesis.hxx | 130 + ...DS_ListIteratorOfListOfPtrHypothesis_0.cxx | 43 + .../SMESHDS_ListNodeOfListOfAsciiString.hxx | 127 + .../SMESHDS_ListNodeOfListOfAsciiString_0.cxx | 89 + .../SMESHDS_ListNodeOfListOfCommand.hxx | 127 + .../SMESHDS_ListNodeOfListOfCommand_0.cxx | 92 + .../SMESHDS_ListNodeOfListOfPtrHypothesis.hxx | 126 + ...MESHDS_ListNodeOfListOfPtrHypothesis_0.cxx | 89 + src/SMESHDS/SMESHDS_ListOfAsciiString.hxx | 152 + src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx | 40 + src/SMESHDS/SMESHDS_ListOfCommand.hxx | 155 + src/SMESHDS/SMESHDS_ListOfCommand_0.cxx | 43 + src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx | 154 + src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx | 40 + src/SMESHDS/SMESHDS_Mesh.cdl | 157 + src/SMESHDS/SMESHDS_Mesh.cxx | 601 ++ src/SMESHDS/SMESHDS_Mesh.hxx | 186 + src/SMESHDS/SMESHDS_Mesh.ixx | 73 + src/SMESHDS/SMESHDS_Mesh.jxx | 30 + src/SMESHDS/SMESHDS_PtrHypothesis.hxx | 22 + src/SMESHDS/SMESHDS_Script.cdl | 52 + src/SMESHDS/SMESHDS_Script.cxx | 304 + src/SMESHDS/SMESHDS_Script.hxx | 118 + src/SMESHDS/SMESHDS_Script.ixx | 69 + src/SMESHDS/SMESHDS_Script.jxx | 6 + src/SMESHDS/SMESHDS_SubMesh.cdl | 62 + src/SMESHDS/SMESHDS_SubMesh.cxx | 128 + src/SMESHDS/SMESHDS_SubMesh.hxx | 138 + src/SMESHDS/SMESHDS_SubMesh.ixx | 69 + src/SMESHDS/SMESHDS_SubMesh.jxx | 18 + .../Handle_SMESH_TypeFilter.hxx | 89 + src/SMESHFiltersSelection/Makefile.in | 40 + src/SMESHFiltersSelection/SMESH_Type.h | 21 + .../SMESH_TypeFilter.cxx | 139 + .../SMESH_TypeFilter.hxx | 95 + .../SMESH_TypeFilter.ixx | 71 + .../SMESH_TypeFilter.jxx | 3 + src/SMESHGUI/Makefile.in | 111 + src/SMESHGUI/SMESHGUI.cxx | 6013 ++++++++++++ src/SMESHGUI/SMESHGUI.h | 297 + src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx | 448 + src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h | 112 + src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx | 370 + src/SMESHGUI/SMESHGUI_AddEdgeDlg.h | 97 + src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx | 414 + src/SMESHGUI/SMESHGUI_AddFaceDlg.h | 102 + src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx | 449 + src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h | 114 + src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx | 516 + src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h | 126 + src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx | 388 + src/SMESHGUI/SMESHGUI_AddVolumeDlg.h | 98 + src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx | 409 + src/SMESHGUI/SMESHGUI_ComputeScalarValue.h | 26 + .../SMESHGUI_DiagonalInversionDlg.cxx | 351 + src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h | 94 + .../SMESHGUI_EdgesConnectivityDlg.cxx | 429 + src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h | 104 + src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx | 824 ++ src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h | 158 + src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx | 127 + src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h | 54 + src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx | 473 + src/SMESHGUI/SMESHGUI_InitMeshDlg.h | 121 + src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx | 315 + src/SMESHGUI/SMESHGUI_LocalLengthDlg.h | 89 + src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx | 315 + src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h | 89 + src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx | 319 + src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h | 89 + src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx | 428 + src/SMESHGUI/SMESHGUI_MeshInfosDlg.h | 83 + src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx | 467 + src/SMESHGUI/SMESHGUI_MoveNodesDlg.h | 111 + src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx | 310 + src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h | 89 + src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 397 + src/SMESHGUI/SMESHGUI_NodesDlg.h | 96 + .../SMESHGUI_OrientationElementsDlg.cxx | 354 + .../SMESHGUI_OrientationElementsDlg.h | 94 + .../SMESHGUI_Preferences_ColorDlg.cxx | 375 + src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h | 86 + .../SMESHGUI_Preferences_ScalarBarDlg.cxx | 187 + .../SMESHGUI_Preferences_ScalarBarDlg.h | 75 + src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx | 351 + src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h | 93 + src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx | 362 + src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h | 93 + src/SMESHGUI/SMESHGUI_SpinBox.cxx | 77 + src/SMESHGUI/SMESHGUI_SpinBox.h | 39 + src/SMESHGUI/SMESHGUI_StudyAPI.cxx | 691 ++ src/SMESHGUI/SMESHGUI_StudyAPI.h | 86 + src/SMESHGUI/SMESHGUI_Swig.cxx | 405 + src/SMESHGUI/SMESHGUI_Swig.hxx | 69 + src/SMESHGUI/SMESHGUI_Swig.i | 40 + src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx | 191 + src/SMESHGUI/SMESHGUI_TransparencyDlg.h | 71 + src/SMESHGUI/SMESHGUI_aParameterDlg.cxx | 234 + src/SMESHGUI/SMESHGUI_aParameterDlg.h | 65 + src/SMESH_I/Makefile.in | 63 + src/SMESH_I/SMESH_1D_Algo_i.cxx | 52 + src/SMESH_I/SMESH_1D_Algo_i.hxx | 35 + src/SMESH_I/SMESH_2D_Algo_i.cxx | 52 + src/SMESH_I/SMESH_2D_Algo_i.hxx | 35 + src/SMESH_I/SMESH_3D_Algo_i.cxx | 52 + src/SMESH_I/SMESH_3D_Algo_i.hxx | 35 + src/SMESH_I/SMESH_Algo_i.cxx | 76 + src/SMESH_I/SMESH_Algo_i.hxx | 37 + src/SMESH_I/SMESH_Gen_i.cxx | 1706 ++++ src/SMESH_I/SMESH_Gen_i.hxx | 134 + src/SMESH_I/SMESH_Hexa_3D_i.cxx | 61 + src/SMESH_I/SMESH_Hexa_3D_i.hxx | 36 + src/SMESH_I/SMESH_HypothesisFactory_i.cxx | 116 + src/SMESH_I/SMESH_HypothesisFactory_i.hxx | 40 + src/SMESH_I/SMESH_Hypothesis_i.cxx | 64 + src/SMESH_I/SMESH_Hypothesis_i.hxx | 35 + src/SMESH_I/SMESH_LocalLength_i.cxx | 79 + src/SMESH_I/SMESH_LocalLength_i.hxx | 40 + src/SMESH_I/SMESH_MEDFamily_i.cxx | 244 + src/SMESH_I/SMESH_MEDFamily_i.hxx | 59 + src/SMESH_I/SMESH_MEDMesh_i.cxx | 1018 ++ src/SMESH_I/SMESH_MEDMesh_i.hxx | 163 + src/SMESH_I/SMESH_MEDSupport_i.cxx | 353 + src/SMESH_I/SMESH_MEDSupport_i.hxx | 81 + src/SMESH_I/SMESH_MEFISTO_2D_i.cxx | 61 + src/SMESH_I/SMESH_MEFISTO_2D_i.hxx | 37 + src/SMESH_I/SMESH_MaxElementArea_i.cxx | 79 + src/SMESH_I/SMESH_MaxElementArea_i.hxx | 39 + src/SMESH_I/SMESH_MaxElementVolume_i.cxx | 9 + src/SMESH_I/SMESH_MaxElementVolume_i.hxx | 8 + src/SMESH_I/SMESH_MeshEditor_i.cxx | 215 + src/SMESH_I/SMESH_MeshEditor_i.hxx | 44 + src/SMESH_I/SMESH_Mesh_i.cxx | 636 ++ src/SMESH_I/SMESH_Mesh_i.hxx | 140 + src/SMESH_I/SMESH_NumberOfSegments_i.cxx | 80 + src/SMESH_I/SMESH_NumberOfSegments_i.hxx | 39 + src/SMESH_I/SMESH_Quadrangle_2D_i.cxx | 61 + src/SMESH_I/SMESH_Quadrangle_2D_i.hxx | 37 + src/SMESH_I/SMESH_Regular_1D_i.cxx | 61 + src/SMESH_I/SMESH_Regular_1D_i.hxx | 37 + src/SMESH_I/SMESH_subMesh_i.cxx | 155 + src/SMESH_I/SMESH_subMesh_i.hxx | 60 + src/SMESH_I/SMESH_test.py | 203 + src/SMESH_I/SMESH_topo.cxx | 40 + src/SMESH_I/SMESH_topo.hxx | 61 + src/SMESH_I/smeshpy.py | 70 + src/SMESH_I/sstream | 225 + src/SMESH_SWIG/Makefile.in | 43 + src/SMESH_SWIG/SMESH_fixation.py | 464 + src/SMESH_SWIG/SMESH_mechanic.py | 308 + src/SMESH_SWIG/SMESH_test0.py | 54 + src/SMESH_SWIG/SMESH_test1.py | 185 + src/SMESH_SWIG/SMESH_test2.py | 43 + src/SMESH_SWIG/SMESH_test3.py | 90 + src/SMESH_SWIG/batchmode_smesh.py | 302 + src/SMESH_SWIG/libSMESH_Swig.i | 12 + 617 files changed, 80983 insertions(+) create mode 100644 idl/SMESH_BasicHypothesis.idl create mode 100644 idl/SMESH_Gen.idl create mode 100644 idl/SMESH_Hypothesis.idl create mode 100644 idl/SMESH_Mesh.idl create mode 100644 src/Driver/Document_Reader.cxx create mode 100644 src/Driver/Document_Reader.h create mode 100644 src/Driver/Document_Writer.cxx create mode 100644 src/Driver/Document_Writer.h create mode 100644 src/Driver/Driver_dl.cxx create mode 100644 src/Driver/Makefile.in create mode 100644 src/Driver/Mesh_Reader.cxx create mode 100644 src/Driver/Mesh_Reader.h create mode 100644 src/Driver/Mesh_Writer.cxx create mode 100644 src/Driver/Mesh_Writer.h create mode 100644 src/Driver/SMESHDriver.cxx create mode 100644 src/Driver/SMESHDriver.h create mode 100644 src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Document.h create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Document.h create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h create mode 100644 src/DriverDAT/Makefile.in create mode 100644 src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Document.h create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Document.h create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h create mode 100644 src/DriverUNV/Makefile.in create mode 100644 src/MEFISTO2/Makefile.in create mode 100755 src/MEFISTO2/Rn.h create mode 100755 src/MEFISTO2/aptrte.cxx create mode 100755 src/MEFISTO2/aptrte.h create mode 100755 src/MEFISTO2/areteideale.f create mode 100755 src/MEFISTO2/trte.f create mode 100644 src/Makefile.in create mode 100644 src/OBJECT/Makefile.in create mode 100644 src/OBJECT/SMESH_Actor.cxx create mode 100644 src/OBJECT/SMESH_Actor.h create mode 100644 src/OBJECT/SMESH_Grid.cxx create mode 100644 src/OBJECT/SMESH_Grid.h create mode 100644 src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx create mode 100644 src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx create mode 100644 src/SMDS/Handle_SMDSControl_MeshBoundary.hxx create mode 100644 src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx create mode 100644 src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx create mode 100644 src/SMDS/Handle_SMDS_EdgePosition.hxx create mode 100644 src/SMDS/Handle_SMDS_FacePosition.hxx create mode 100644 src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx create mode 100644 src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx create mode 100644 src/SMDS/Handle_SMDS_ListNodeOfListOfMeshElement.hxx create mode 100644 src/SMDS/Handle_SMDS_ListNodeOfListOfMeshGroup.hxx create mode 100644 src/SMDS/Handle_SMDS_Mesh.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshEdge.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshElement.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshFace.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshGroup.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshHexahedron.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshIDFactory.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshNode.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshObject.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshPrism.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshPyramid.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshQuadrangle.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshTetrahedron.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshTriangle.hxx create mode 100644 src/SMDS/Handle_SMDS_MeshVolume.hxx create mode 100644 src/SMDS/Handle_SMDS_Position.hxx create mode 100644 src/SMDS/Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx create mode 100644 src/SMDS/Handle_SMDS_SpacePosition.hxx create mode 100644 src/SMDS/Handle_SMDS_StdMapNodeOfExtendedMap.hxx create mode 100644 src/SMDS/Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx create mode 100644 src/SMDS/Handle_SMDS_VertexPosition.hxx create mode 100644 src/SMDS/Makefile.in create mode 100755 src/SMDS/SMDS.cdl create mode 100644 src/SMDS/SMDSAbs.cdl create mode 100644 src/SMDS/SMDSAbs_ElementType.hxx create mode 100644 src/SMDS/SMDSControl.cdl create mode 100644 src/SMDS/SMDSControl.cxx create mode 100644 src/SMDS/SMDSControl.hxx create mode 100644 src/SMDS/SMDSControl.ixx create mode 100644 src/SMDS/SMDSControl.jxx create mode 100644 src/SMDS/SMDSControl_BoundaryEdges.cdl create mode 100644 src/SMDS/SMDSControl_BoundaryEdges.cxx create mode 100644 src/SMDS/SMDSControl_BoundaryEdges.hxx create mode 100644 src/SMDS/SMDSControl_BoundaryEdges.ixx create mode 100644 src/SMDS/SMDSControl_BoundaryEdges.jxx create mode 100644 src/SMDS/SMDSControl_BoundaryFaces.cdl create mode 100644 src/SMDS/SMDSControl_BoundaryFaces.cxx create mode 100644 src/SMDS/SMDSControl_BoundaryFaces.hxx create mode 100644 src/SMDS/SMDSControl_BoundaryFaces.ixx create mode 100644 src/SMDS/SMDSControl_BoundaryFaces.jxx create mode 100644 src/SMDS/SMDSControl_MeshBoundary.cdl create mode 100644 src/SMDS/SMDSControl_MeshBoundary.cxx create mode 100644 src/SMDS/SMDSControl_MeshBoundary.hxx create mode 100644 src/SMDS/SMDSControl_MeshBoundary.ixx create mode 100644 src/SMDS/SMDSControl_MeshBoundary.jxx create mode 100644 src/SMDS/SMDSEdit.cdl create mode 100644 src/SMDS/SMDSEdit_Transform.cdl create mode 100644 src/SMDS/SMDSEdit_Transform.cxx create mode 100644 src/SMDS/SMDSEdit_Transform.hxx create mode 100644 src/SMDS/SMDSEdit_Transform.ixx create mode 100644 src/SMDS/SMDSEdit_Transform.jxx create mode 100644 src/SMDS/SMDS_BasicMap.lxx create mode 100644 src/SMDS/SMDS_BasicMapIterator.lxx create mode 100644 src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx create mode 100644 src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx create mode 100644 src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx create mode 100644 src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx create mode 100644 src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger.hxx create mode 100644 src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx create mode 100644 src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx create mode 100644 src/SMDS/SMDS_DataMapOfIntegerMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_DataMapOfPntInteger.hxx create mode 100644 src/SMDS/SMDS_DataMapOfPntInteger_0.cxx create mode 100644 src/SMDS/SMDS_EdgePosition.cdl create mode 100644 src/SMDS/SMDS_EdgePosition.cxx create mode 100644 src/SMDS/SMDS_EdgePosition.hxx create mode 100644 src/SMDS/SMDS_EdgePosition.ixx create mode 100644 src/SMDS/SMDS_EdgePosition.jxx create mode 100644 src/SMDS/SMDS_EdgePosition.lxx create mode 100644 src/SMDS/SMDS_ExtendedMap.hxx create mode 100644 src/SMDS/SMDS_ExtendedMap_0.cxx create mode 100644 src/SMDS/SMDS_ExtendedOrientedMap.hxx create mode 100644 src/SMDS/SMDS_ExtendedOrientedMap_0.cxx create mode 100644 src/SMDS/SMDS_FacePosition.cdl create mode 100644 src/SMDS/SMDS_FacePosition.cxx create mode 100644 src/SMDS/SMDS_FacePosition.hxx create mode 100644 src/SMDS/SMDS_FacePosition.ixx create mode 100644 src/SMDS/SMDS_FacePosition.jxx create mode 100644 src/SMDS/SMDS_FacePosition.lxx create mode 100644 src/SMDS/SMDS_HSequenceOfMesh.hxx create mode 100644 src/SMDS/SMDS_HSequenceOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMeshElement.hxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMeshGroup.hxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMeshGroup_0.cxx create mode 100644 src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMesh.hxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx create mode 100644 src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_ListOfMesh.hxx create mode 100644 src/SMDS/SMDS_ListOfMeshElement.hxx create mode 100644 src/SMDS/SMDS_ListOfMeshElement_0.cxx create mode 100644 src/SMDS/SMDS_ListOfMeshGroup.hxx create mode 100644 src/SMDS/SMDS_ListOfMeshGroup_0.cxx create mode 100644 src/SMDS/SMDS_ListOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_Map.gxx create mode 100644 src/SMDS/SMDS_MapHasher.gxx create mode 100644 src/SMDS/SMDS_MapIterator.gxx create mode 100644 src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx create mode 100644 src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx create mode 100644 src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap.hxx create mode 100644 src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap_0.cxx create mode 100644 src/SMDS/SMDS_MapNode.lxx create mode 100644 src/SMDS/SMDS_MapOfMeshElement.cdl create mode 100644 src/SMDS/SMDS_MapOfMeshElement.cxx create mode 100644 src/SMDS/SMDS_MapOfMeshElement.hxx create mode 100644 src/SMDS/SMDS_MapOfMeshElement.ixx create mode 100644 src/SMDS/SMDS_MapOfMeshElement.jxx create mode 100644 src/SMDS/SMDS_MapOfMeshElement.lxx create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.cdl create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.cxx create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.hxx create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.ixx create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.jxx create mode 100644 src/SMDS/SMDS_MapOfMeshOrientedElement.lxx create mode 100755 src/SMDS/SMDS_Mesh.cdl create mode 100644 src/SMDS/SMDS_Mesh.cxx create mode 100644 src/SMDS/SMDS_Mesh.hxx create mode 100644 src/SMDS/SMDS_Mesh.ixx create mode 100644 src/SMDS/SMDS_Mesh.jxx create mode 100644 src/SMDS/SMDS_Mesh.lxx create mode 100755 src/SMDS/SMDS_MeshEdge.cdl create mode 100644 src/SMDS/SMDS_MeshEdge.cxx create mode 100644 src/SMDS/SMDS_MeshEdge.hxx create mode 100644 src/SMDS/SMDS_MeshEdge.ixx create mode 100644 src/SMDS/SMDS_MeshEdge.jxx create mode 100644 src/SMDS/SMDS_MeshEdge.lxx create mode 100644 src/SMDS/SMDS_MeshEdgesIterator.cdl create mode 100644 src/SMDS/SMDS_MeshEdgesIterator.cxx create mode 100644 src/SMDS/SMDS_MeshEdgesIterator.hxx create mode 100644 src/SMDS/SMDS_MeshEdgesIterator.ixx create mode 100644 src/SMDS/SMDS_MeshEdgesIterator.jxx create mode 100644 src/SMDS/SMDS_MeshElement.cdl create mode 100644 src/SMDS/SMDS_MeshElement.cxx create mode 100644 src/SMDS/SMDS_MeshElement.hxx create mode 100644 src/SMDS/SMDS_MeshElement.ixx create mode 100644 src/SMDS/SMDS_MeshElement.jxx create mode 100644 src/SMDS/SMDS_MeshElement.lxx create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.cdl create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.cxx create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.hxx create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.ixx create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.jxx create mode 100644 src/SMDS/SMDS_MeshElementIDFactory.lxx create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.cdl create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.cxx create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.hxx create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.ixx create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.jxx create mode 100644 src/SMDS/SMDS_MeshElementMapHasher.lxx create mode 100644 src/SMDS/SMDS_MeshElementsIterator.cdl create mode 100644 src/SMDS/SMDS_MeshElementsIterator.cxx create mode 100644 src/SMDS/SMDS_MeshElementsIterator.hxx create mode 100644 src/SMDS/SMDS_MeshElementsIterator.ixx create mode 100644 src/SMDS/SMDS_MeshElementsIterator.jxx create mode 100644 src/SMDS/SMDS_MeshElementsIterator.lxx create mode 100755 src/SMDS/SMDS_MeshFace.cdl create mode 100644 src/SMDS/SMDS_MeshFace.cxx create mode 100644 src/SMDS/SMDS_MeshFace.hxx create mode 100644 src/SMDS/SMDS_MeshFace.ixx create mode 100644 src/SMDS/SMDS_MeshFace.jxx create mode 100644 src/SMDS/SMDS_MeshFace.lxx create mode 100644 src/SMDS/SMDS_MeshFacesIterator.cdl create mode 100644 src/SMDS/SMDS_MeshFacesIterator.cxx create mode 100644 src/SMDS/SMDS_MeshFacesIterator.hxx create mode 100644 src/SMDS/SMDS_MeshFacesIterator.ixx create mode 100644 src/SMDS/SMDS_MeshFacesIterator.jxx create mode 100644 src/SMDS/SMDS_MeshGroup.cdl create mode 100644 src/SMDS/SMDS_MeshGroup.cxx create mode 100644 src/SMDS/SMDS_MeshGroup.hxx create mode 100644 src/SMDS/SMDS_MeshGroup.ixx create mode 100644 src/SMDS/SMDS_MeshGroup.jxx create mode 100644 src/SMDS/SMDS_MeshGroup.lxx create mode 100644 src/SMDS/SMDS_MeshHexahedron.cdl create mode 100644 src/SMDS/SMDS_MeshHexahedron.cxx create mode 100644 src/SMDS/SMDS_MeshHexahedron.hxx create mode 100644 src/SMDS/SMDS_MeshHexahedron.ixx create mode 100644 src/SMDS/SMDS_MeshHexahedron.jxx create mode 100644 src/SMDS/SMDS_MeshHexahedron.lxx create mode 100644 src/SMDS/SMDS_MeshIDFactory.cdl create mode 100644 src/SMDS/SMDS_MeshIDFactory.cxx create mode 100644 src/SMDS/SMDS_MeshIDFactory.hxx create mode 100644 src/SMDS/SMDS_MeshIDFactory.ixx create mode 100644 src/SMDS/SMDS_MeshIDFactory.jxx create mode 100644 src/SMDS/SMDS_MeshIDFactory.lxx create mode 100755 src/SMDS/SMDS_MeshNode.cdl create mode 100644 src/SMDS/SMDS_MeshNode.cxx create mode 100644 src/SMDS/SMDS_MeshNode.hxx create mode 100644 src/SMDS/SMDS_MeshNode.ixx create mode 100644 src/SMDS/SMDS_MeshNode.jxx create mode 100644 src/SMDS/SMDS_MeshNode.lxx create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.cdl create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.cxx create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.hxx create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.ixx create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.jxx create mode 100644 src/SMDS/SMDS_MeshNodeIDFactory.lxx create mode 100644 src/SMDS/SMDS_MeshNodesIterator.cdl create mode 100644 src/SMDS/SMDS_MeshNodesIterator.cxx create mode 100644 src/SMDS/SMDS_MeshNodesIterator.hxx create mode 100644 src/SMDS/SMDS_MeshNodesIterator.ixx create mode 100644 src/SMDS/SMDS_MeshNodesIterator.jxx create mode 100644 src/SMDS/SMDS_MeshObject.cdl create mode 100644 src/SMDS/SMDS_MeshObject.cxx create mode 100644 src/SMDS/SMDS_MeshObject.hxx create mode 100644 src/SMDS/SMDS_MeshObject.ixx create mode 100644 src/SMDS/SMDS_MeshObject.jxx create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.cdl create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.cxx create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.hxx create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.ixx create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.jxx create mode 100644 src/SMDS/SMDS_MeshOrientedElementMapHasher.lxx create mode 100644 src/SMDS/SMDS_MeshPrism.cdl create mode 100644 src/SMDS/SMDS_MeshPrism.cxx create mode 100644 src/SMDS/SMDS_MeshPrism.hxx create mode 100644 src/SMDS/SMDS_MeshPrism.ixx create mode 100644 src/SMDS/SMDS_MeshPrism.jxx create mode 100644 src/SMDS/SMDS_MeshPrism.lxx create mode 100644 src/SMDS/SMDS_MeshPyramid.cdl create mode 100644 src/SMDS/SMDS_MeshPyramid.cxx create mode 100644 src/SMDS/SMDS_MeshPyramid.hxx create mode 100644 src/SMDS/SMDS_MeshPyramid.ixx create mode 100644 src/SMDS/SMDS_MeshPyramid.jxx create mode 100644 src/SMDS/SMDS_MeshPyramid.lxx create mode 100644 src/SMDS/SMDS_MeshQuadrangle.cdl create mode 100644 src/SMDS/SMDS_MeshQuadrangle.cxx create mode 100644 src/SMDS/SMDS_MeshQuadrangle.hxx create mode 100644 src/SMDS/SMDS_MeshQuadrangle.ixx create mode 100644 src/SMDS/SMDS_MeshQuadrangle.jxx create mode 100644 src/SMDS/SMDS_MeshQuadrangle.lxx create mode 100644 src/SMDS/SMDS_MeshTetrahedron.cdl create mode 100644 src/SMDS/SMDS_MeshTetrahedron.cxx create mode 100644 src/SMDS/SMDS_MeshTetrahedron.hxx create mode 100644 src/SMDS/SMDS_MeshTetrahedron.ixx create mode 100644 src/SMDS/SMDS_MeshTetrahedron.jxx create mode 100644 src/SMDS/SMDS_MeshTetrahedron.lxx create mode 100644 src/SMDS/SMDS_MeshTriangle.cdl create mode 100644 src/SMDS/SMDS_MeshTriangle.cxx create mode 100644 src/SMDS/SMDS_MeshTriangle.hxx create mode 100644 src/SMDS/SMDS_MeshTriangle.ixx create mode 100644 src/SMDS/SMDS_MeshTriangle.jxx create mode 100644 src/SMDS/SMDS_MeshTriangle.lxx create mode 100755 src/SMDS/SMDS_MeshVolume.cdl create mode 100644 src/SMDS/SMDS_MeshVolume.cxx create mode 100644 src/SMDS/SMDS_MeshVolume.hxx create mode 100644 src/SMDS/SMDS_MeshVolume.ixx create mode 100644 src/SMDS/SMDS_MeshVolume.jxx create mode 100644 src/SMDS/SMDS_MeshVolume.lxx create mode 100644 src/SMDS/SMDS_MeshVolumesIterator.cdl create mode 100644 src/SMDS/SMDS_MeshVolumesIterator.cxx create mode 100644 src/SMDS/SMDS_MeshVolumesIterator.hxx create mode 100644 src/SMDS/SMDS_MeshVolumesIterator.ixx create mode 100644 src/SMDS/SMDS_MeshVolumesIterator.jxx create mode 100644 src/SMDS/SMDS_PntHasher.cdl create mode 100644 src/SMDS/SMDS_PntHasher.cxx create mode 100644 src/SMDS/SMDS_PntHasher.hxx create mode 100644 src/SMDS/SMDS_PntHasher.ixx create mode 100644 src/SMDS/SMDS_PntHasher.jxx create mode 100644 src/SMDS/SMDS_PntHasher.lxx create mode 100644 src/SMDS/SMDS_Position.cdl create mode 100644 src/SMDS/SMDS_Position.cxx create mode 100644 src/SMDS/SMDS_Position.hxx create mode 100644 src/SMDS/SMDS_Position.ixx create mode 100644 src/SMDS/SMDS_Position.jxx create mode 100644 src/SMDS/SMDS_Position.lxx create mode 100644 src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh.hxx create mode 100644 src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_SequenceOfMesh.hxx create mode 100644 src/SMDS/SMDS_SequenceOfMesh_0.cxx create mode 100644 src/SMDS/SMDS_SpacePosition.cdl create mode 100644 src/SMDS/SMDS_SpacePosition.cxx create mode 100644 src/SMDS/SMDS_SpacePosition.hxx create mode 100644 src/SMDS/SMDS_SpacePosition.ixx create mode 100644 src/SMDS/SMDS_SpacePosition.jxx create mode 100644 src/SMDS/SMDS_SpacePosition.lxx create mode 100644 src/SMDS/SMDS_StdMapNode.gxx create mode 100644 src/SMDS/SMDS_StdMapNode.lxx create mode 100644 src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx create mode 100644 src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx create mode 100644 src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap.hxx create mode 100644 src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx create mode 100644 src/SMDS/SMDS_TypeOfPosition.hxx create mode 100644 src/SMDS/SMDS_VertexPosition.cdl create mode 100644 src/SMDS/SMDS_VertexPosition.cxx create mode 100644 src/SMDS/SMDS_VertexPosition.hxx create mode 100644 src/SMDS/SMDS_VertexPosition.ixx create mode 100644 src/SMDS/SMDS_VertexPosition.jxx create mode 100644 src/SMESH/Makefile.in create mode 100644 src/SMESH/SMESH_1D_Algo.cxx create mode 100644 src/SMESH/SMESH_1D_Algo.hxx create mode 100644 src/SMESH/SMESH_2D_Algo.cxx create mode 100644 src/SMESH/SMESH_2D_Algo.hxx create mode 100644 src/SMESH/SMESH_3D_Algo.cxx create mode 100644 src/SMESH/SMESH_3D_Algo.hxx create mode 100644 src/SMESH/SMESH_Algo.cxx create mode 100644 src/SMESH/SMESH_Algo.hxx create mode 100644 src/SMESH/SMESH_Gen.cxx create mode 100644 src/SMESH/SMESH_Gen.hxx create mode 100644 src/SMESH/SMESH_Hexa_3D.cxx create mode 100644 src/SMESH/SMESH_Hexa_3D.hxx create mode 100644 src/SMESH/SMESH_Hypothesis.cxx create mode 100644 src/SMESH/SMESH_Hypothesis.hxx create mode 100644 src/SMESH/SMESH_HypothesisCreator.hxx create mode 100644 src/SMESH/SMESH_HypothesisFactory.cxx create mode 100644 src/SMESH/SMESH_HypothesisFactory.hxx create mode 100644 src/SMESH/SMESH_LengthFromEdges.cxx create mode 100644 src/SMESH/SMESH_LengthFromEdges.hxx create mode 100644 src/SMESH/SMESH_LocalLength.cxx create mode 100644 src/SMESH/SMESH_LocalLength.hxx create mode 100644 src/SMESH/SMESH_MEFISTO_2D.cxx create mode 100644 src/SMESH/SMESH_MEFISTO_2D.hxx create mode 100644 src/SMESH/SMESH_MaxElementArea.cxx create mode 100644 src/SMESH/SMESH_MaxElementArea.hxx create mode 100644 src/SMESH/SMESH_MaxElementVolume.cxx create mode 100644 src/SMESH/SMESH_MaxElementVolume.hxx create mode 100644 src/SMESH/SMESH_Mesh.cxx create mode 100644 src/SMESH/SMESH_Mesh.hxx create mode 100644 src/SMESH/SMESH_NumberOfSegments.cxx create mode 100644 src/SMESH/SMESH_NumberOfSegments.hxx create mode 100644 src/SMESH/SMESH_Quadrangle_2D.cxx create mode 100644 src/SMESH/SMESH_Quadrangle_2D.hxx create mode 100644 src/SMESH/SMESH_Regular_1D.cxx create mode 100644 src/SMESH/SMESH_Regular_1D.hxx create mode 100644 src/SMESH/SMESH_subMesh.cxx create mode 100644 src/SMESH/SMESH_subMesh.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_Command.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_Document.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfCommand.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_Mesh.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_Script.hxx create mode 100644 src/SMESHDS/Handle_SMESHDS_SubMesh.hxx create mode 100644 src/SMESHDS/Makefile.in create mode 100644 src/SMESHDS/SMESHDS.cdl create mode 100644 src/SMESHDS/SMESHDS_Command.cdl create mode 100644 src/SMESHDS/SMESHDS_Command.cxx create mode 100644 src/SMESHDS/SMESHDS_Command.hxx create mode 100644 src/SMESHDS/SMESHDS_Command.ixx create mode 100644 src/SMESHDS/SMESHDS_Command.jxx create mode 100644 src/SMESHDS/SMESHDS_CommandType.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh_0.cxx create mode 100644 src/SMESHDS/SMESHDS_Document.cdl create mode 100644 src/SMESHDS/SMESHDS_Document.cxx create mode 100644 src/SMESHDS/SMESHDS_Document.hxx create mode 100644 src/SMESHDS/SMESHDS_Document.ixx create mode 100644 src/SMESHDS/SMESHDS_Document.jxx create mode 100644 src/SMESHDS/SMESHDS_Hypothesis.cxx create mode 100644 src/SMESHDS/SMESHDS_Hypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString.hxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand.hxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString.hxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfCommand.hxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfCommand_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListOfAsciiString.hxx create mode 100644 src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListOfCommand.hxx create mode 100644 src/SMESHDS/SMESHDS_ListOfCommand_0.cxx create mode 100644 src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx create mode 100644 src/SMESHDS/SMESHDS_Mesh.cdl create mode 100644 src/SMESHDS/SMESHDS_Mesh.cxx create mode 100644 src/SMESHDS/SMESHDS_Mesh.hxx create mode 100644 src/SMESHDS/SMESHDS_Mesh.ixx create mode 100644 src/SMESHDS/SMESHDS_Mesh.jxx create mode 100644 src/SMESHDS/SMESHDS_PtrHypothesis.hxx create mode 100644 src/SMESHDS/SMESHDS_Script.cdl create mode 100644 src/SMESHDS/SMESHDS_Script.cxx create mode 100644 src/SMESHDS/SMESHDS_Script.hxx create mode 100644 src/SMESHDS/SMESHDS_Script.ixx create mode 100644 src/SMESHDS/SMESHDS_Script.jxx create mode 100644 src/SMESHDS/SMESHDS_SubMesh.cdl create mode 100644 src/SMESHDS/SMESHDS_SubMesh.cxx create mode 100644 src/SMESHDS/SMESHDS_SubMesh.hxx create mode 100644 src/SMESHDS/SMESHDS_SubMesh.ixx create mode 100644 src/SMESHDS/SMESHDS_SubMesh.jxx create mode 100644 src/SMESHFiltersSelection/Handle_SMESH_TypeFilter.hxx create mode 100644 src/SMESHFiltersSelection/Makefile.in create mode 100644 src/SMESHFiltersSelection/SMESH_Type.h create mode 100644 src/SMESHFiltersSelection/SMESH_TypeFilter.cxx create mode 100644 src/SMESHFiltersSelection/SMESH_TypeFilter.hxx create mode 100644 src/SMESHFiltersSelection/SMESH_TypeFilter.ixx create mode 100644 src/SMESHFiltersSelection/SMESH_TypeFilter.jxx create mode 100644 src/SMESHGUI/Makefile.in create mode 100644 src/SMESHGUI/SMESHGUI.cxx create mode 100644 src/SMESHGUI/SMESHGUI.h create mode 100644 src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddEdgeDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddFaceDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_AddVolumeDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx create mode 100644 src/SMESHGUI/SMESHGUI_ComputeScalarValue.h create mode 100644 src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_InitMeshDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_LocalLengthDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_MeshInfosDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_MoveNodesDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_NodesDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_NodesDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_OrientationElementsDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_OrientationElementsDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_SpinBox.cxx create mode 100644 src/SMESHGUI/SMESHGUI_SpinBox.h create mode 100644 src/SMESHGUI/SMESHGUI_StudyAPI.cxx create mode 100644 src/SMESHGUI/SMESHGUI_StudyAPI.h create mode 100644 src/SMESHGUI/SMESHGUI_Swig.cxx create mode 100644 src/SMESHGUI/SMESHGUI_Swig.hxx create mode 100644 src/SMESHGUI/SMESHGUI_Swig.i create mode 100644 src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_TransparencyDlg.h create mode 100644 src/SMESHGUI/SMESHGUI_aParameterDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_aParameterDlg.h create mode 100644 src/SMESH_I/Makefile.in create mode 100644 src/SMESH_I/SMESH_1D_Algo_i.cxx create mode 100644 src/SMESH_I/SMESH_1D_Algo_i.hxx create mode 100644 src/SMESH_I/SMESH_2D_Algo_i.cxx create mode 100644 src/SMESH_I/SMESH_2D_Algo_i.hxx create mode 100644 src/SMESH_I/SMESH_3D_Algo_i.cxx create mode 100644 src/SMESH_I/SMESH_3D_Algo_i.hxx create mode 100644 src/SMESH_I/SMESH_Algo_i.cxx create mode 100644 src/SMESH_I/SMESH_Algo_i.hxx create mode 100644 src/SMESH_I/SMESH_Gen_i.cxx create mode 100644 src/SMESH_I/SMESH_Gen_i.hxx create mode 100644 src/SMESH_I/SMESH_Hexa_3D_i.cxx create mode 100644 src/SMESH_I/SMESH_Hexa_3D_i.hxx create mode 100644 src/SMESH_I/SMESH_HypothesisFactory_i.cxx create mode 100644 src/SMESH_I/SMESH_HypothesisFactory_i.hxx create mode 100644 src/SMESH_I/SMESH_Hypothesis_i.cxx create mode 100644 src/SMESH_I/SMESH_Hypothesis_i.hxx create mode 100644 src/SMESH_I/SMESH_LocalLength_i.cxx create mode 100644 src/SMESH_I/SMESH_LocalLength_i.hxx create mode 100644 src/SMESH_I/SMESH_MEDFamily_i.cxx create mode 100644 src/SMESH_I/SMESH_MEDFamily_i.hxx create mode 100644 src/SMESH_I/SMESH_MEDMesh_i.cxx create mode 100644 src/SMESH_I/SMESH_MEDMesh_i.hxx create mode 100644 src/SMESH_I/SMESH_MEDSupport_i.cxx create mode 100644 src/SMESH_I/SMESH_MEDSupport_i.hxx create mode 100644 src/SMESH_I/SMESH_MEFISTO_2D_i.cxx create mode 100644 src/SMESH_I/SMESH_MEFISTO_2D_i.hxx create mode 100644 src/SMESH_I/SMESH_MaxElementArea_i.cxx create mode 100644 src/SMESH_I/SMESH_MaxElementArea_i.hxx create mode 100644 src/SMESH_I/SMESH_MaxElementVolume_i.cxx create mode 100644 src/SMESH_I/SMESH_MaxElementVolume_i.hxx create mode 100644 src/SMESH_I/SMESH_MeshEditor_i.cxx create mode 100644 src/SMESH_I/SMESH_MeshEditor_i.hxx create mode 100644 src/SMESH_I/SMESH_Mesh_i.cxx create mode 100644 src/SMESH_I/SMESH_Mesh_i.hxx create mode 100644 src/SMESH_I/SMESH_NumberOfSegments_i.cxx create mode 100644 src/SMESH_I/SMESH_NumberOfSegments_i.hxx create mode 100644 src/SMESH_I/SMESH_Quadrangle_2D_i.cxx create mode 100644 src/SMESH_I/SMESH_Quadrangle_2D_i.hxx create mode 100644 src/SMESH_I/SMESH_Regular_1D_i.cxx create mode 100644 src/SMESH_I/SMESH_Regular_1D_i.hxx create mode 100644 src/SMESH_I/SMESH_subMesh_i.cxx create mode 100644 src/SMESH_I/SMESH_subMesh_i.hxx create mode 100644 src/SMESH_I/SMESH_test.py create mode 100644 src/SMESH_I/SMESH_topo.cxx create mode 100644 src/SMESH_I/SMESH_topo.hxx create mode 100644 src/SMESH_I/smeshpy.py create mode 100644 src/SMESH_I/sstream create mode 100644 src/SMESH_SWIG/Makefile.in create mode 100644 src/SMESH_SWIG/SMESH_fixation.py create mode 100644 src/SMESH_SWIG/SMESH_mechanic.py create mode 100644 src/SMESH_SWIG/SMESH_test0.py create mode 100644 src/SMESH_SWIG/SMESH_test1.py create mode 100644 src/SMESH_SWIG/SMESH_test2.py create mode 100644 src/SMESH_SWIG/SMESH_test3.py create mode 100644 src/SMESH_SWIG/batchmode_smesh.py create mode 100644 src/SMESH_SWIG/libSMESH_Swig.i diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl new file mode 100644 index 000000000..694b791ba --- /dev/null +++ b/idl/SMESH_BasicHypothesis.idl @@ -0,0 +1,64 @@ +//============================================================================= +// File : SMESH_BasicHypothesis.idl +// Created : mer mai 15 13:37:18 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_BASICHYPOTHESIS_IDL_ +#define _SMESH_BASICHYPOTHESIS_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" + + +module SMESH +{ + interface SMESH_LocalLength : SMESH_Hypothesis + { + void SetLength(in double length) + raises (SALOME::SALOME_Exception); + double GetLength(); + }; + + interface SMESH_NumberOfSegments : SMESH_Hypothesis + { + void SetNumberOfSegments(in long segmentsNumber) + raises (SALOME::SALOME_Exception); + long GetNumberOfSegments(); + }; + + interface SMESH_MaxElementArea : SMESH_Hypothesis + { + void SetMaxElementArea(in double area) + raises (SALOME::SALOME_Exception); + double GetMaxElementArea(); + }; + + interface SMESH_MaxElementVolume : SMESH_Hypothesis + { + void SetMaxElementVolume(in double volume) + raises (SALOME::SALOME_Exception); + double GetMaxElementVolume(); + }; + + interface SMESH_Regular_1D : SMESH_1D_Algo + { + }; + + interface SMESH_MEFISTO_2D : SMESH_2D_Algo + { + }; + + interface SMESH_Quadrangle_2D : SMESH_2D_Algo + { + }; + + interface SMESH_Hexa_3D : SMESH_3D_Algo + { + }; +}; + +#endif diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl new file mode 100644 index 000000000..5617d144b --- /dev/null +++ b/idl/SMESH_Gen.idl @@ -0,0 +1,96 @@ +//============================================================================= +// File : SMESH_Gen.idl +// Created : jeu avr 11 15:26:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_GEN_IDL_ +#define _SMESH_GEN_IDL_ + +#include "SALOME_Exception.idl" +#include "SALOME_Component.idl" +#include "SALOMEDS.idl" + +#include "GEOM_Gen.idl" +#include "GEOM_Shape.idl" + +#include "SMESH_Mesh.idl" +#include "SMESH_Hypothesis.idl" + +module SMESH +{ + typedef sequence shape_array; + + interface SMESH_Gen : Engines::Component, SALOMEDS::Driver + { + /*! + * Create an hypothesis that can be shared by differents parts of the mesh. + * An hypothesis is either: + * - a method used to generate or modify a part of the mesh (algorithm). + * - a parameter or a law used by an algorithm. + * Algorithms are 1D, 2D or 3D. + */ + SMESH_Hypothesis CreateHypothesis( in string anHyp, + in long studyId) + raises (SALOME::SALOME_Exception); + + /*! + * Create a Mesh object, given a geometry shape. + * Mesh is created empty (no points, no elements). + * Shape is explored via GEOM_Client to create local copies. + * of TopoDS_Shapes and bind CORBA references of shape & subshapes + * with TopoDS_Shapes + */ + SMESH_Mesh Init(in GEOM::GEOM_Gen geomEngine, + in long studyId, + in GEOM::GEOM_Shape aShape) + raises (SALOME::SALOME_Exception); + + /*! + * Create a Mesh object, without a geometry shape reference + */ +// SMESH_Mesh NewEmpty(in GEOM::GEOM_Gen geomEngine, +// in long studyId) +// raises (SALOME::SALOME_Exception); + + /*! + * Mesh a subShape. + * First, verify list of hypothesis associated with the subShape, + * return NOK if hypothesis are not sufficient + */ + boolean Compute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + + boolean IsReadyToCompute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetSubShapesId(in GEOM::GEOM_Gen geomEngine, + in long studyId, + in GEOM::GEOM_Shape mainShape, + in shape_array listOfSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + // long_array GetSubMeshesState(in GEOM::GEOM_Gen geomEngine, + // in long studyId, + // in shape_array listOfSubShape) + // raises (SALOME::SALOME_Exception); + + + }; + +}; + +#endif diff --git a/idl/SMESH_Hypothesis.idl b/idl/SMESH_Hypothesis.idl new file mode 100644 index 000000000..ec61223eb --- /dev/null +++ b/idl/SMESH_Hypothesis.idl @@ -0,0 +1,71 @@ +//============================================================================= +// File : SMESH_Hypothesis.idl +// Created : jeu avr 11 19:26:16 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESIS_IDL_ +#define _SMESH_HYPOTHESIS_IDL_ + +#include "SALOME_Exception.idl" + +module SMESH +{ + interface SMESH_Hypothesis; + + typedef sequence ListOfHypothesis; + typedef sequence ListOfHypothesisName; + + interface SMESH_Hypothesis + { + /*! + * Get the Hypothesis typeName + */ + string GetName(); + + /*! + * Get the internal Id + */ + long GetId(); + }; + + interface SMESH_Algo : SMESH_Hypothesis + { + /*! + * Get list of hypothesis that can be used with this algorithm + */ + ListOfHypothesisName GetCompatibleHypothesis(); + + }; + + interface SMESH_1D_Algo : SMESH_Algo + { + /*! + * + */ + }; + + interface SMESH_2D_Algo : SMESH_Algo + { + /*! + * + */ + }; + + interface SMESH_3D_Algo : SMESH_Algo + { + /*! + * + */ + }; +}; + + // ----------------------------------------------------------------- + // Specific Algorithms in separate idl file + // ----------------------------------------------------------------- + + +#endif diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl new file mode 100644 index 000000000..a25ba26bc --- /dev/null +++ b/idl/SMESH_Mesh.idl @@ -0,0 +1,262 @@ +//============================================================================= +// File : SMESH_Mesh.idl +// Created : jeu avr 11 15:31:39 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + + +#ifndef _SMESH_MESH_IDL_ +#define _SMESH_MESH_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" + +#include "GEOM_Shape.idl" +#include "MED.idl" + +module SMESH +{ + typedef sequence double_array ; + typedef sequence long_array ; + typedef sequence string_array ; + + enum log_command + { + ADD_NODE, + ADD_EDGE, + ADD_TRIANGLE, + ADD_QUADRANGLE, + ADD_TETRAHEDRON, + ADD_PYRAMID, + ADD_PRISM, + ADD_HEXAHEDRON, + REMOVE_NODE, + REMOVE_ELEMENT + }; + + struct log_block + { + long commandType; + long number; + double_array coords; + long_array indexes; + }; + + typedef sequence log_array; + + interface SMESH_subMesh; + interface SMESH_MeshEditor; + interface SMESH_Mesh + { + /*! + * Associate a Shape to a Mesh created with NewEmpty + */ + +// boolean SetMesh(in GEOM::GEOM_Shape aShape) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the subMesh object associated to a subShape. The subMesh object + * gives access to nodes and elements IDs. + * SubMesh will be used instead of SubShape in a next idl version to + * adress a specific subMesh... + */ + SMESH_subMesh GetElementsOnShape(in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * Create a subMesh without reference to a subShape + */ +// SMESH_subMesh NewEmpty() +// raises (SALOME::SALOME_Exception); + + /*! + * Add hypothesis to the mesh, under a particular subShape + * (or the main shape itself) + * The Add method is only used to prepare the build of the mesh and store + * the algorithms and associated parameters. + * Actual job of mesh the shape is done by MESH_Gen. + * @params + * - aSubShape : subShape obtained by a shape explode in GEOM + * (or main shape) + * - anHyp : hypothesis object + * @return + * - OK if the hypothesis is compatible with the subShape + * (and all previous hypothesis on the subShape) + * - NOK if the hypothesis is not compatible with the subShape + * (or one previous hypothesis on the subShape) + * raises exception if hypothesis has not been created + */ + boolean AddHypothesis(in GEOM::GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp) + raises (SALOME::SALOME_Exception); +// boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp) +// raises (SALOME::SALOME_Exception); + + + /*! + * Remove an hypothesis previouly added with AddHypothesis. + */ + boolean RemoveHypothesis(in GEOM::GEOM_Shape aSubShape, + in SMESH_Hypothesis anHyp) + raises (SALOME::SALOME_Exception); +// boolean RemoveHypothesis(in SMESH_subMesh aSubMesh, +// in SMESH_Hypothesis anHyp) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the list of hypothesis added on a subShape + */ + ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); +// ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the log of nodes and elements added or removed since previous + * clear of the log. + * @params + * - clearAfterGet : log is emptied after Get (safe if concurrents access) + */ + // string_array GetLog(in boolean clearAfterGet) + // raises (SALOME::SALOME_Exception); + log_array GetLog(in boolean clearAfterGet) + raises (SALOME::SALOME_Exception); + + /*! + * Clear the log of nodes and elements added or removed since previous + * clear. Must be used immediately after GetLog if clearAfterGet is false. + */ + void ClearLog() + raises (SALOME::SALOME_Exception); + + /*! + * Get the internal Id + */ + long GetId(); + + /*! + * Get the study Id + */ + long GetStudyId(); + + SMESH_MeshEditor GetMeshEditor() + raises (SALOME::SALOME_Exception); + + /*! + * Export Mesh with DAT and MED Formats + */ + void ExportDAT( in string file ) + raises (SALOME::SALOME_Exception); + void ExportMED( in string file ) + raises (SALOME::SALOME_Exception); + void ExportUNV( in string file ) + raises (SALOME::SALOME_Exception); + + /*! + * Get MED Mesh + */ + SALOME_MED::MESH GetMEDMesh() + raises (SALOME::SALOME_Exception); + + long NbNodes() + raises (SALOME::SALOME_Exception); + + long NbEdges() + raises (SALOME::SALOME_Exception); + + long NbFaces() + raises (SALOME::SALOME_Exception); + + long NbTriangles() + raises (SALOME::SALOME_Exception); + + long NbQuadrangles() + raises (SALOME::SALOME_Exception); + + long NbVolumes() + raises (SALOME::SALOME_Exception); + + long NbTetras() + raises (SALOME::SALOME_Exception); + + long NbHexas() + raises (SALOME::SALOME_Exception); + + long NbSubMesh() + raises (SALOME::SALOME_Exception); + }; + + interface SMESH_subMesh + { + /*! + * + */ + long GetNumberOfElements() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long GetNumberOfNodes() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetElementsId() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetNodesId() + raises (SALOME::SALOME_Exception); + + /*! + * Get SMESH_Mesh which stores nodes coordinates & elements definition + */ + SMESH_Mesh GetFather() + raises (SALOME::SALOME_Exception); + + /*! + * Get the internal Id + */ + long GetId(); + + /*! + * Get MED subMesh + */ + SALOME_MED::FAMILY GetFamily() + raises (SALOME::SALOME_Exception); + }; + + /* + * This interface makes modifications on the Mesh - removing elements and nodes + */ + interface SMESH_MeshEditor { + + + boolean RemoveElements(in long_array IDsOfElements) + raises (SALOME::SALOME_Exception); + + boolean RemoveNodes(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddNode(in double x, in double y, in double z) + raises (SALOME::SALOME_Exception); + + boolean AddEdge(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddFace(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddVolume(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + }; +}; + +#endif diff --git a/src/Driver/Document_Reader.cxx b/src/Driver/Document_Reader.cxx new file mode 100644 index 000000000..3a0ec88f1 --- /dev/null +++ b/src/Driver/Document_Reader.cxx @@ -0,0 +1,13 @@ +using namespace std; +#include "Document_Reader.h" + +#include "utilities.h" + +void Document_Reader::SetFile(string aFile) { + myFile = aFile; +} + +void Document_Reader::SetDocument(Handle(SMESHDS_Document)& aDoc) { + myDocument = aDoc; +} + diff --git a/src/Driver/Document_Reader.h b/src/Driver/Document_Reader.h new file mode 100644 index 000000000..46472e521 --- /dev/null +++ b/src/Driver/Document_Reader.h @@ -0,0 +1,18 @@ +#ifndef _INCLUDE_DOCUMENT_READER +#define _INCLUDE_DOCUMENT_READER + +#include "SMESHDS_Document.hxx" +#include + +class Document_Reader { + + public : + virtual void Read() =0; + void SetFile(string); + void SetDocument(Handle(SMESHDS_Document)&); + + protected : + Handle_SMESHDS_Document myDocument; + string myFile; +}; +#endif diff --git a/src/Driver/Document_Writer.cxx b/src/Driver/Document_Writer.cxx new file mode 100644 index 000000000..73ad7f78a --- /dev/null +++ b/src/Driver/Document_Writer.cxx @@ -0,0 +1,11 @@ +using namespace std; +#include "Document_Writer.h" + +void Document_Writer::SetFile(string aFile) { + myFile = aFile; +} + +void Document_Writer::SetDocument(Handle(SMESHDS_Document)& aDoc) { + myDocument = aDoc; +} + diff --git a/src/Driver/Document_Writer.h b/src/Driver/Document_Writer.h new file mode 100644 index 000000000..4d3a67fc8 --- /dev/null +++ b/src/Driver/Document_Writer.h @@ -0,0 +1,19 @@ +#ifndef _INCLUDE_DOCUMENT_WRITER +#define _INCLUDE_DOCUMENT_WRITER + +#include "SMESHDS_Document.hxx" +#include + +class Document_Writer { + + public : + virtual void Write() =0; + void SetFile(string); + void SetDocument(Handle(SMESHDS_Document)&); + + protected : + Handle_SMESHDS_Document myDocument; + string myFile; + +}; +#endif diff --git a/src/Driver/Driver_dl.cxx b/src/Driver/Driver_dl.cxx new file mode 100644 index 000000000..81dd4230b --- /dev/null +++ b/src/Driver/Driver_dl.cxx @@ -0,0 +1,183 @@ +using namespace std; +#include "Driver.h" + +#include +#include +#include + +#include "DriverDAT_R_SMESHDS_Document.h" +#include "Test.h" + +/*! extern "C" +{ + void test() { + + void *handle; + double (*cosine)(double); + char *error; + + handle = dlopen ("/usr/lib/libm.so", RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + + cosine = dlsym(handle, "cos"); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + + printf ("%f\n", (*cosine)(2.0)); + dlclose(handle); + + char* error; + string Extension=string("DAT"); + string Class=string("SMESHDS_Document"); + string myLibrary = string("/home/barberou/barberou/SALOME_3105/build/lib/libMeshDriver")+Extension+string(".so"); + SCRUTE(myLibrary); + //Document_Reader* myDriver;//a caster ??? + DriverDAT_R_SMESHDS_Document* myDriver; + + string myClass = string("Driver")+Extension+string("_R_")+Class; + SCRUTE(myClass); + + void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + MESSAGE("Open ok"); + + //int* res = (int*)dlsym(handle, "getOne"); + //SCRUTE(res); + SCRUTE(dlsym(handle, "getOne")); + //int res2= (*res)(); + myDriver = (DriverDAT_R_SMESHDS_Document*) dlsym(handle, myClass.c_str()); + MESSAGE("Reading 1"); + SCRUTE(myDriver); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + MESSAGE("Reading 2"); + + dlclose(handle); + MESSAGE("after close"); + + } + }*/ + +Document_Reader* Driver::GetDocumentReader(string Extension, string Class) { + test(); + //p-e extern C ? + /*! + char* error; + string myLibrary = string("/home/barberou/barberou/SALOME_3105/build/lib/libMeshDriver")+Extension+string(".so"); + SCRUTE(myLibrary); + //Document_Reader* myDriver;//a caster ??? + DriverDAT_R_SMESHDS_Document* myDriver; + + string myClass = string("Driver")+Extension+string("_R_")+Class; + SCRUTE(myClass); + + void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + MESSAGE("Open ok"); + //myDriver = (Document_Reader*) dlsym(handle, myClass.c_str()); + int* res = (int*) dlsym(handle, "getOne"); + SCRUTE(res); + myDriver = (DriverDAT_R_SMESHDS_Document*) dlsym(handle, myClass.c_str()); + MESSAGE("Reading 1"); + SCRUTE(myDriver); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + MESSAGE("Reading 2"); + + dlclose(handle); + MESSAGE("after close"); + return (myDriver); + */ + +} + +Document_Writer* Driver::GetDocumentWriter(string Extension, string Class) { + + char* error; + string myLibrary = string("libMeshDriver")+Extension+string(".so"); + Document_Writer* myDriver;//a caster ??? + string myClass = string("Driver")+Extension+string("_W_")+Class; + + void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + + myDriver = (Document_Writer*) dlsym(handle, myClass.c_str()); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + + dlclose(handle); + + return (myDriver); + +} + +Mesh_Reader* Driver::GetMeshReader(string Extension, string Class) { + + char* error; + string myLibrary = string("libMeshDriver")+Extension+string(".so"); + Mesh_Reader* myDriver;//a caster ??? + string myClass = string("Driver")+Extension+string("_R_")+Class; + + void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + + myDriver = (Mesh_Reader*) dlsym(handle, myClass.c_str()); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + + dlclose(handle); + + return (myDriver); + +} + +Mesh_Writer* Driver::GetMeshWriter(string Extension, string Class) { + + char* error; + string myLibrary = string("libMeshDriver")+Extension+string(".so"); + Mesh_Writer* myDriver;//a caster ??? + string myClass = string("Driver")+Extension+string("_W_")+Class; + + void* handle = dlopen (myLibrary.c_str(), RTLD_LAZY); + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + + myDriver = (Mesh_Writer*) dlsym(handle, myClass.c_str()); + if ((error = dlerror()) != NULL) { + fprintf (stderr, "%s\n", error); + exit(1); + } + + dlclose(handle); + + return (myDriver); + +} + diff --git a/src/Driver/Makefile.in b/src/Driver/Makefile.in new file mode 100644 index 000000000..c8bb27367 --- /dev/null +++ b/src/Driver/Makefile.in @@ -0,0 +1,39 @@ +# -* Makefile *- +# +# Author : Marc Tajchman (CEA) +# Date : 5/07/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= Document_Reader.h Document_Writer.h Mesh_Reader.h Mesh_Writer.h + +# Libraries targets +LIB = libMeshDriver.la +LIB_SRC = Document_Reader.cxx Document_Writer.cxx Mesh_Reader.cxx Mesh_Writer.cxx + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -rdynamic -ldl -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(OCC_LIBS) $(MED2_LIBS) -lSMESHDS -lSMDS + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ + + + diff --git a/src/Driver/Mesh_Reader.cxx b/src/Driver/Mesh_Reader.cxx new file mode 100644 index 000000000..3001d36cd --- /dev/null +++ b/src/Driver/Mesh_Reader.cxx @@ -0,0 +1,3 @@ +using namespace std; +#include "Mesh_Reader.h" + diff --git a/src/Driver/Mesh_Reader.h b/src/Driver/Mesh_Reader.h new file mode 100644 index 000000000..8671f5d3e --- /dev/null +++ b/src/Driver/Mesh_Reader.h @@ -0,0 +1,17 @@ +#ifndef _INCLUDE_MESH_READER +#define _INCLUDE_MESH_READER + +#include +#include "Handle_SMDS_Mesh.hxx" + +class Mesh_Reader { + + public : + virtual void Add() =0; + virtual void Read() =0; + virtual void SetMesh(Handle(SMDS_Mesh)&) =0; + virtual void SetMeshId(int) =0; + virtual void SetFile(string) =0; + +}; +#endif diff --git a/src/Driver/Mesh_Writer.cxx b/src/Driver/Mesh_Writer.cxx new file mode 100644 index 000000000..034e68f9e --- /dev/null +++ b/src/Driver/Mesh_Writer.cxx @@ -0,0 +1,2 @@ +using namespace std; +#include "Mesh_Writer.h" diff --git a/src/Driver/Mesh_Writer.h b/src/Driver/Mesh_Writer.h new file mode 100644 index 000000000..e9d84df54 --- /dev/null +++ b/src/Driver/Mesh_Writer.h @@ -0,0 +1,17 @@ +#ifndef _INCLUDE_MESH_WRITER +#define _INCLUDE_MESH_WRITER + +#include +#include "Handle_SMDS_Mesh.hxx" + +class Mesh_Writer { + + public : + virtual void Add() =0; + virtual void Write() =0; + virtual void SetMesh(Handle(SMDS_Mesh)&) =0; + virtual void SetFile(string) =0; + virtual void SetMeshId(int) =0; + +}; +#endif diff --git a/src/Driver/SMESHDriver.cxx b/src/Driver/SMESHDriver.cxx new file mode 100644 index 000000000..2bd13fadd --- /dev/null +++ b/src/Driver/SMESHDriver.cxx @@ -0,0 +1,113 @@ +using namespace std; +#include "SMESHDriver.h" + +#include +#include + +//A enlever +#include "DriverMED_R_SMESHDS_Document.h" +#include "DriverMED_R_SMESHDS_Mesh.h" +#include "DriverMED_R_SMDS_Mesh.h" +#include "DriverMED_W_SMESHDS_Document.h" +#include "DriverMED_W_SMESHDS_Mesh.h" +#include "DriverMED_W_SMDS_Mesh.h" + +#include "DriverDAT_R_SMESHDS_Document.h" +#include "DriverDAT_R_SMESHDS_Mesh.h" +#include "DriverDAT_R_SMDS_Mesh.h" +#include "DriverDAT_W_SMESHDS_Document.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMDS_Mesh.h" +// + +Document_Reader* SMESHDriver::GetDocumentReader(string Extension, string Class) { + if (Extension==string("MED")) { + DriverMED_R_SMESHDS_Document* myDriver = new DriverMED_R_SMESHDS_Document(); + return (myDriver); + } + else if (Extension==string("DAT")) { + DriverDAT_R_SMESHDS_Document* myDriver = new DriverDAT_R_SMESHDS_Document(); + return (myDriver); + } + else { + MESSAGE("No driver known for this extension"); + return (Document_Reader*)NULL; + } + + +} + +Document_Writer* SMESHDriver::GetDocumentWriter(string Extension, string Class) { + if (Extension==string("MED")) { + DriverMED_W_SMESHDS_Document* myDriver = new DriverMED_W_SMESHDS_Document(); + return (myDriver); + } + else if (Extension==string("DAT")) { + DriverDAT_W_SMESHDS_Document* myDriver = new DriverDAT_W_SMESHDS_Document(); + return (myDriver); + } + else { + MESSAGE("No driver known for this extension"); + return (Document_Writer*)NULL; + } + + +} + +Mesh_Reader* SMESHDriver::GetMeshReader(string Extension, string Class) { + if (Extension==string("MED")) { + + if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) { + DriverMED_R_SMESHDS_Mesh* myDriver = new DriverMED_R_SMESHDS_Mesh(); + return (myDriver); + } + else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) { + DriverMED_R_SMDS_Mesh* myDriver = new DriverMED_R_SMDS_Mesh(); + return (myDriver); + } + + } + else if (Extension==string("DAT")) { + + if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) { + DriverDAT_R_SMESHDS_Mesh* myDriver = new DriverDAT_R_SMESHDS_Mesh(); + return (myDriver); + } + else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) { + DriverDAT_R_SMDS_Mesh* myDriver = new DriverDAT_R_SMDS_Mesh(); + return (myDriver); + } + + } + + +} + +Mesh_Writer* SMESHDriver::GetMeshWriter(string Extension, string Class) { + if (Extension==string("MED")) { + + if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) { + DriverMED_W_SMESHDS_Mesh* myDriver = new DriverMED_W_SMESHDS_Mesh(); + return (myDriver); + } + else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) { + DriverMED_W_SMDS_Mesh* myDriver = new DriverMED_W_SMDS_Mesh(); + return (myDriver); + } + + } + else if (Extension==string("DAT")) { + + if (strcmp(Class.c_str(),"SMESHDS_Mesh")==0) { + DriverDAT_W_SMESHDS_Mesh* myDriver = new DriverDAT_W_SMESHDS_Mesh(); + return (myDriver); + } + else if (strcmp(Class.c_str(),"SMDS_Mesh")==0) { + DriverDAT_W_SMDS_Mesh* myDriver = new DriverDAT_W_SMDS_Mesh(); + return (myDriver); + } + + } + +} + diff --git a/src/Driver/SMESHDriver.h b/src/Driver/SMESHDriver.h new file mode 100644 index 000000000..ba0e7ad19 --- /dev/null +++ b/src/Driver/SMESHDriver.h @@ -0,0 +1,19 @@ +#ifndef _INCLUDE_SMESHDRIVER +#define _INCLUDE_SMESHDRIVER + +#include "Document_Reader.h" +#include "Document_Writer.h" +#include "Mesh_Reader.h" +#include "Mesh_Writer.h" + +class SMESHDriver { + + public : + static Document_Reader* GetDocumentReader(string Extension, string Class); + static Document_Writer* GetDocumentWriter(string Extension, string Class); + + static Mesh_Reader* GetMeshReader(string Extension, string Class); + static Mesh_Writer* GetMeshWriter(string Extension, string Class); + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx new file mode 100644 index 000000000..72e0d30b6 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx @@ -0,0 +1,175 @@ +using namespace std; +#include "DriverDAT_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverDAT_R_SMDS_Mesh::DriverDAT_R_SMDS_Mesh() { +; +} + +DriverDAT_R_SMDS_Mesh::~DriverDAT_R_SMDS_Mesh() { +; +} + +void DriverDAT_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverDAT_R_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_R_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_R_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_R_SMDS_Mesh::Add() { + ; +} + +void DriverDAT_R_SMDS_Mesh::Read() { + + int i,j; + int nbNodes,nbCells; + int intNumPoint; + float coordX, coordY, coordZ; + int nbNoeuds; + + int intNumMaille,Degre; + int ValElement; + int ValDegre; + int NoeudsMaille[20]; + int NoeudMaille; + + bool ok; + + MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()"); + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"r"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + fscanf(myFileId,"%d %d\n",&nbNodes,&nbCells); + + /**************************************************************************** + * LECTURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + for (i=0;iAddNodeWithID(coordX,coordY,coordZ,intNumPoint); + } + + fprintf(stdout,"%d noeuds\n",myMesh->NbNodes()); + /**************************************************************************** + * LECTURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + + fprintf(stdout,"%d elements\n",nbCells); + + for (i=0; iAddEdgeWithID(NoeudsMaille[0],NoeudsMaille[1],intNumMaille); + break; + } + case 204 : ; + case 208 : ; + { + ValDegre=9; + nbNoeuds=4; + ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille); + break; + } + case 203 : ; + case 206 : ; + { + ValDegre=5; + nbNoeuds=3; + ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],intNumMaille); + break; + } + case 308 : ; + case 320 : ; + { + ValDegre=12; + nbNoeuds=8; + if (ValElement==320) { + //A voir, correspondance VTK + NoeudsMaille[4]=NoeudsMaille[8]; + NoeudsMaille[5]=NoeudsMaille[9]; + NoeudsMaille[6]=NoeudsMaille[10]; + NoeudsMaille[7]=NoeudsMaille[11]; + } + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],NoeudsMaille[6],NoeudsMaille[7],intNumMaille); + break; + } + case 304 : ; + case 310 : ; + { + ValDegre=10; + nbNoeuds=4; + if (ValElement==310) + NoeudsMaille[3]=NoeudsMaille[6]; + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille); + break; + } + case 306 : ; + case 315 : ; + { + ValDegre=12; + nbNoeuds=8; + if (ValElement==315) { + NoeudsMaille[3]=NoeudsMaille[6]; + NoeudsMaille[4]=NoeudsMaille[7]; + NoeudsMaille[5]=NoeudsMaille[8]; + } + NoeudsMaille[7]=NoeudsMaille[5]; + NoeudsMaille[6]=NoeudsMaille[5]; + NoeudsMaille[5]=NoeudsMaille[4]; + NoeudsMaille[4]=NoeudsMaille[3]; + NoeudsMaille[3]=NoeudsMaille[2]; + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],intNumMaille); + break; + } + + } + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(myFileId); + +} diff --git a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h new file mode 100644 index 000000000..0a8a86a29 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMDS_MESH +#define _INCLUDE_DRIVERDAT_R_SMDS_MESH + +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverDAT_R_SMDS_Mesh : public Mesh_Reader { + + public : + DriverDAT_R_SMDS_Mesh(); + ~DriverDAT_R_SMDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + + private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx new file mode 100644 index 000000000..a079dbd46 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx @@ -0,0 +1,86 @@ +using namespace std; +#include "DriverDAT_R_SMESHDS_Document.h" +#include "DriverDAT_R_SMESHDS_Mesh.h" + +#include "utilities.h" + +int getOne() { + printf("in getOne"); + return (1); +} + +extern "C" { + // Document_Reader* maker() { + DriverDAT_R_SMESHDS_Document* maker() { + fprintf(stdout,"here in maker\n"); + return new DriverDAT_R_SMESHDS_Document; + } +} + +DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document() { + myFile = string(""); +} + +DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document() { +; +} + +//void DriverDAT_R_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverDAT_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) { +//myDocument = aDoc; +//} + +void DriverDAT_R_SMESHDS_Document::Read() { + + int myMeshId; + MESSAGE("in read"); + SCRUTE(myFile); + //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1); + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + FILE* fid = fopen(file2Read,"r"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * COMBIEN DE MAILLAGES ? * + ****************************************************************************/ + int nmaa = 1; + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(fid); + + printf("Nombre de maillages = %d\n",nmaa); + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("DAT"); + + for (int meshIt=1;meshIt<=nmaa;meshIt++) { + myMeshId = myDocument->NewMesh(); + + Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId); + + DriverDAT_R_SMESHDS_Mesh* myReader = new DriverDAT_R_SMESHDS_Mesh; + + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(fid); + + myReader->Read(); + + } + + +} diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h new file mode 100644 index 000000000..83b67b5dd --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h @@ -0,0 +1,24 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT + +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Reader.h" + +class DriverDAT_R_SMESHDS_Document : public Document_Reader { + +public : + DriverDAT_R_SMESHDS_Document(); + ~DriverDAT_R_SMESHDS_Document(); + + void Read(); + //void SetFile(string); + //void SetDocument(Handle_SMESHDS_Document&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..56fe86969 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx @@ -0,0 +1,52 @@ +using namespace std; +#include "DriverDAT_R_SMESHDS_Mesh.h" +#include "DriverDAT_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverDAT_R_SMESHDS_Mesh::DriverDAT_R_SMESHDS_Mesh() { +; +} + +DriverDAT_R_SMESHDS_Mesh::~DriverDAT_R_SMESHDS_Mesh() { +; +} + +void DriverDAT_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverDAT_R_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_R_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_R_SMESHDS_Mesh::Add() { + ; +} + +void DriverDAT_R_SMESHDS_Mesh::Read() { + string myClass = string("SMDS_Mesh"); + string myExtension = string("DAT"); + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 1"); + DriverDAT_R_SMDS_Mesh* myReader = new DriverDAT_R_SMDS_Mesh; + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 2"); + myReader->SetMesh(myMesh); + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 3"); + myReader->SetFile(myFile); + //myReader->SetFileId(myFileId); + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 4"); + myReader->Read(); + +} diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h new file mode 100644 index 000000000..bbcbd0064 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_MESH +#define _INCLUDE_DRIVERDAT_R_SMESHDS_MESH + +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverDAT_R_SMESHDS_Mesh : public Mesh_Reader { + + public : + DriverDAT_R_SMESHDS_Mesh(); + ~DriverDAT_R_SMESHDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx new file mode 100644 index 000000000..0cc429ccc --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx @@ -0,0 +1,164 @@ +using namespace std; +#include "DriverDAT_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +DriverDAT_W_SMDS_Mesh::DriverDAT_W_SMDS_Mesh() { +; +} + +DriverDAT_W_SMDS_Mesh::~DriverDAT_W_SMDS_Mesh() { +; +} + +void DriverDAT_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverDAT_W_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_W_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_W_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_W_SMDS_Mesh::Add() { + ; +} + +void DriverDAT_W_SMDS_Mesh::Write() { + + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + SCRUTE(myMesh); + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + SCRUTE(nb_of_edges); + SCRUTE(nb_of_faces); + SCRUTE(nb_of_volumes); + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem); + + fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z()); + } + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId,"%d %d ",elem->GetID(),102); + break; + } + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),103); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),203); + break; + } + case 4 : { + fprintf(myFileId,"%d %d ",elem->GetID(),204); + break; + } + case 6 : { + fprintf(myFileId,"%d %d ",elem->GetID(),206); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + fprintf(myFileId,"%d %d ",elem->GetID(),308); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + fclose (myFileId); +} diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h new file mode 100644 index 000000000..06056db18 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMDS_MESH +#define _INCLUDE_DRIVERDAT_W_SMDS_MESH + +#include +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverDAT_W_SMDS_Mesh : public Mesh_Writer { + + public : + DriverDAT_W_SMDS_Mesh(); + ~DriverDAT_W_SMDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx new file mode 100644 index 000000000..1cdb67b37 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx @@ -0,0 +1,78 @@ +using namespace std; +#include "DriverDAT_W_SMESHDS_Document.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" + +#include "utilities.h" + +extern "C" +{ + Document_Writer* Wmaker() { + return new DriverDAT_W_SMESHDS_Document; + } +} + +DriverDAT_W_SMESHDS_Document::DriverDAT_W_SMESHDS_Document() { +; +} + +DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document() { +; +} + +//void DriverDAT_W_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverDAT_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) { +//myDocument = aDocument; +//} + +void DriverDAT_W_SMESHDS_Document::Write() { + + Handle(SMESHDS_Mesh) myMesh; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN ECRITURE * + ****************************************************************************/ + char* file2Write = (char*)myFile.c_str(); + FILE* fid = fopen(file2Write,"w+"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Write); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + + fclose(fid); + + /******** Nombre de maillages ********/ + int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves + //nb_of_meshes = 1; + int numero = 0; + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("DAT"); + + //while (numeroGetMesh(numero); + myDocument->InitMeshesIterator(); + for (;myDocument->MoreMesh();myDocument->NextMesh()) { + numero++; + myMesh = myDocument->CurrentMesh(); + + DriverDAT_W_SMESHDS_Mesh* myWriter = new DriverDAT_W_SMESHDS_Mesh; + //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass); + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + SCRUTE(myMesh); + //myWriter->SetFileId(fid); + myWriter->SetMeshId(numero); + myWriter->Write(); + } + +} diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h new file mode 100644 index 000000000..58df6cd9d --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h @@ -0,0 +1,25 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT + +#include +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Writer.h" + +class DriverDAT_W_SMESHDS_Document : public Document_Writer { + +public : + DriverDAT_W_SMESHDS_Document(); + ~DriverDAT_W_SMESHDS_Document(); + + void Write(); + //void SetFile(string); + //void SetDocument(Handle(SMESHDS_Document)&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..9f202370c --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx @@ -0,0 +1,175 @@ +using namespace std; +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +DriverDAT_W_SMESHDS_Mesh::DriverDAT_W_SMESHDS_Mesh() { +; +} + +DriverDAT_W_SMESHDS_Mesh::~DriverDAT_W_SMESHDS_Mesh() { +; +} + +void DriverDAT_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverDAT_W_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_W_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_W_SMESHDS_Mesh::Write() { + + string myClass = string("SMDS_Mesh"); + string myExtension = string("DAT"); + + DriverDAT_W_SMDS_Mesh* myWriter = new DriverDAT_W_SMDS_Mesh; + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + myWriter->SetMeshId(myMeshId); + //myWriter->SetFileId(myFileId); + + myWriter->Write(); + + +} +void DriverDAT_W_SMESHDS_Mesh::Add() { + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem); + + fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z()); + } + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId,"%d %d ",elem->GetID(),102); + break; + } + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),103); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),203); + break; + } + case 4 : { + fprintf(myFileId,"%d %d ",elem->GetID(),204); + break; + } + case 6 : { + fprintf(myFileId,"%d %d ",elem->GetID(),206); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + fprintf(myFileId,"%d %d ",elem->GetID(),308); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + fclose (myFileId); +} + diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h new file mode 100644 index 000000000..fe7e02de2 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_MESH +#define _INCLUDE_DRIVERDAT_W_SMESHDS_MESH + +#include +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverDAT_W_SMESHDS_Mesh : public Mesh_Writer { + + public : + DriverDAT_W_SMESHDS_Mesh(); + ~DriverDAT_W_SMESHDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/Makefile.in b/src/DriverDAT/Makefile.in new file mode 100644 index 000000000..a4c404d0c --- /dev/null +++ b/src/DriverDAT/Makefile.in @@ -0,0 +1,39 @@ +# -* Makefile *- +# +# Author : Marc Tajchman (CEA) +# Date : 5/07/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= DriverDAT_R_SMDS_Mesh.h DriverDAT_R_SMESHDS_Mesh.h DriverDAT_R_SMESHDS_Document.h DriverDAT_W_SMDS_Mesh.h DriverDAT_W_SMESHDS_Mesh.h DriverDAT_W_SMESHDS_Document.h + +# Libraries targets +LIB = libMeshDriverDAT.la +LIB_SRC = DriverDAT_R_SMDS_Mesh.cxx DriverDAT_R_SMESHDS_Mesh.cxx DriverDAT_R_SMESHDS_Document.cxx DriverDAT_W_SMDS_Mesh.cxx DriverDAT_W_SMESHDS_Mesh.cxx DriverDAT_W_SMESHDS_Document.cxx + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) +LDFLAGS += $(OCC_LIBS) $(MED2_LIBS) -lMeshDriver + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ + + + diff --git a/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx b/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx new file mode 100644 index 000000000..b9de018aa --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx @@ -0,0 +1,153 @@ +using namespace std; +#include "DriverUNV_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverUNV_R_SMDS_Mesh::DriverUNV_R_SMDS_Mesh() { +; +} + +DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh() { +; +} + +void DriverUNV_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverUNV_R_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_R_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_R_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_R_SMDS_Mesh::Add() { + ; +} + +void DriverUNV_R_SMDS_Mesh::Read() { + + int cell=0,node=0,n1,n2,n3,n4,n_nodes,nodes[6],blockId,i; + char *s1,*s2,*s3; + string str1,str2,str3; + int i1=0; + bool ok, found_block2411, found_block2412; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"r"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + s1 = (char*) malloc(sizeof(char)*100); + s2 = (char*) malloc(sizeof(char)*100); + s3 = (char*) malloc(sizeof(char)*100); + + found_block2411 = false; + found_block2412 = false; + + do { + + while (i1==-1) { + fscanf(myFileId,"%d\n",&blockId); + switch (blockId) { + case 2411 : { + MESSAGE("BlockId "<AddNodeWithID(atof(str1.c_str()),atof(str2.c_str()),atof(str3.c_str()),node); + fscanf(myFileId,"%d",&node); + } + i1=0; + found_block2411 = true; + break; + } + case 2412 : { + MESSAGE("BlockId "<AddFaceWithID(nodes[0],nodes[1],nodes[2],cell); + } + else if (n_nodes==6) {//206 + for (i=1;i<=n_nodes;i++) + fscanf(myFileId,"%d",&nodes[i-1]); + ok = myMesh->AddFaceWithID(nodes[0],nodes[2],nodes[4],cell); + } + } + + else if ((n1==11)||(n1==21)||(n1==24)||(n1==25)) {//103 + fgets(s2,100,myFileId); + if (n_nodes==3) { + for (i=1;i<=n_nodes;i++) + fscanf(myFileId,"%d",&nodes[i-1]); + ok = myMesh->AddEdgeWithID(nodes[0],nodes[1],cell); + //MESSAGE("in 103 "<AddEdgeWithID(nodes[0],nodes[1],cell); + //MESSAGE("in 102 "< + +#include "SMDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverUNV_R_SMDS_Mesh : public Mesh_Reader { + + public : + DriverUNV_R_SMDS_Mesh(); + ~DriverUNV_R_SMDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + + private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx new file mode 100644 index 000000000..8debd497b --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx @@ -0,0 +1,85 @@ +using namespace std; +#include "DriverUNV_R_SMESHDS_Document.h" +#include "DriverUNV_R_SMESHDS_Mesh.h" + +#include "utilities.h" + +int getOne() { + printf("in getOne"); + return (1); +} + +extern "C" { + // Document_Reader* maker() { + DriverUNV_R_SMESHDS_Document* maker() { + fprintf(stdout,"here in maker\n"); + return new DriverUNV_R_SMESHDS_Document; + } +} + +DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document() { + myFile = string(""); +} + +DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document() { +; +} + +//void DriverUNV_R_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverUNV_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) { +//myDocument = aDoc; +//} + +void DriverUNV_R_SMESHDS_Document::Read() { + + int myMeshId; + SCRUTE(myFile); + //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1); + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + FILE* fid = fopen(file2Read,"r"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * COMBIEN DE MAILLAGES ? * + ****************************************************************************/ + int nmaa = 1; + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(fid); + + printf("Nombre de maillages = %d\n",nmaa); + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("UNV"); + + for (int meshIt=1;meshIt<=nmaa;meshIt++) { + myMeshId = myDocument->NewMesh(); + + Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId); + + DriverUNV_R_SMESHDS_Mesh* myReader = new DriverUNV_R_SMESHDS_Mesh; + + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(fid); + + myReader->Read(); + + } + + +} diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h new file mode 100644 index 000000000..9fbd04f3a --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h @@ -0,0 +1,24 @@ +#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT + +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Reader.h" + +class DriverUNV_R_SMESHDS_Document : public Document_Reader { + +public : + DriverUNV_R_SMESHDS_Document(); + ~DriverUNV_R_SMESHDS_Document(); + + void Read(); + //void SetFile(string); + //void SetDocument(Handle_SMESHDS_Document&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..849a523d0 --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx @@ -0,0 +1,48 @@ +using namespace std; +#include "DriverUNV_R_SMESHDS_Mesh.h" +#include "DriverUNV_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverUNV_R_SMESHDS_Mesh::DriverUNV_R_SMESHDS_Mesh() { +; +} + +DriverUNV_R_SMESHDS_Mesh::~DriverUNV_R_SMESHDS_Mesh() { +; +} + +void DriverUNV_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverUNV_R_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_R_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_R_SMESHDS_Mesh::Add() { + ; +} + +void DriverUNV_R_SMESHDS_Mesh::Read() { + string myClass = string("SMDS_Mesh"); + string myExtension = string("UNV"); + + DriverUNV_R_SMDS_Mesh* myReader = new DriverUNV_R_SMDS_Mesh; + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(myFileId); + + myReader->Read(); + +} diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h new file mode 100644 index 000000000..0c3a7e6fa --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_MESH +#define _INCLUDE_DRIVERUNV_R_SMESHDS_MESH + +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverUNV_R_SMESHDS_Mesh : public Mesh_Reader { + + public : + DriverUNV_R_SMESHDS_Mesh(); + ~DriverUNV_R_SMESHDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx new file mode 100644 index 000000000..6bf42e674 --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx @@ -0,0 +1,196 @@ +using namespace std; +#include "DriverUNV_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include + +#define sNODE_UNV_ID " 2411" +#define sELT_UNV_ID " 2412" +#define sUNV_SEPARATOR " -1" +#define sNODE_UNV_DESCR "%10d 1 1 11\n" +#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n" +#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n" +#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n" +#define sELT_BEAM_DESC2 " 0 1 1\n" + +DriverUNV_W_SMDS_Mesh::DriverUNV_W_SMDS_Mesh() { +; +} + +DriverUNV_W_SMDS_Mesh::~DriverUNV_W_SMDS_Mesh() { +; +} + +void DriverUNV_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverUNV_W_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_W_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_W_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_W_SMDS_Mesh::Add() { + ; +} + +void DriverUNV_W_SMDS_Mesh::Write() { + + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + SCRUTE(myMesh); + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + SCRUTE(nb_of_edges); + SCRUTE(nb_of_faces); + SCRUTE(nb_of_volumes); + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sNODE_UNV_ID ); + + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode )& node = myMesh->GetNode(1, elem); + + fprintf(myFileId, sNODE_UNV_DESCR, node->GetID()); + fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z()); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sELT_UNV_ID ); + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2)); + break; + } + case 3 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3)); + break; + } + } + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : + // linear triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes()); + break; + case 4 : + // linear quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes()); + break; + case 6 : + // parabolic triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes()); + break; + case 8 : + // parabolic quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes()); + break; + default: + fprintf(myFileId, "element not registered\n"); + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes()); + break; + case 6 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes()); + break; + case 8 : + // linear brick + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes()); + break; + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + fclose (myFileId); +} diff --git a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h new file mode 100644 index 000000000..141ab21db --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMDS_MESH +#define _INCLUDE_DRIVERUNV_W_SMDS_MESH + +#include +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverUNV_W_SMDS_Mesh : public Mesh_Writer { + + public : + DriverUNV_W_SMDS_Mesh(); + ~DriverUNV_W_SMDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx new file mode 100644 index 000000000..7fb740cdd --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx @@ -0,0 +1,78 @@ +using namespace std; +#include "DriverUNV_W_SMESHDS_Document.h" +#include "DriverUNV_W_SMESHDS_Mesh.h" + +#include "utilities.h" + +extern "C" +{ + Document_Writer* Wmaker() { + return new DriverUNV_W_SMESHDS_Document; + } +} + +DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document() { +; +} + +DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document() { +; +} + +//void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverUNV_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) { +//myDocument = aDocument; +//} + +void DriverUNV_W_SMESHDS_Document::Write() { + + Handle(SMESHDS_Mesh) myMesh; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN ECRITURE * + ****************************************************************************/ + char* file2Write = (char*)myFile.c_str(); + FILE* fid = fopen(file2Write,"w+"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Write); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + + fclose(fid); + + /******** Nombre de maillages ********/ + int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves + //nb_of_meshes = 1; + int numero = 0; + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("UNV"); + + //while (numeroGetMesh(numero); + myDocument->InitMeshesIterator(); + for (;myDocument->MoreMesh();myDocument->NextMesh()) { + numero++; + myMesh = myDocument->CurrentMesh(); + + DriverUNV_W_SMESHDS_Mesh* myWriter = new DriverUNV_W_SMESHDS_Mesh; + //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass); + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + SCRUTE(myMesh); + //myWriter->SetFileId(fid); + myWriter->SetMeshId(numero); + myWriter->Write(); + } + +} diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h new file mode 100644 index 000000000..7b71287d1 --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h @@ -0,0 +1,25 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT + +#include +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Writer.h" + +class DriverUNV_W_SMESHDS_Document : public Document_Writer { + +public : + DriverUNV_W_SMESHDS_Document(); + ~DriverUNV_W_SMESHDS_Document(); + + void Write(); + //void SetFile(string); + //void SetDocument(Handle(SMESHDS_Document)&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..231bba3db --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx @@ -0,0 +1,207 @@ +using namespace std; +#include "DriverUNV_W_SMESHDS_Mesh.h" +#include "DriverUNV_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +#define sNODE_UNV_ID " 2411" +#define sELT_UNV_ID " 2412" +#define sUNV_SEPARATOR " -1" +#define sNODE_UNV_DESCR "%10d 1 1 11\n" +#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n" +#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n" +#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n" +#define sELT_BEAM_DESC2 " 0 1 1\n" + +DriverUNV_W_SMESHDS_Mesh::DriverUNV_W_SMESHDS_Mesh() { +; +} + +DriverUNV_W_SMESHDS_Mesh::~DriverUNV_W_SMESHDS_Mesh() { +; +} + +void DriverUNV_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverUNV_W_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_W_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_W_SMESHDS_Mesh::Write() { + + string myClass = string("SMDS_Mesh"); + string myExtension = string("UNV"); + + DriverUNV_W_SMDS_Mesh* myWriter = new DriverUNV_W_SMDS_Mesh; + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + myWriter->SetMeshId(myMeshId); + //myWriter->SetFileId(myFileId); + + myWriter->Write(); + + +} +void DriverUNV_W_SMESHDS_Mesh::Add() { + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); +//fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sNODE_UNV_ID ); + + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode )& node = myMesh->GetNode(1, elem); + + fprintf(myFileId, sNODE_UNV_DESCR, node->GetID()); + fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z()); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sELT_UNV_ID ); + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2)); + break; + } + case 3 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3)); + break; + } + } + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : + // linear triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes()); + break; + case 4 : + // linear quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes()); + break; + case 6 : + // parabolic triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes()); + break; + case 8 : + // parabolic quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes()); + break; + default: + fprintf(myFileId, "element not registered\n"); + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes()); + break; + case 6 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes()); + break; + case 8 : + // linear brick + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes()); + break; + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + fclose (myFileId); +} + diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h new file mode 100644 index 000000000..4cd508b2d --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_MESH +#define _INCLUDE_DRIVERUNV_W_SMESHDS_MESH + +#include +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverUNV_W_SMESHDS_Mesh : public Mesh_Writer { + + public : + DriverUNV_W_SMESHDS_Mesh(); + ~DriverUNV_W_SMESHDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/Makefile.in b/src/DriverUNV/Makefile.in new file mode 100644 index 000000000..c9a4fa89a --- /dev/null +++ b/src/DriverUNV/Makefile.in @@ -0,0 +1,41 @@ +# -* Makefile *- +# +# Author : Marc Tajchman (CEA) +# Date : 5/07/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= DriverUNV_R_SMDS_Mesh.h DriverUNV_R_SMESHDS_Mesh.h DriverUNV_R_SMESHDS_Document.h \ + DriverUNV_W_SMDS_Mesh.h DriverUNV_W_SMESHDS_Mesh.h DriverUNV_W_SMESHDS_Document.h + +# Libraries targets +LIB = libMeshDriverUNV.la +LIB_SRC = DriverUNV_R_SMDS_Mesh.cxx DriverUNV_R_SMESHDS_Mesh.cxx DriverUNV_R_SMESHDS_Document.cxx \ + DriverUNV_W_SMDS_Mesh.cxx DriverUNV_W_SMESHDS_Mesh.cxx DriverUNV_W_SMESHDS_Document.cxx + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) +LDFLAGS += $(OCC_LIBS) $(MED2_LIBS) -lMeshDriver + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ + + + diff --git a/src/MEFISTO2/Makefile.in b/src/MEFISTO2/Makefile.in new file mode 100644 index 000000000..63798ef3f --- /dev/null +++ b/src/MEFISTO2/Makefile.in @@ -0,0 +1,36 @@ +# -* Makefile *- +# +# Author : +# Date : 29/01/2001 +# +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS = aptrte.h Rn.h + +# Libraries targets +LIB = libMEFISTO2D.la +LIB_SRC = aptrte.cxx trte.f +# areteideale.f + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += $(OCC_LIBS) -lg2c + +@CONCLUDE@ + diff --git a/src/MEFISTO2/Rn.h b/src/MEFISTO2/Rn.h new file mode 100755 index 000000000..a2856eeec --- /dev/null +++ b/src/MEFISTO2/Rn.h @@ -0,0 +1,204 @@ +#ifndef Rn__h +#define Rn__h + +#include //Dans OpenCascade +#include //Dans OpenCascade +#include //Dans OpenCascade + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// BUT: Definir les espaces affines R R2 R3 R4 soit Rn pour n=1,2,3,4 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// AUTEUR : Frederic HECHT ANALYSE NUMERIQUE UPMC PARIS OCTOBRE 2000 +// MODIFS : Alain PERRONNET ANALYSE NUMERIQUE UPMC PARIS NOVEMBRE 2000 +//............................................................................... +#include +#include + +using namespace std; + +template inline T Abs (const T &a){return a <0 ? -a : a;} +template inline void Echange (T& a,T& b) {T c=a;a=b;b=c;} + +template inline T Min (const T &a,const T &b) {return a < b ? a : b;} +template inline T Max (const T &a,const T & b) {return a > b ? a : b;} + +template inline T Max (const T &a,const T & b,const T & c){return Max(Max(a,b),c);} +template inline T Min (const T &a,const T & b,const T & c){return Min(Min(a,b),c);} + +template inline T Max (const T &a,const T & b,const T & c,const T & d) + {return Max(Max(a,b),Max(c,d));} +template inline T Min (const T &a,const T & b,const T & c,const T & d) + {return Min(Min(a,b),Min(c,d));} + +//le type Nom des entites geometriques P L S V O +//=========== +typedef char Nom[1+24]; + +//le type N des nombres entiers positifs +//========= +typedef unsigned long int N; + +//le type Z des nombres entiers relatifs +//========= +typedef long int Z; + +//le type R des nombres "reels" +//========= +typedef double R; + +//le type XPoint des coordonnees d'un pixel dans une fenetre +//============== +//typedef struct { short int x,y } XPoint; //en fait ce type est defini dans X11-Window + // #include +//la classe R2 +//============ +class R2 +{ + friend ostream& operator << (ostream& f, const R2 & P) + { f << P.x << ' ' << P.y ; return f; } + friend istream& operator >> (istream& f, R2 & P) + { f >> P.x >> P.y ; return f; } + + friend ostream& operator << (ostream& f, const R2 * P) + { f << P->x << ' ' << P->y ; return f; } + friend istream& operator >> (istream& f, R2 * P) + { f >> P->x >> P->y ; return f; } + +public: + R x,y; //les donnees + + R2 () :x(0),y(0) {} //les constructeurs + R2 (R a,R b) :x(a),y(b) {} + R2 (R2 A,R2 B) :x(B.x-A.x),y(B.y-A.y) {} //vecteur defini par 2 points + + R2 operator+(R2 P) const {return R2(x+P.x,y+P.y);} // Q+P possible + R2 operator+=(R2 P) {x += P.x;y += P.y; return *this;}// Q+=P; + R2 operator-(R2 P) const {return R2(x-P.x,y-P.y);} // Q-P + R2 operator-=(R2 P) {x -= P.x;y -= P.y; return *this;} // Q-=P; + R2 operator-()const {return R2(-x,-y);} // -Q + R2 operator+()const {return *this;} // +Q + R operator,(R2 P)const {return x*P.x+y*P.y;} // produit scalaire (Q,P) + R operator^(R2 P)const {return x*P.y-y*P.x;} // produit vectoriel Q^P + R2 operator*(R c)const {return R2(x*c,y*c);} // produit a droite P*c + R2 operator*=(R c) {x *= c; y *= c; return *this;} + R2 operator/(R c)const {return R2(x/c,y/c);} // division par un reel + R2 operator/=(R c) {x /= c; y /= c; return *this;} + R & operator[](int i) {return (&x)[i];} // la coordonnee i + R2 orthogonal() {return R2(-y,x);} //le vecteur orthogonal dans R2 + friend R2 operator*(R c,R2 P) {return P*c;} // produit a gauche c*P +}; + + +//la classe R3 +//============ +class R3 +{ + friend ostream& operator << (ostream& f, const R3 & P) + { f << P.x << ' ' << P.y << ' ' << P.z ; return f; } + friend istream& operator >> (istream& f, R3 & P) + { f >> P.x >> P.y >> P.z ; return f; } + + friend ostream& operator << (ostream& f, const R3 * P) + { f << P->x << ' ' << P->y << ' ' << P->z ; return f; } + friend istream& operator >> (istream& f, R3 * P) + { f >> P->x >> P->y >> P->z ; return f; } + +public: + R x,y,z; //les 3 coordonnees + + R3 () :x(0),y(0),z(0) {} //les constructeurs + R3 (R a,R b,R c):x(a),y(b),z(c) {} //Point ou Vecteur (a,b,c) + R3 (R3 A,R3 B):x(B.x-A.x),y(B.y-A.y),z(B.z-A.z) {} //Vecteur AB + + R3 (gp_Pnt P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Point d'OpenCascade + R3 (gp_Vec V) : x(V.X()), y(V.Y()), z(V.Z()) {} //Vecteur d'OpenCascade + R3 (gp_Dir P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Direction d'OpenCascade + + R3 operator+(R3 P)const {return R3(x+P.x,y+P.y,z+P.z);} + R3 operator+=(R3 P) {x += P.x; y += P.y; z += P.z; return *this;} + R3 operator-(R3 P)const {return R3(x-P.x,y-P.y,z-P.z);} + R3 operator-=(R3 P) {x -= P.x; y -= P.y; z -= P.z; return *this;} + R3 operator-()const {return R3(-x,-y,-z);} + R3 operator+()const {return *this;} + R operator,(R3 P)const {return x*P.x+y*P.y+z*P.z;} // produit scalaire + R3 operator^(R3 P)const {return R3(y*P.z-z*P.y ,P.x*z-x*P.z, x*P.y-y*P.x);} // produit vectoriel + R3 operator*(R c)const {return R3(x*c,y*c,z*c);} + R3 operator*=(R c) {x *= c; y *= c; z *= c; return *this;} + R3 operator/(R c)const {return R3(x/c,y/c,z/c);} + R3 operator/=(R c) {x /= c; y /= c; z /= c; return *this;} + R & operator[](int i) {return (&x)[i];} + friend R3 operator*(R c,R3 P) {return P*c;} + + R3 operator=(gp_Pnt P) {return R3(P.X(),P.Y(),P.Z());} + R3 operator=(gp_Dir P) {return R3(P.X(),P.Y(),P.Z());} + + friend gp_Pnt gp_pnt(R3 xyz) { return gp_Pnt(xyz.x,xyz.y,xyz.z); } + //friend gp_Pnt operator=() { return gp_Pnt(x,y,z); } + friend gp_Dir gp_dir(R3 xyz) { return gp_Dir(xyz.x,xyz.y,xyz.z); } + + bool DansPave( R3 & xyzMin, R3 & xyzMax ) + { return xyzMin.x<=x && x<=xyzMax.x && + xyzMin.y<=y && y<=xyzMax.y && + xyzMin.z<=z && z<=xyzMax.z; } +}; + +//la classe R4 +//============ +class R4: public R3 +{ + friend ostream& operator <<(ostream& f, const R4 & P ) + { f << P.x << ' ' << P.y << ' ' << P.z << ' ' << P.omega; return f; } + friend istream& operator >>(istream& f, R4 & P) + { f >> P.x >> P.y >> P.z >> P.omega ; return f; } + + friend ostream& operator <<(ostream& f, const R4 * P ) + { f << P->x << ' ' << P->y << ' ' << P->z << ' ' << P->omega; return f; } + friend istream& operator >>(istream& f, R4 * P) + { f >> P->x >> P->y >> P->z >> P->omega ; return f; } + +public: + R omega; //la donnee du poids supplementaire + + R4 () :omega(1.0) {} //les constructeurs + R4 (R a,R b,R c,R d):R3(a,b,c),omega(d) {} + R4 (R4 A,R4 B) :R3(B.x-A.x,B.y-A.y,B.z-A.z),omega(B.omega-A.omega) {} + + R4 operator+(R4 P)const {return R4(x+P.x,y+P.y,z+P.z,omega+P.omega);} + R4 operator+=(R4 P) {x += P.x;y += P.y;z += P.z;omega += P.omega;return *this;} + R4 operator-(R4 P)const {return R4(x-P.x,y-P.y,z-P.z,omega-P.omega);} + R4 operator-=(R4 P) {x -= P.x;y -= P.y;z -= P.z;omega -= P.omega;return *this;} + R4 operator-()const {return R4(-x,-y,-z,-omega);} + R4 operator+()const {return *this;} + R operator,(R4 P)const {return x*P.x+y*P.y+z*P.z+omega*P.omega;} // produit scalaire + R4 operator*(R c)const {return R4(x*c,y*c,z*c,omega*c);} + R4 operator*=(R c) {x *= c; y *= c; z *= c; omega *= c; return *this;} + R4 operator/(R c)const {return R4(x/c,y/c,z/c,omega/c);} + R4 operator/=(R c) {x /= c; y /= c; z /= c; omega /= c; return *this;} + R & operator[](int i) {return (&x)[i];} + friend R4 operator*(R c,R4 P) {return P*c;} +}; + +//quelques fonctions supplementaires sur ces classes +//================================================== +inline R Aire2d(const R2 A,const R2 B,const R2 C){return (B-A)^(C-A);} +inline R Angle2d(R2 P){ return atan2(P.y,P.x);} + +inline R Norme2_2(const R2 & A){ return (A,A);} +inline R Norme2(const R2 & A){ return sqrt((A,A));} +inline R NormeInfinie(const R2 & A){return Max(Abs(A.x),Abs(A.y));} + +inline R Norme2_2(const R3 & A){ return (A,A);} +inline R Norme2(const R3 & A){ return sqrt((A,A));} +inline R NormeInfinie(const R3 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z));} + +inline R Norme2_2(const R4 & A){ return (A,A);} +inline R Norme2(const R4 & A){ return sqrt((A,A));} +inline R NormeInfinie(const R4 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z),Abs(A.omega));} + +inline R2 XY(R3 P) {return R2(P.x, P.y);} //restriction a R2 d'un R3 par perte de z +inline R3 Min(R3 P, R3 Q) +{return R3(P.xQ.x ? P.x : Q.x, P.y>Q.y ? P.y : Q.y, P.z>Q.z ? P.z : Q.z);} //Pt de xyz Max + +#endif diff --git a/src/MEFISTO2/aptrte.cxx b/src/MEFISTO2/aptrte.cxx new file mode 100755 index 000000000..58da98168 --- /dev/null +++ b/src/MEFISTO2/aptrte.cxx @@ -0,0 +1,760 @@ +using namespace std; +#include "Rn.h" +#include "aptrte.h" +#include "utilities.h" + +extern "C" +{ + R aretemaxface_; + R areteideale_( R3 xyz, R3 direction ) + { + return aretemaxface_; + } +} +//calcul de la longueur ideale de l'arete au sommet xyz (z ici inactif) +//dans la direction donnee +//a ajuster pour chaque surface plane et selon l'entier notysu (voir plus bas) + + +static double cpunew, cpuold=0; + +void tempscpu_( double & tempsec ) +//Retourne le temps CPU utilise en secondes +{ + tempsec = ( (double) clock() ) / CLOCKS_PER_SEC; + //MESSAGE( "temps cpu=" << tempsec ); +} + + +void deltacpu_( R & dtcpu ) +//Retourne le temps CPU utilise en secondes depuis le precedent appel +{ + tempscpu_( cpunew ); + dtcpu = R( cpunew - cpuold ); + cpuold = cpunew; + //MESSAGE( "delta temps cpu=" << dtcpu ); + return; +} + + +void aptrte( Z nutysu, R aretmx, + Z nblf, Z * nudslf, R2 * uvslf, + Z nbpti, R2 *uvpti, + Z & nbst, R2 * & uvst, Z & nbt, Z * & nust, + Z & ierr ) +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// but : appel de la triangulation par un arbre-4 recouvrant +// ----- de triangles equilateraux +// le contour du domaine plan est defini par des lignes fermees +// la premiere ligne etant l'enveloppe de toutes les autres +// la fonction areteideale(s,d) donne la taille d'arete +// au point s dans la direction (actuellement inactive) d +// des lors toute arete issue d'un sommet s devrait avoir une longueur +// comprise entre 0.65 areteideale_(s,d) et 1.3 areteideale_(s,d) +// +//Attention: +// Les tableaux uvslf et uvpti sont supposes ne pas avoir de sommets identiques! +// De meme, un sommet d'une ligne fermee ne peut appartenir a une autre ligne fermee +// +// entrees: +// -------- +// nutysu : numero de traitement de areteideale_(s,d) selon le type de surface +// 0 pas d'emploi de la fonction areteideale_() et aretmx est active +// 1 il existe une fonction areteideale_(s,d) +// dont seules les 2 premieres composantes de uv sont actives +// ... autres options a definir ... +// aretmx : longueur maximale des aretes de la future triangulation +// nblf : nombre de lignes fermees de la surface +// nudslf : numero du dernier sommet de chacune des nblf lignes fermees +// nudslf(0)=0 pour permettre la difference sans test +// Attention le dernier sommet de chaque ligne est raccorde au premier +// tous les sommets et les points internes ont des coordonnees +// UV differentes <=> Pas de point double! +// uvslf : uv des nudslf(nblf) sommets des lignes fermees +// nbpti : nombre de points internes futurs sommets de la triangulation +// uvpti : uv des points internes futurs sommets de la triangulation +// +// sorties: +// -------- +// nbst : nombre de sommets de la triangulation finale +// uvst : coordonnees uv des nbst sommets de la triangulation +// nbt : nombre de triangles de la triangulation finale +// nust : 4 numeros dans uvst des sommets des nbt triangles +// s1, s2, s3, 0: no dans uvst des 3 sommets et 0 car quadrangle! +// ierr : 0 si pas d'erreur +// > 0 sinon +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// auteur : Alain Perronnet Analyse Numerique Paris UPMC decembre 2001 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +{ + R d, tcpu=0; + R3 direction=R3(0,0,0); //direction pour areteideale() inactive ici! + Z nbarfr=nudslf[nblf]; //nombre total d'aretes des lignes fermees + Z mxtrou = Max( 1024, nblf ); //nombre maximal de trous dans la surface + + R3 *mnpxyd=NULL; + Z *mnsoar=NULL, mosoar=7, mxsoar, n1soar; //le hachage des aretes + Z *mnartr=NULL, moartr=3, mxartr, n1artr; //le no des 3 aretes des triangles + Z *mntree=NULL, motree=9, mxtree; //L'arbre 4 de TE et nombre d'entiers par TE + Z *mnqueu=NULL, mxqueu; + Z *mn1arcf=NULL; + Z *mnarcf=NULL, mxarcf; + Z *mnarcf1=NULL; + Z *mnarcf2=NULL; + Z *mnarcf3=NULL; + Z *mntrsu=NULL; + Z *mndalf=NULL; + Z *mnslig=NULL; + Z *mnarst=NULL; + Z *mnlftr=NULL; + + R3 comxmi[2]; //coordonnees UV Min et Maximales + R aremin, aremax; //longueur minimale et maximale des aretes + R quamoy, quamin; + + Z noar0, noar, na; + Z i, l, n, ns, ns0, ns1, ns2, nosotr[3], nt; + Z mxsomm, nbsomm, nbarpi, nbarli, ndtri0, mn; + Z moins1=-1; + + aretemaxface_ = aretmx; + + // initialisation du temps cpu + deltacpu_( d ); + ierr = 0; + + // quelques reservations de tableaux pour faire les calculs + // ======================================================== + // le tableau pointeur sur la premiere arete de chaque ligne fermee + if( mndalf!=NULL ) delete [] mndalf; + mndalf = new Z[1+nblf]; + if( mndalf==NULL ) goto ERREUR; + mndalf[0]=0; + + // declaration du tableau des coordonnees des sommets de la frontiere + // puis des sommets internes ajoutes + // majoration empirique du nombre de sommets de la triangulation + i = 4*nbarfr/10; + mxsomm = Max( 20000, 64*nbpti+i*i ); + MESSAGE( "APTRTE: Depart de la triangulation avec " ); + MESSAGE( "nutysu=" << nutysu << " aretmx=" << aretmx << " mxsomm=" << mxsomm ); + + NEWDEPART: + //mnpxyd( 3, mxsomm ) les coordonnees UV des sommets et la taille d'arete aux sommets + if( mnpxyd!=NULL ) delete [] mnpxyd; + mnpxyd = new R3[mxsomm]; + if( mnpxyd==NULL ) goto ERREUR; + + // le tableau mnsoar des aretes des triangles + // 1: sommet 1 dans pxyd, + // 2: sommet 2 dans pxyd, + // 3: numero de 1 a nblf de la ligne qui supporte l'arete + // 4: numero dans mnartr du triangle 1 partageant cette arete, + // 5: numero dans mnartr du triangle 2 partageant cette arete, + // 6: chainage des aretes frontalieres ou internes ou + // des aretes simples des etoiles de triangles, + // 7: chainage du hachage des aretes + // nombre d'aretes = 3 ( nombre de sommets - 1 + nombre de trous ) + // pour le hachage des aretes mxsoar doit etre > 3*mxsomm! + // h(ns1,ns2) = min( ns1, ns2 ) + if( mnsoar!=NULL ) delete [] mnsoar; + mxsoar = 3 * ( mxsomm + mxtrou ); + mnsoar = new Z[mosoar*mxsoar]; + if( mnsoar==NULL ) goto ERREUR; + //initialiser le tableau mnsoar pour le hachage des aretes + insoar_( mxsomm, mosoar, mxsoar, n1soar, mnsoar ); + + // mnarst( mxsomm ) numero mnsoar d'une arete pour chacun des sommets + if( mnarst!=NULL ) delete [] mnarst; + mnarst = new Z[1+mxsomm]; + if( mnarst==NULL ) goto ERREUR; + n = 1+mxsomm; + azeroi_( n, mnarst ); + + // mnslig( mxsomm ) no de sommet dans sa ligne pour chaque sommet frontalier + // ou no du point si interne forc'e par l'utilisateur + // ou 0 si interne cree par le module + if( mnslig!=NULL ) delete [] mnslig; + mnslig = new Z[mxsomm]; + if( mnslig==NULL ) goto ERREUR; + azeroi_( mxsomm, mnslig ); + + // initialisation des aretes frontalieres de la triangulation future + // renumerotation des sommets des aretes des lignes pour la triangulation + // mise a l'echelle des coordonnees des sommets pour obtenir une + // meilleure precision lors des calculs + quelques verifications + // boucle sur les lignes fermees qui forment la frontiere + // ====================================================================== + noar = 0; + aremin = 1e100; + aremax = 0; + + for (n=1; n<=nblf; n++) + { + //l'initialisation de la premiere arete de la ligne n dans la triangulation + //------------------------------------------------------------------------- + //le sommet ns0 est le numero de l'origine de la ligne + ns0 = nudslf[n-1]; + mnpxyd[ns0].x = uvslf[ns0].x; + mnpxyd[ns0].y = uvslf[ns0].y; + mnpxyd[ns0].z = areteideale_( mnpxyd[ns0], direction ); +// cout << "Sommet " << ns0 << ": " << mnpxyd[ns0].x +// << " " << mnpxyd[ns0].y << " longueur arete=" << mnpxyd[ns0].z << endl; + + //carre de la longueur de l'arete 1 de la ligne fermee n + d = pow( uvslf[ns0+1].x - uvslf[ns0].x, 2 ) + + pow( uvslf[ns0+1].y - uvslf[ns0].y, 2 ) ; + aremin = Min( aremin, d ); + aremax = Max( aremax, d ); + + //le numero des 2 sommets (ns1,ns2) de la premiere arete de la ligne + //initialisation de la 1-ere arete ns1-ns1+1 de cette ligne fermee n + //le numero des 2 sommets ns1 ns2 de la 1-ere arete + //Attention: les numeros ns debutent a 1 (ils ont >0) + // les tableaux c++ demarrent a zero! + // les tableaux fortran demarrent ou l'on veut! + ns0++; + ns1 = ns0; + ns2 = ns1+1; + + //le numero n de la ligne du sommet et son numero ns1 dans la ligne + mnslig[ns0-1] = 1000000 * n + ns1-nudslf[n-1]; + fasoar_( ns1, ns2, moins1, moins1, n, + mosoar, mxsoar, n1soar, mnsoar, mnarst, + noar0, ierr ); + //pas de test sur ierr car pas de saturation possible a ce niveau + + //le pointeur dans le hachage sur la premiere arete de la ligne fermee n + mndalf[n] = noar0; + + //la nouvelle arete est la suivante de l'arete definie juste avant + if( noar > 0 ) + mnsoar[mosoar * noar - mosoar + 5] = noar0; + + //l'initialisation des aretes suivantes de la ligne dans la triangulation + //----------------------------------------------------------------------- + nbarli = nudslf[n] - nudslf[n-1]; //nombre d'aretes=sommets de la ligne n + for (i=2; i<=nbarli; i++) + { + ns1 = ns2; //le numero de l'arete et le numero du premier sommet de l'arete + if( i < nbarli ) + //nbs+1 est le 2-eme sommet de l'arete i de la ligne fermee n + ns2 = ns1+1; + else + //le 2-eme sommet de la derniere arete est le premier sommet de la ligne + ns2 = ns0; + + //l'arete precedente est dotee de sa suivante:celle cree ensuite + //les 2 coordonnees du sommet ns2 de la ligne + ns = ns1 - 1; + mnpxyd[ns].x = uvslf[ns].x; + mnpxyd[ns].y = uvslf[ns].y; + mnpxyd[ns].z = areteideale_( mnpxyd[ns], direction ); +// cout << "Sommet " << ns << ": " << mnpxyd[ns].x +// << " " << mnpxyd[ns].y << " longueur arete=" << mnpxyd[ns].z << endl; + + //carre de la longueur de l'arete + d = pow( uvslf[ns2-1].x - uvslf[ns1-1].x, 2) + + pow( uvslf[ns2-1].y - uvslf[ns1-1].y, 2); + aremin = Min( aremin, d ); + aremax = Max( aremax, d ); + + //le numero n de la ligne du sommet et son numero ns1 dans la ligne + mnslig[ns] = 1000000 * n + ns1-nudslf[n-1]; + + //ajout de l'arete dans la liste + fasoar_( ns1, ns2, moins1, moins1, n, + mosoar, mxsoar, n1soar, mnsoar, + mnarst, noar, ierr ); + //pas de test sur ierr car pas de saturation possible a ce niveau + + //chainage des aretes frontalieres en position 6 du tableau mnsoar + //la nouvelle arete est la suivante de l'arete definie juste avant + mnsoar[ mosoar * noar0 - mosoar + 5 ] = noar; + noar0 = noar; + } + //attention: la derniere arete de la ligne fermee enveloppe + // devient en fait la premiere arete de cette ligne + // dans le chainage des aretes de la frontiere! + } + if( ierr != 0 ) goto ERREUR; + + aremin = sqrt( aremin ); //longueur minimale d'une arete des lignes fermees + aremax = sqrt( aremax ); //longueur maximale d'une arete + + aretmx = Min( aretmx, aremax ); //pour homogeneiser + cout << "nutysu=" << nutysu << " aretmx=" << aretmx + << " arete min=" << aremin << " arete max=" << aremax << endl; + + //chainage des aretes frontalieres : la derniere arete frontaliere + mnsoar[ mosoar * noar - mosoar + 5 ] = 0; + + //tous les sommets et aretes frontaliers sont numerotes de 1 a nbarfr + //reservation du tableau des numeros des 3 aretes de chaque triangle + //mnartr( moartr, mxartr ) + //En nombre: Triangles = Aretes Internes + Aretes Frontalieres - Sommets + 1-Trous + // 3Triangles = 2 Aretes internes + Aretes frontalieres + // d'ou 3T/2 < AI + AF => T < 3T/2 - Sommets + 1-Trous + //nombre de triangles < 2 ( nombre de sommets - 1 + nombre de trous ) + if( mnartr!=NULL ) delete [] mnartr; + mxartr = 2 * ( mxsomm + mxtrou ); + mnartr = new Z[moartr*mxartr]; + if( mnartr==NULL ) goto ERREUR; + + //Ajout des points internes + ns1 = nudslf[ nblf ]; + for (i=0; i redepart avec 2 fois plus de sommets + mxsomm = 2 * mxsomm; + ierr = 0; + goto NEWDEPART; + } + else + { + MESSAGE( "Triangulation non realisee " << ierr ); + if( ierr == 0 ) ierr=1; + goto NETTOYAGE; + } +} + + +void qualitetrte( R3 *mnpxyd, + Z & mosoar, Z & mxsoar, Z *mnsoar, + Z & moartr, Z & mxartr, Z *mnartr, + Z & nbtria, R & quamoy, R & quamin ) +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// but : calculer la qualite moyenne et minimale de la triangulation +// ----- actuelle definie par les tableaux mnsoar et mnartr +// entrees: +// -------- +// mnpxyd : tableau des coordonnees 2d des points +// par point : x y distance_souhaitee +// mosoar : nombre maximal d'entiers par arete et +// indice dans mnsoar de l'arete suivante dans le hachage +// mxsoar : nombre maximal d'aretes stockables dans le tableau mnsoar +// attention: mxsoar>3*mxsomm obligatoire! +// mnsoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +// chainage des aretes frontalieres, chainage du hachage des aretes +// hachage des aretes = mnsoar(1)+mnsoar(2)*2 +// avec mxsoar>=3*mxsomm +// une arete i de mnsoar est vide <=> mnsoar(1,i)=0 et +// mnsoar(2,arete vide)=l'arete vide qui precede +// mnsoar(3,arete vide)=l'arete vide qui suit +// moartr : nombre maximal d'entiers par arete du tableau mnartr +// mxartr : nombre maximal de triangles declarables +// mnartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +// arete1 = 0 si triangle vide => arete2 = triangle vide suivant +// sorties: +// -------- +// nbtria : nombre de triangles internes au domaine +// quamoy : qualite moyenne des triangles actuels +// quamin : qualite minimale des triangles actuels +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +{ + R d, aire, qualite; + Z nosotr[3], mn, nbtrianeg, nt; + + aire = 0; + quamoy = 0; + quamin = 2.0; + nbtria = 0; + nbtrianeg = 0; + + mn = -moartr; + for ( nt=1; nt<=mxartr; nt++ ) + { + mn += moartr; + if( mnartr[mn]!=0 ) + { + //un triangle occupe de plus + nbtria++; + + //le numero des 3 sommets du triangle nt + nusotr_( nt, mosoar, mnsoar, moartr, mnartr, nosotr ); + + //la qualite du triangle ns1 ns2 ns3 + qutr2d_( mnpxyd[nosotr[0]-1], mnpxyd[nosotr[1]-1], mnpxyd[nosotr[2]-1], + qualite ); + + //la qualite moyenne + quamoy += qualite; + + //la qualite minimale + quamin = Min( quamin, qualite ); + + //aire signee du triangle nt + d = surtd2_( mnpxyd[nosotr[0]-1], mnpxyd[nosotr[1]-1], mnpxyd[nosotr[2]-1] ); + if( d<0 ) + { + //un triangle d'aire negative de plus + nbtrianeg++; + cout << "ATTENTION: le triangle " << nt << " de sommets:" + << nosotr[0] << " " << nosotr[1] << " " << nosotr[2] + << " a une aire " << d <<"<=0" << endl; + } + + //aire des triangles actuels + aire += Abs(d); + } + } + + //les affichages + quamoy /= nbtria; + cout << "Qualite moyenne=" << quamoy + << " Qualite minimale=" << quamin + << " des " << nbtria << " triangles de surface totale=" + << aire << endl; + + if( nbtrianeg>0 ) + MESSAGE( "ATTENTION: nombre de triangles d'aire negative=" << nbtrianeg ); + return; +} diff --git a/src/MEFISTO2/aptrte.h b/src/MEFISTO2/aptrte.h new file mode 100755 index 000000000..9e57131dd --- /dev/null +++ b/src/MEFISTO2/aptrte.h @@ -0,0 +1,229 @@ +#ifndef aptrte__h +#define aptrte__h + +#include // limites min max int long real ... +#include // gethostname, ... +#include +#include // pour cout cin ... +#include // pour le format des io setw, stx, setfill, ... +#include // pour les fonctions sur les chaines de caracteres +#include +#include +#include // pour les fonctions mathematiques +#include + +#include +#include + +void qualitetrte( R3 *mnpxyd, + Z & mosoar, Z & mxsoar, Z *mnsoar, + Z & moartr, Z & mxartr, Z *mnartr, + Z & nbtria, R & quamoy, R & quamin ); +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// but : calculer la qualite moyenne et minimale de la triangulation +// ----- actuelle definie par les tableaux nosoar et noartr +// entrees: +// -------- +// mnpxyd : tableau des coordonnees 2d des points +// par point : x y distance_souhaitee +// mosoar : nombre maximal d'entiers par arete et +// indice dans nosoar de l'arete suivante dans le hachage +// mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +// attention: mxsoar>3*mxsomm obligatoire! +// nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +// chainage des aretes frontalieres, chainage du hachage des aretes +// hachage des aretes = nosoar(1)+nosoar(2)*2 +// avec mxsoar>=3*mxsomm +// une arete i de nosoar est vide <=> nosoar(1,i)=0 et +// nosoar(2,arete vide)=l'arete vide qui precede +// nosoar(3,arete vide)=l'arete vide qui suit +// moartr : nombre maximal d'entiers par arete du tableau noartr +// mxartr : nombre maximal de triangles declarables +// noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +// arete1 = 0 si triangle vide => arete2 = triangle vide suivant +// sorties: +// -------- +// nbtria : nombre de triangles internes au domaine +// quamoy : qualite moyenne des triangles actuels +// quamin : qualite minimale des triangles actuels +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +void aptrte( Z nutysu, R aretmx, + Z nblf, Z *nudslf, R2 *uvslf, + Z nbpti, R2 *uvpti, + Z & nbst, R2 * & uvst, Z & nbt, Z * & nust, + Z & ierr ); +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// but : appel de la triangulation par un arbre-4 recouvrant +// ----- de triangles equilateraux +// le contour du domaine plan est defini par des lignes fermees +// la premiere ligne etant l'enveloppe de toutes les autres +// la fonction areteideale_(s,d) donne la taille d'arete +// au point s dans la direction d (direction inactive pour l'instant) +// des lors toute arete issue d'un sommet s devrait avoir une longueur +// comprise entre 0.65 areteideale_(s,d) et 1.3 areteideale_(s,d) +// +//Attention: +// Les tableaux uvslf et uvpti sont supposes ne pas avoir de sommets identiques! +// De meme, un sommet d'une ligne fermee ne peut appartenir a une autre ligne fermee +// +// entrees: +// -------- +// nutysu : numero de traitement de areteideale_() selon le type de surface +// 0 pas d'emploi de la fonction areteideale_() et aretmx est active +// 1 il existe une fonction areteideale_(s,d) +// dont seules les 2 premieres composantes de uv sont actives +// ... autres options a definir ... +// aretmx : longueur maximale des aretes de la future triangulation +// nblf : nombre de lignes fermees de la surface +// nudslf : numero du dernier sommet de chacune des nblf lignes fermees +// nudslf(0)=0 pour permettre la difference sans test +// Attention le dernier sommet de chaque ligne est raccorde au premier +// tous les sommets et les points internes ont des coordonnees +// UV differentes <=> Pas de point double! +// uvslf : uv des nudslf(nblf) sommets des lignes fermees +// nbpti : nombre de points internes futurs sommets de la triangulation +// uvpti : uv des points internes futurs sommets de la triangulation +// +// sorties: +// -------- +// nbst : nombre de sommets de la triangulation finale +// uvst : coordonnees uv des nbst sommets de la triangulation +// nbt : nombre de triangles de la triangulation finale +// nust : 3 numeros dans uvst des sommets des nbt triangles +// ierr : 0 si pas d'erreur +// > 0 sinon +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// auteur : Alain Perronnet Analyse Numerique Paris UPMC decembre 2001 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +extern "C" { void tempscpu_( double & tempsec ); } +//Retourne le temps CPU utilise en secondes + +extern "C" { void deltacpu_( R & dtcpu ); } +//Retourne le temps CPU utilise en secondes depuis le precedent appel + +//initialiser le tableau mnsoar pour le hachage des aretes +extern "C" {void insoar_( Z & mxsomm, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar );} + +//mettre a zero les nb entiers de tab +extern "C" {void azeroi_( Z & nb, Z * tab );} + +extern "C" {void fasoar_( Z & ns1, Z & ns2, Z & nt1, Z & nt2, Z & nolign, + Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z * mnarst, + Z & noar, Z & ierr );} +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// but : former l'arete de sommet ns1-ns2 dans le hachage du tableau +// ----- nosoar des aretes de la triangulation +// entrees: +// -------- +// ns1 ns2: numero pxyd des 2 sommets de l'arete +// nt1 : numero du triangle auquel appartient l'arete +// nt1=-1 si numero inconnu +// nt2 : numero de l'eventuel second triangle de l'arete si connu +// nt2=-1 si numero inconnu +// nolign : numero de la ligne fermee de l'arete +// =0 si l'arete n'est une arete de ligne +// ce numero est ajoute seulement si l'arete est creee +// mosoar : nombre maximal d'entiers par arete du tableau nosoar +// mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +// modifies: +// --------- +// n1soar : numero de la premiere arete vide dans le tableau nosoar +// une arete i de nosoar est vide <=> nosoar(1,i)=0 +// chainage des aretes vides amont et aval +// l'arete vide qui precede=nosoar(4,i) +// l'arete vide qui suit =nosoar(5,i) +// nosoar : numero des 2 sommets, no ligne, 2 triangles de l'arete, +// chainage momentan'e d'aretes, chainage du hachage des aretes +// hachage des aretes = min( nosoar(1), nosoar(2) ) +// noarst : noarst(np) numero d'une arete du sommet np + +// ierr : si < 0 en entree pas d'affichage en cas d'erreur du type +// "arete appartenant a plus de 2 triangles et a creer!" +// si >=0 en entree affichage de ce type d'erreur +// sorties: +// -------- +// noar : >0 numero de l'arete retrouvee ou ajoutee +// ierr : =0 si pas d'erreur +// =1 si le tableau nosoar est sature +// =2 si arete a creer et appartenant a 2 triangles distincts +// des triangles nt1 et nt2 +// =3 si arete appartenant a 2 triangles distincts +// differents des triangles nt1 et nt2 +// =4 si arete appartenant a 2 triangles distincts +// dont le second n'est pas le triangle nt2 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +//initialisation du tableau letree et ajout dans letree des sommets 1 a nbsomm +extern "C" {void teajte_( Z & mxsomm, Z & nbsomm, R3 * mnpxyd, R3 * comxmi, + R & aretmx, Z & mxtree, Z * letree, + Z & ierr );} + + +extern "C" {void tehote_( Z & nutysu, Z & nbarpi, Z & mxsomm, Z & nbsomm, R3 * mnpxyd, + R3 * comxmi, R & aretmx, + Z * letree, Z & mxqueu, Z * mnqueu, + Z & ierr );} +// homogeneisation de l'arbre des te a un saut de taille au plus +// prise en compte des tailles d'aretes souhaitees autour des sommets initiaux + +extern "C" {void tetrte_( R3 * comxmi, R & aretmx, Z & nbarpi, Z & mxsomm, R3 * mnpxyd, + Z & mxqueu, Z * mnqueu, Z * mntree, + Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, + Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z * mnarst, + Z & ierr );} +// trianguler les triangles equilateraux feuilles a partir de leurs 3 sommets +// et des points de la frontiere, des points internes imposes interieurs + +extern "C" {void aisoar_( Z & mosoar, Z & mxsoar, Z * mnsoar, Z & na );} + // formation du chainage 6 des aretes internes a echanger eventuellement + +extern "C" {void tedela_( R3 * mnpxyd, Z * mnarst, + Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z & na, + Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z & n );} + // boucle sur les aretes internes (non sur une ligne de la frontiere) + // avec echange des 2 diagonales afin de rendre la triangulation delaunay + +extern "C" {void terefr_( Z & nbarpi, R3 * mnpxyd, + Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, + Z & moartr, Z & n1artr, Z * mnartr, Z * mnarst, + Z & mxarcf, Z * mnarc1, Z * mnarc2, + Z * mnarc3, Z * mnarc4, + Z & n, Z & ierr );} +// detection des aretes frontalieres initiales perdues +// triangulation frontale pour les restaurer + +extern "C" {void tesuex_( Z & nblf, Z * nulftr, + Z & ndtri0, Z & nbsomm, R3 * mnpxyd, Z * mnslig, + Z & mosoar, Z & mxsoar, Z * mnsoar, + Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z * mnarst, + Z & nbtria, Z * mntrsu, Z & ierr );} +// suppression des triangles externes a la surface + +extern "C" {void teamqt_( Z & nutysu, + Z * mnarst, Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, + Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, + Z & mxarcf, Z * mntrcf, Z * mnstbo, + Z * n1arcf, Z * mnarcf, Z * mnarc1, + R3 * comxmi, Z & nbarpi, Z & nbsomm, Z & mxsomm, + R3 * mnpxyd, Z * mnslig, + Z & ierr );} +// amelioration de la qualite de la triangulation par +// barycentrage des sommets internes a la triangulation +// suppression des aretes trop longues ou trop courtes +// modification de la topologie des groupes de triangles +// mise en delaunay de la triangulation + +extern "C" {void nusotr_( Z & nt, Z & mosoar, Z * mnsoar, Z & moartr, Z * mnartr, + Z * nosotr );} +//retrouver les numero des 3 sommets du triangle nt + +extern "C" {void qutr2d_( R3 & p1, R3 & p2, R3 & p3, R & qualite );} +//calculer la qualite d'un triangle de R2 de sommets p1, p2, p3 + +extern "C" { R surtd2_( R3 & p1, R3 & p2, R3 & p3 ); } +//calcul de la surface d'un triangle defini par 3 points de r**2 + +#endif diff --git a/src/MEFISTO2/areteideale.f b/src/MEFISTO2/areteideale.f new file mode 100755 index 000000000..cabc8d442 --- /dev/null +++ b/src/MEFISTO2/areteideale.f @@ -0,0 +1,5 @@ + double precision function areteideale( xyz, direction ) + double precision xyz(3), direction(3) + areteideale = 10 + return + end diff --git a/src/MEFISTO2/trte.f b/src/MEFISTO2/trte.f new file mode 100755 index 000000000..f66104e34 --- /dev/null +++ b/src/MEFISTO2/trte.f @@ -0,0 +1,8319 @@ + subroutine qutr2d( p1, p2, p3, qualite ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer la qualite d'un triangle de r**2 +c ----- 2 coordonnees des 3 sommets en double precision +c +c entrees : +c --------- +c p1,p2,p3 : les 3 coordonnees des 3 sommets du triangle +c sens direct pour une surface et qualite >0 +c sorties : +c --------- +c qualite: valeur de la qualite du triangle entre 0 et 1 (equilateral) +c 1 etant la qualite optimale +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique upmc paris janvier 1995 +c2345x7..............................................................012 + parameter ( d2uxr3 = 3.4641016151377544d0 ) +c d2uxr3 = 2 * sqrt(3) + double precision p1(2), p2(2), p3(2), qualite, a, b, c, p +c +c la longueur des 3 cotes + a = sqrt( (p2(1)-p1(1))**2 + (p2(2)-p1(2))**2 ) + b = sqrt( (p3(1)-p2(1))**2 + (p3(2)-p2(2))**2 ) + c = sqrt( (p1(1)-p3(1))**2 + (p1(2)-p3(2))**2 ) +c +c demi perimetre + p = (a+b+c) * 0.5d0 +c + if ( (a*b*c) .ne. 0d0 ) then +c critere : 2 racine(3) * rayon_inscrit / plus longue arete + qualite = d2uxr3 * sqrt( abs( (p-a) / p * (p-b) * (p-c) ) ) + % / max(a,b,c) + else + qualite = 0d0 + endif +c +c +c autres criteres possibles: +c critere : 2 * rayon_inscrit / rayon_circonscrit +c qualite = 8d0 * (p-a) * (p-b) * (p-c) / (a * b * c) +c +c critere : 3*sqrt(3.) * ray_inscrit / demi perimetre +c qualite = 3*sqrt(3.) * sqrt ((p-a)*(p-b)*(p-c) / p**3) +c +c critere : 2*sqrt(3.) * ray_inscrit / max( des aretes ) +c qualite = 2*sqrt(3.) * sqrt( (p-a)*(p-b)*(p-c) / p ) / max(a,b,c) + end + + + double precision function surtd2( p1 , p2 , p3 ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul de la surface d'un triangle defini par 3 points de R**2 +c ----- +c parametres d entree : +c --------------------- +c p1 p2 p3 : les 3 fois 2 coordonnees des sommets du triangle +c +c parametre resultat : +c -------------------- +c surtd2 : surface du triangle +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique upmc paris fevrier 1992 +c2345x7..............................................................012 + double precision p1(2), p2(2), p3(2) +c +c la surface du triangle + surtd2 = ( ( p2(1)-p1(1) ) * ( p3(2)-p1(2) ) + % - ( p2(2)-p1(2) ) * ( p3(1)-p1(1) ) ) * 0.5d0 + end + + integer function nopre3( i ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : numero precedent i dans le sens circulaire 1 2 3 1 ... +c ----- +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + if( i .eq. 1 ) then + nopre3 = 3 + else + nopre3 = i - 1 + endif + end + + integer function nosui3( i ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : numero suivant i dans le sens circulaire 1 2 3 1 ... +c ----- +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + if( i .eq. 3 ) then + nosui3 = 1 + else + nosui3 = i + 1 + endif + end + + subroutine provec( v1 , v2 , v3 ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : v3 vecteur = produit vectoriel de 2 vecteurs de r ** 3 +c ----- +c entrees: +c -------- +c v1, v2 : les 2 vecteurs de 3 composantes +c +c sortie : +c -------- +c v3 : vecteur = v1 produit vectoriel v2 +cc++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : perronnet alain upmc analyse numerique paris mars 1987 +c2345x7..............................................................012 + double precision v1(3), v2(3), v3(3) +c + v3( 1 ) = v1( 2 ) * v2( 3 ) - v1( 3 ) * v2( 2 ) + v3( 2 ) = v1( 3 ) * v2( 1 ) - v1( 1 ) * v2( 3 ) + v3( 3 ) = v1( 1 ) * v2( 2 ) - v1( 2 ) * v2( 1 ) +c + return + end + + subroutine norme1( n, v, ierr ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : normalisation euclidienne a 1 d un vecteur v de n composantes +c ----- +c entrees : +c --------- +c n : nombre de composantes du vecteur +c +c modifie : +c --------- +c v : le vecteur a normaliser a 1 +c +c sortie : +c --------- +c ierr : 1 si la norme de v est egale a 0 +c 0 si pas d'erreur +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris mars 1987 +c ...................................................................... + double precision v( n ), s, sqrt +c + s = 0.0d0 + do 10 i=1,n + s = s + v( i ) * v( i ) + 10 continue +c +c test de nullite de la norme du vecteur +c -------------------------------------- + if( s .le. 0.0d0 ) then +c norme nulle du vecteur non normalisable a 1 + ierr = 1 + return + endif +c + s = 1.0d0 / sqrt( s ) + do 20 i=1,n + v( i ) = v ( i ) * s + 20 continue +c + ierr = 0 + end + + + subroutine insoar( mxsomm, mosoar, mxsoar, n1soar, nosoar ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : initialiser le tableau nosoar pour le hachage des aretes +c ----- +c +c entrees: +c -------- +c mxsomm : plus grand numero de sommet d'une arete au cours du calcul +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c avec mxsoar>=3*mxsomm +c +c sorties: +c -------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c chainage des aretes vides amont et aval +c l'arete vide qui precede=nosoar(4,i) +c l'arete vide qui suit =nosoar(5,i) +c nosoar : numero des 2 sommets, no ligne, 2 triangles de l'arete, +c chainage momentan'e d'aretes, chainage du hachage des aretes +c hachage des aretes = min( nosoar(1), nosoar(2) ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + integer nosoar(mosoar,mxsoar) +c +c initialisation des aretes 1 a mxsomm + do 10 i=1,mxsomm +c +c sommet 1 = 0 <=> temoin d'arete vide pour le hachage + nosoar( 1, i ) = 0 +c +c arete sur aucune ligne + nosoar( 3, i ) = 0 +c +c la position de l'arete interne ou frontaliere est inconnue + nosoar( 6, i ) = -2 +c +c fin de chainage du hachage pas d'arete suivante + nosoar( mosoar, i ) = 0 +c + 10 continue +c +c la premiere arete vide chainee est la mxsomm+1 du tableau +c car ces aretes ne sont pas atteignables par le hachage direct + n1soar = mxsomm + 1 +c +c initialisation des aretes vides et des chainages + do 20 i = n1soar, mxsoar +c +c sommet 1 = 0 <=> temoin d'arete vide pour le hachage + nosoar( 1, i ) = 0 +c +c arete sur aucune ligne + nosoar( 3, i ) = 0 +c +c chainage sur l'arete vide qui precede +c (si arete occupee cela deviendra le no du triangle 1 de l'arete) + nosoar( 4, i ) = i-1 +c +c chainage sur l'arete vide qui suit +c (si arete occupee cela deviendra le no du triangle 2 de l'arete) + nosoar( 5, i ) = i+1 +c +c chainages des aretes frontalieres ou internes ou ... + nosoar( 6, i ) = -2 +c +c fin de chainage du hachage + nosoar( mosoar, i ) = 0 +c + 20 continue +c +c la premiere arete vide n'a pas de precedent + nosoar( 4, n1soar ) = 0 +c +c la derniere arete vide est mxsoar sans arete vide suivante + nosoar( 5, mxsoar ) = 0 + end + + + subroutine azeroi ( l , ntab ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : initialisation a zero d un tableau ntab de l variables entieres +c ----- +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique upmc paris septembre 1988 +c23456---------------------------------------------------------------012 + integer ntab(l) + do 1 i = 1 , l + ntab( i ) = 0 + 1 continue + end + + + subroutine fasoar( ns1, ns2, nt1, nt2, nolign, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former l'arete de sommet ns1-ns2 dans le hachage du tableau +c ----- nosoar des aretes de la triangulation +c +c entrees: +c -------- +c ns1 ns2: numero pxyd des 2 sommets de l'arete +c nt1 : numero du triangle auquel appartient l'arete +c nt1=-1 si numero inconnu +c nt2 : numero de l'eventuel second triangle de l'arete si connu +c nt2=-1 si numero inconnu +c nolign : numero de la ligne de l'arete dans ladefi(wulftr-1+nolign) +c =0 si l'arete n'est une arete de ligne +c ce numero est ajoute seulement si l'arete est creee +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c chainage des aretes vides amont et aval +c l'arete vide qui precede=nosoar(4,i) +c l'arete vide qui suit =nosoar(5,i) +c nosoar : numero des 2 sommets, no ligne, 2 triangles de l'arete, +c chainage momentan'e d'aretes, chainage du hachage des aretes +c hachage des aretes = min( nosoar(1), nosoar(2) ) +c noarst : noarst(np) numero d'une arete du sommet np +c +c ierr : si < 0 en entree pas d'affichage en cas d'erreur du type +c "arete appartenant a plus de 2 triangles et a creer!" +c si >=0 en entree affichage de ce type d'erreur +c +c sorties: +c -------- +c noar : >0 numero de l'arete retrouvee ou ajoutee +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si arete a creer et appartenant a 2 triangles distincts +c des triangles nt1 et nt2 +c =3 si arete appartenant a 2 triangles distincts +c differents des triangles nt1 et nt2 +c =4 si arete appartenant a 2 triangles distincts +c dont le second n'est pas le triangle nt2 +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) + integer nosoar(mosoar,mxsoar), noarst(*) + integer nu2sar(2) +c +c ajout eventuel de l'arete s1 s2 dans nosoar + nu2sar(1) = ns1 + nu2sar(2) = ns2 +c +c hachage de l'arete de sommets nu2sar + call hasoar( mosoar, mxsoar, n1soar, nosoar, nu2sar, noar ) +c en sortie: noar>0 => no arete retrouvee +c <0 => no arete ajoutee +c =0 => saturation du tableau nosoar +c + if( noar .eq. 0 ) then +c +c saturation du tableau nosoar + write(imprim,*) 'fasoar: tableau nosoar sature' + ierr = 1 + return +c + else if( noar .lt. 0 ) then +c +c l'arete a ete ajoutee. initialisation des autres informations + noar = -noar +c le numero de la ligne de l'arete + nosoar(3,noar) = nolign +c le triangle 1 de l'arete => le triangle nt1 + nosoar(4,noar) = nt1 +c le triangle 2 de l'arete => le triangle nt2 + nosoar(5,noar) = nt2 +c +c le sommet appartient a l'arete noar + noarst( nu2sar(1) ) = noar + noarst( nu2sar(2) ) = noar +c + else +c +c l'arete a ete retrouvee. +c si elle appartient a 2 triangles differents de nt1 et nt2 +c alors il y a une erreur + if( nosoar(4,noar) .gt. 0 .and. + % nosoar(5,noar) .gt. 0 ) then + if( nosoar(4,noar) .ne. nt1 .and. + % nosoar(4,noar) .ne. nt2 .or. + % nosoar(5,noar) .ne. nt1 .and. + % nosoar(5,noar) .ne. nt2 ) then +c arete appartenant a plus de 2 triangles => erreur + if( ierr .ge. 0 ) then + write(imprim,*) 'erreur fasoar: arete ',noar, + % ' dans 2 triangles et a creer!' + endif + ierr = 2 + return + endif + endif +c +c mise a jour du numero des triangles de l'arete noar +c le triangle 2 de l'arete => le triangle nt1 + if( nosoar(4,noar) .lt. 0 ) then +c pas de triangle connu pour cette arete + n = 4 + else +c deja un triangle connu. ce nouveau est le second + if( nosoar(5,noar) .gt. 0 .and. nt1 .gt. 0 .and. + % nosoar(5,noar) .ne. nt1 ) then +c arete appartenant a plus de 2 triangles => erreur + write(imprim,*) 'erreur fasoar: arete ',noar, + % ' dans plus de 2 triangles' + ierr = 3 + return + endif + n = 5 + endif + nosoar(n,noar) = nt1 +c +c cas de l'arete frontaliere retrouvee comme diagonale d'un quadrangle + if( nt2 .gt. 0 ) then +c l'arete appartient a 2 triangles + if( nosoar(5,noar) .gt. 0 .and. + % nosoar(5,noar) .ne. nt2 ) then +c arete appartenant a plus de 2 triangles => erreur + write(imprim,*) 'erreur fasoar: arete ',noar, + % ' dans plus de 2 triangles' + ierr = 4 + return + endif + nosoar(5,noar) = nt2 + endif +c + endif +c +c pas d'erreur + ierr = 0 + end + + subroutine fq1inv( x, y, s, xc, yc, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul des 2 coordonnees (xc,yc) dans le carre (0,1) +c ----- image par f:carre unite-->quadrangle appartenant a q1**2 +c par une resolution directe due a nicolas thenault +c +c entrees: +c -------- +c x,y : coordonnees du point image dans le quadrangle de sommets s +c s : les 2 coordonnees des 4 sommets du quadrangle +c +c sorties: +c -------- +c xc,yc : coordonnees dans le carre dont l'image par f vaut (x,y) +c ierr : 0 si calcul sans erreur, 1 si quadrangle degenere +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteurs: thenault tulenew analyse numerique paris janvier 1998 +c modifs : perronnet alain analyse numerique paris janvier 1998 +c234567..............................................................012 + real s(1:2,1:4), dist(2) + double precision a,b,c,d,alpha,beta,gamma,delta,x0,y0,t(2),u,v,w +c + a = s(1,1) + b = s(1,2) - s(1,1) + c = s(1,4) - s(1,1) + d = s(1,1) - s(1,2) + s(1,3) - s(1,4) +c + alpha = s(2,1) + beta = s(2,2) - s(2,1) + gamma = s(2,4) - s(2,1) + delta = s(2,1) - s(2,2) + s(2,3) - s(2,4) +c + u = beta * c - b * gamma + if( u .eq. 0 ) then +c quadrangle degenere + ierr = 1 + return + endif + v = delta * c - d * gamma + w = b * delta - beta * d +c + x0 = c * (y-alpha) - gamma * (x-a) + y0 = b * (y-alpha) - beta * (x-a) +c + a = v * w + b = u * u - w * x0 - v * y0 + c = x0 * y0 +c + if( a .ne. 0 ) then +c + delta = sqrt( b*b-4*a*c ) + if( b .ge. 0.0 ) then + t(2) = -b - delta + else + t(2) = -b + delta + endif +c la racine de plus grande valeur absolue +c (elle donne le plus souvent le point exterieur au carre unite +c donc a tester en second pour reduire les calculs) + t(2) = t(2) / ( 2 * a ) +c calcul de la seconde racine a partir de la somme => plus stable + t(1) = - b/a - t(2) +c + do 10 i=1,2 +c +c la solution i donne t elle un point interne au carre unite? + xc = ( x0 - v * t(i) ) / u + yc = ( w * t(i) - y0 ) / u + if( 0.0 .le. xc .and. xc .le. 1.0 ) then + if( 0.0 .le. yc .and. yc .le. 1.0 ) goto 9000 + endif +c +c le point (xc,yc) n'est pas dans le carre unite +c cela peut etre du aux erreurs d'arrondi +c => choix par le minimum de la distance aux bords du carre + dist(i) = max( 0.0, -xc, xc-1.0, -yc, yc-1.0 ) +c + 10 continue +c + if( dist(1) .gt. dist(2) ) then +c f(xc,yc) pour la racine 2 est plus proche de x,y +c xc yc sont deja calcules + goto 9000 + endif +c + else if ( b .ne. 0 ) then + t(1) = - c / b + else + t(1) = 0 + endif +c +c les 2 coordonnees du point dans le carre unite + xc = ( x0 - v * t(1) ) / u + yc = ( w * t(1) - y0 ) / u +c + 9000 ierr = 0 + return + end + + + subroutine ptdatr( point, pxyd, nosotr, nsigne ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : le point est il dans le triangle de sommets nosotr +c ----- +c +c entrees: +c -------- +c point : les 2 coordonnees du point +c pxyd : les 2 coordonnees et distance souhaitee des points du maillage +c nosotr : le numero des 3 sommets du triangle +c +c sorties: +c -------- +c nsigne : >0 si le point est dans le triangle ou sur une des 3 aretes +c =0 si le triangle est degenere ou indirect ou ne contient pas le poin +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + integer nosotr(3) + double precision point(2), pxyd(3,*) + double precision xp,yp, x1,x2,x3, y1,y2,y3, d,dd, cb1,cb2,cb3 +c + xp = point( 1 ) + yp = point( 2 ) +c + n1 = nosotr( 1 ) + x1 = pxyd( 1 , n1 ) + y1 = pxyd( 2 , n1 ) +c + n2 = nosotr( 2 ) + x2 = pxyd( 1 , n2 ) + y2 = pxyd( 2 , n2 ) +c + n3 = nosotr( 3 ) + x3 = pxyd( 1 , n3 ) + y3 = pxyd( 2 , n3 ) +c +c 2 fois la surface du triangle = determinant de la matrice +c de calcul des coordonnees barycentriques du point p + d = ( x2 - x1 ) * ( y3 - y1 ) - ( x3 - x1 ) * ( y2 - y1 ) +c + if( d .gt. 0 ) then +c +c triangle non degenere +c ===================== +c calcul des 3 coordonnees barycentriques du +c point xp yp dans le triangle + cb1 = ( ( x2-xp ) * ( y3-yp ) - ( x3-xp ) * ( y2-yp ) ) / d + cb2 = ( ( x3-xp ) * ( y1-yp ) - ( x1-xp ) * ( y3-yp ) ) / d + cb3 = 1d0 - cb1 -cb2 +ccc cb3 = ( ( x1-xp ) * ( y2-yp ) - ( x2-xp ) * ( y1-yp ) ) / d +c +ccc if( cb1 .ge. -0.00005d0 .and. cb1 .le. 1.00005d0 .and. + if( cb1 .ge. 0d0 .and. cb1 .le. 1d0 .and. + % cb2 .ge. 0d0 .and. cb2 .le. 1d0 .and. + % cb3 .ge. 0d0 .and. cb3 .le. 1d0 ) then +c +c le triangle nosotr contient le point + nsigne = 1 + else + nsigne = 0 + endif +c + else +c +c triangle degenere +c ================= +c le point est il du meme cote que le sommet oppose de chaque arete? + nsigne = 0 + do 10 i=1,3 +c le sinus de l'angle p1 p2-p1 point + x1 = pxyd(1,n1) + y1 = pxyd(2,n1) + d = ( pxyd(1,n2) - x1 ) * ( point(2) - y1 ) + % - ( pxyd(2,n2) - y1 ) * ( point(1) - x1 ) + dd = ( pxyd(1,n2) - x1 ) * ( pxyd(2,n3) - y1 ) + % - ( pxyd(2,n2) - y1 ) * ( pxyd(1,n3) - x1 ) + cb1 = ( pxyd(1,n2) - x1 ) ** 2 + % + ( pxyd(2,n2) - y1 ) ** 2 + cb2 = ( point(1) - x1 ) ** 2 + % + ( point(2) - y1 ) ** 2 + cb3 = ( pxyd(1,n3) - x1 ) ** 2 + % + ( pxyd(2,n3) - y1 ) ** 2 + if( abs( dd ) .le. 1e-4 * sqrt( cb1 * cb3 ) ) then +c le point 3 est sur l'arete 1-2 +c le point doit y etre aussi + if( abs( d ) .le. 1e-4 * sqrt( cb1 * cb2 ) ) then +c point sur l'arete + nsigne = nsigne + 1 + endif + else +c le point 3 n'est pas sur l'arete . test des signes + if( d * dd .ge. 0 ) then + nsigne = nsigne + 1 + endif + endif +c permutation circulaire des 3 sommets et aretes + n = n1 + n1 = n2 + n2 = n3 + n3 = n + 10 continue + if( nsigne .ne. 3 ) nsigne = 0 + endif + end + + integer function nosstr( p, pxyd, nt, letree ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer le numero 0 a 3 du sous-triangle te contenant +c ----- le point p +c +c entrees: +c -------- +c p : point de r**2 contenu dans le te nt de letree +c pxyd : x y distance des points +c nt : numero letree du te de te voisin a calculer +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 …a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c sorties : +c --------- +c nosstr : 0 si le sous-triangle central contient p +c i =1,2,3 numero du sous-triangle contenant p +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + integer letree(0:8,0:*) + double precision pxyd(3,*), p(2), + % x1, y1, x21, y21, x31, y31, d, xe, ye +c +c le numero des 3 sommets du triangle + ns1 = letree( 6, nt ) + ns2 = letree( 7, nt ) + ns3 = letree( 8, nt ) +c +c les coordonnees entre 0 et 1 du point p + x1 = pxyd(1,ns1) + y1 = pxyd(2,ns1) +c + x21 = pxyd(1,ns2) - x1 + y21 = pxyd(2,ns2) - y1 +c + x31 = pxyd(1,ns3) - x1 + y31 = pxyd(2,ns3) - y1 +c + d = 1.0 / ( x21 * y31 - x31 * y21 ) +c + xe = ( ( p(1) - x1 ) * y31 - ( p(2) - y1 ) * x31 ) * d + ye = ( ( p(2) - y1 ) * x21 - ( p(1) - x1 ) * y21 ) * d +c + if( xe .gt. 0.5d0 ) then +c sous-triangle droit + nosstr = 2 + else if( ye .gt. 0.5d0 ) then +c sous-triangle haut + nosstr = 3 + else if( xe+ye .lt. 0.5d0 ) then +c sous-triangle gauche + nosstr = 1 + else +c sous-triangle central + nosstr = 0 + endif + end + + + integer function notrpt( p, pxyd, notrde, letree ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer le numero letree du sous-triangle feuille contenant +c ----- le point p a partir du te notrde de letree +c +c entrees: +c -------- +c p : point de r**2 contenu dans le te nt de letree +c pxyd : x y distance des points +c notrde : numero letree du triangle depart de recherche (1=>racine) +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 … 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c sorties : +c --------- +c notrpt : numero letree du triangle contenant le point p +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + integer letree(0:8,0:*) + double precision pxyd(1:3,*), p(2) +c +c la racine depart de la recherche + notrpt = notrde +c +c tant que la feuille n'est pas atteinte descendre l'arbre + 10 if( letree(0,notrpt) .gt. 0 ) then +c +c recherche du sous-triangle contenant p + nsot = nosstr( p, pxyd, notrpt, letree ) +c +c le numero letree du sous-triangle + notrpt = letree( nsot, notrpt ) + goto 10 +c + endif + end + + + subroutine teajpt( ns, nbsomm, mxsomm, pxyd, letree, + & ntrp, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : ajout du point ns de pxyd dans letree +c ----- +c +c entrees: +c -------- +c ns : numero du point a ajouter dans letree +c mxsomm : nombre maximal de points declarables dans pxyd +c pxyd : tableau des coordonnees des points +c par point : x y distance_souhaitee +c +c modifies : +c ---------- +c nbsomm : nombre actuel de points dans pxyd +c +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) : no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 …a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c sorties : +c --------- +c ntrp : numero letree du triangle te ou a ete ajoute le point +c ierr : 0 si pas d'erreur, 51 saturation letree, 52 saturation pxyd +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + integer letree(0:8,0:*) + double precision pxyd(3,mxsomm) +c +c depart de la racine + ntrp = 1 +c +c recherche du triangle contenant le point pxyd(ns) + 1 ntrp = notrpt( pxyd(1,ns), pxyd, ntrp, letree ) +c +c existe t il un point libre + do 10 i=0,3 + if( letree(i,ntrp) .eq. 0 ) then +c la place i est libre + letree(i,ntrp) = -ns + return + endif + 10 continue +c +c pas de place libre => 4 sous-triangles sont crees +c a partir des 3 milieux des aretes + call te4ste( nbsomm, mxsomm, pxyd, ntrp, letree, ierr ) + if( ierr .ne. 0 ) return +c +c ajout du point ns + goto 1 + end + + subroutine n1trva( nt, lar, letree, notrva, lhpile ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer le numero letree du triangle voisin du te nt +c ----- par l'arete lar (1 a 3 ) de nt +c attention : notrva n'est pas forcement minimal +c +c entrees: +c -------- +c nt : numero letree du te de te voisin a calculer +c lar : numero 1 a 3 de l'arete du triangle nt +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur-triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c sorties : +c --------- +c notrva : >0 numero letree du te voisin par l'arete lar +c =0 si pas de te voisin (racine , ... ) +c lhpile : =0 si nt et notrva ont meme taille +c >0 nt est 4**lhpile fois plus petit que notrva +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + integer letree(0:8,0:*) + integer lapile(1:64) +c +c initialisation de la pile +c le triangle est empile + lapile(1) = nt + lhpile = 1 +c +c tant qu'il existe un sur-triangle + 10 ntr = lapile( lhpile ) + if( ntr .eq. 1 ) then +c racine atteinte => pas de triangle voisin + notrva = 0 + lhpile = lhpile - 1 + return + endif +c +c le type du triangle ntr + nty = letree( 5, ntr ) +c l'eventuel sur-triangle + nsut = letree( 4, ntr ) +c + if( nty .eq. 0 ) then +c +c triangle de type 0 => triangle voisin de type precedent(lar) +c dans le sur-triangle de ntr +c ce triangle remplace ntr dans lapile + lapile( lhpile ) = letree( nopre3(lar), nsut ) + goto 20 + endif +c +c triangle ntr de type nty>0 + if( nosui3(nty) .eq. lar ) then +c +c le triangle voisin par lar est le triangle 0 + lapile( lhpile ) = letree( 0, nsut ) + goto 20 + endif +c +c triangle sans voisin direct => passage par le sur-triangle + if( nsut .eq. 0 ) then +c +c ntr est la racine => pas de triangle voisin par cette arete + notrva = 0 + return + else +c +c le sur-triangle est empile + lhpile = lhpile + 1 + lapile(lhpile) = nsut + goto 10 + endif +c +c descente aux sous-triangles selon la meme arete + 20 notrva = lapile( lhpile ) +c + 30 lhpile = lhpile - 1 + if( letree(0,notrva) .le. 0 ) then +c le triangle est une feuille de l'arbre 0 sous-triangle +c lhpile = nombre de differences de niveaux dans l'arbre + return + else +c le triangle a 4 sous-triangles + if( lhpile .gt. 0 ) then +c +c bas de pile non atteint + nty = letree( 5, lapile(lhpile) ) + if( nty .eq. lar ) then +c l'oppose est suivant(nty) de notrva + notrva = letree( nosui3(nty) , notrva ) + else +c l'oppose est precedent(nty) de notrva + notrva = letree( nopre3(nty) , notrva ) + endif + goto 30 + endif + endif +c +c meme niveau dans l'arbre lhpile = 0 + end + + + subroutine cenced( xy1, xy2, xy3, cetria, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul des coordonnees du centre du cercle circonscrit +c ----- du triangle defini par ses 3 sommets de coordonnees +c xy1 xy2 xy3 ainsi que le carre du rayon de ce cercle +c +c entrees : +c --------- +c xy1 xy2 xy3 : les 2 coordonnees des 3 sommets du triangle +c ierr : <0 => pas d'affichage si triangle degenere +c >=0 => affichage si triangle degenere +c +c sortie : +c -------- +c cetria : cetria(1)=abcisse du centre +c cetria(2)=ordonnee du centre +c cetria(3)=carre du rayon 1d28 si triangle degenere +c ierr : 0 si triangle non degenere +c 1 si triangle degenere +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : perronnet alain upmc analyse numerique paris juin 1995 +c2345x7..............................................................012 + parameter (epsurf=1d-7) + common / unites / lecteu,imprim,nunite(30) + double precision x1,y1,x21,y21,x31,y31, + % aire2,xc,yc,rot, + % xy1(2),xy2(2),xy3(2),cetria(3) +c +c le calcul de 2 fois l'aire du triangle +c attention l'ordre des 3 sommets est direct ou non + x1 = xy1(1) + x21 = xy2(1) - x1 + x31 = xy3(1) - x1 +c + y1 = xy1(2) + y21 = xy2(2) - y1 + y31 = xy3(2) - y1 +c + aire2 = x21 * y31 - x31 * y21 +c +c recherche d'un test relatif peu couteux +c pour reperer la degenerescence du triangle + if( abs(aire2) .le. + % epsurf*(abs(x21)+abs(x31))*(abs(y21)+abs(y31)) ) then +c triangle de qualite trop faible + if( ierr .ge. 0 ) then +c nblgrc(nrerr) = 1 +c kerr(1) = 'erreur cenced: triangle degenere' +c call lereur + write(imprim,*) 'erreur cenced: triangle degenere' + write(imprim,10000) xy1,xy2,xy3,aire2 + endif +10000 format( 3(' x=',g24.16,' y=',g24.16/),' aire*2=',g24.16) + cetria(1) = 0d0 + cetria(2) = 0d0 + cetria(3) = 1d28 + ierr = 1 + return + endif +c +c les 2 coordonnees du centre intersection des 2 mediatrices +c x = (x1+x2)/2 + lambda * (y2-y1) +c y = (y1+y2)/2 - lambda * (x2-x1) +c x = (x1+x3)/2 + rot * (y3-y1) +c y = (y1+y3)/2 - rot * (x3-x1) +c ========================================================== + rot = ((xy2(1)-xy3(1))*x21 + (xy2(2)-xy3(2))*y21) / (2 * aire2) +c + xc = ( x1 + xy3(1) ) * 0.5d0 + rot * y31 + yc = ( y1 + xy3(2) ) * 0.5d0 - rot * x31 +c + cetria(1) = xc + cetria(2) = yc +c +c le carre du rayon + cetria(3) = (x1-xc) ** 2 + (y1-yc) ** 2 +c +c pas d'erreur rencontree + ierr = 0 + end + + + double precision function angled( p1, p2, p3 ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer l'angle (p1p2,p1p3) en radians +c ----- +c +c entrees : +c --------- +c p1,p2,p3 : les 2 coordonnees des 3 sommets de l'angle +c sens direct pour une surface >0 +c sorties : +c --------- +c angled : angle (p1p2,p1p3) en radians entre [0 et 2pi] +c 0 si p1=p2 ou p1=p3 +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique upmc paris fevrier 1992 +c2345x7..............................................................012 + double precision p1(2),p2(2),p3(2),x21,y21,x31,y31,a1,a2,d,c +c +c les cotes + x21 = p2(1) - p1(1) + y21 = p2(2) - p1(2) + x31 = p3(1) - p1(1) + y31 = p3(2) - p1(2) +c +c longueur des cotes + a1 = x21 * x21 + y21 * y21 + a2 = x31 * x31 + y31 * y31 + d = sqrt( a1 * a2 ) + if( d .eq. 0 ) then + angled = 0 + return + endif +c +c cosinus de l'angle + c = ( x21 * x31 + y21 * y31 ) / d + if( c .le. -1.d0 ) then +c tilt sur apollo si acos( -1 -eps ) + angled = atan( 1.d0 ) * 4.d0 + return + else if( c .ge. 1.d0 ) then +c tilt sur apollo si acos( 1 + eps ) + angled = 0 + return + endif +c + angled = acos( c ) + if( x21 * y31 - x31 * y21 .lt. 0 ) then +c demi plan inferieur + angled = 8.d0 * atan( 1.d0 ) - angled + endif + end + + + subroutine teajte( mxsomm, nbsomm, pxyd, comxmi, + % aretmx, mxtree, letree, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : initialisation des tableaux letree +c ----- ajout des sommets 1 a nbsomm (valeur en entree) dans letree +c +c entrees: +c -------- +c mxsomm : nombre maximal de sommets permis pour la triangulation +c mxtree : nombre maximal de triangles equilateraux (te) declarables +c aretmx : longueur maximale des aretes des triangles equilateraux +c +c entrees et sorties : +c -------------------- +c nbsomm : nombre de sommets apres identification +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c tableau reel(3,mxsomm) +c +c sorties: +c -------- +c comxmi : coordonnees minimales et maximales des points frontaliers +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) : no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c ierr : 0 si pas d'erreur +c 51 saturation letree +c 52 saturation pxyd +c 7 tous les points sont alignes +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juillet 1994 +c....................................................................012 + integer letree(0:8,0:mxtree) + double precision pxyd(3,mxsomm) + double precision comxmi(3,2) + double precision a(2),s,aretmx,rac3 +c +c protection du nombre de sommets avant d'ajouter ceux de tetree + nbsofr = nbsomm + do 1 i = 1, nbsomm + comxmi(1,1) = min( comxmi(1,1), pxyd(1,i) ) + comxmi(1,2) = max( comxmi(1,2), pxyd(1,i) ) + comxmi(2,1) = min( comxmi(2,1), pxyd(2,i) ) + comxmi(2,2) = max( comxmi(2,2), pxyd(2,i) ) + 1 continue +c +c creation de l'arbre tee +c ======================= +c la premiere colonne vide de letree + letree(0,0) = 2 +c chainage des te vides + do 4 i = 2 , mxtree + letree(0,i) = i+1 + 4 continue + letree(0,mxtree) = 0 +c les maxima des 2 indices de letree + letree(1,0) = 8 + letree(2,0) = mxtree +c +c la racine +c aucun point interne au triangle equilateral (te) 1 + letree(0,1) = 0 + letree(1,1) = 0 + letree(2,1) = 0 + letree(3,1) = 0 +c pas de sur-triangle + letree(4,1) = 0 + letree(5,1) = 0 +c le numero pxyd des 3 sommets du te 1 + letree(6,1) = nbsomm + 1 + letree(7,1) = nbsomm + 2 + letree(8,1) = nbsomm + 3 +c +c calcul de la largeur et hauteur du rectangle englobant +c ====================================================== + a(1) = comxmi(1,2) - comxmi(1,1) + a(2) = comxmi(2,2) - comxmi(2,1) +c la longueur de la diagonale + s = sqrt( a(1)**2 + a(2)**2 ) + do 60 k=1,2 + if( a(k) .lt. 1e-4 * s ) then +c nblgrc(nrerr) = 1 + write(imprim,*) 'tous les points sont alignes' +c call lereur + ierr = 7 + return + endif + 60 continue +c +c le maximum des ecarts + s = s + s +c +c le triangle equilateral englobant +c ================================= +c ecart du rectangle au triangle equilateral + rac3 = sqrt( 3.0d0 ) + arete = a(1) + 2 * aretmx + 2 * ( a(2) + aretmx ) / rac3 +c +c le point nbsomm + 1 en bas a gauche + nbsomm = nbsomm + 1 + pxyd(1,nbsomm) = (comxmi(1,1)+comxmi(1,2))*0.5d0 - arete*0.5d0 + pxyd(2,nbsomm) = comxmi(2,1) - aretmx + pxyd(3,nbsomm) = s +c +c le point nbsomm + 2 en bas a droite + nbsomm = nbsomm + 1 + pxyd(1,nbsomm) = pxyd(1,nbsomm-1) + arete + pxyd(2,nbsomm) = pxyd(2,nbsomm-1) + pxyd(3,nbsomm) = s +c +c le point nbsomm + 3 sommet au dessus + nbsomm = nbsomm + 1 + pxyd(1,nbsomm) = pxyd(1,nbsomm-2) + arete * 0.5d0 + pxyd(2,nbsomm) = pxyd(2,nbsomm-2) + arete * 0.5d0 * rac3 + pxyd(3,nbsomm) = s +c +c ajout des sommets des lignes pour former letree +c =============================================== + do 150 i=1,nbsofr +c ajout du point i de pxyd a letree + call teajpt( i, nbsomm, mxsomm, pxyd, letree, + & nt, ierr ) + if( ierr .ne. 0 ) return + 150 continue +c + return + end + + + subroutine tetaid( nutysu, dx, dy, longai, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer la longueur de l'arete ideale en dx,dy +c ----- +c +c entrees: +c -------- +c nutysu : numero de traitement de areteideale() selon le type de surface +c 0 pas d'emploi de la fonction areteideale() => aretmx active +c 1 il existe une fonction areteideale(xyz,xyzdir) +c ... autres options a definir ... +c dx, dy : abscisse et ordonnee dans le plan du point (reel2!) +c +c sorties: +c -------- +c longai : longueur de l'areteideale(xyz,xyzdir) autour du point xyz +c ierr : 0 si pas d'erreur, <>0 sinon +c 1 calcul incorrect de areteideale(xyz,xyzdir) +c 2 longueur calculee nulle +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) +c + double precision areteideale + double precision dx, dy, longai + double precision xyz(3), xyzd(3), d0 +c + ierr = 0 + if( nutysu .gt. 0 ) then + d0 = longai +c le point ou se calcule la longueur + xyz(1) = dx + xyz(2) = dy +c z pour le calcul de la longueur (inactif ici!) + xyz(3) = 0d0 +c la direction pour le calcul de la longueur (inactif ici!) + xyzd(1) = 0d0 + xyzd(2) = 0d0 + xyzd(3) = 0d0 + + longai = areteideale(xyz,xyzd) + if( longai .lt. 0d0 ) then + write(imprim,10000) xyz +10000 format('attention: longueur de areteideale(', + % g14.6,',',g14.6,',',g14.6,')<=0! => rendue >0' ) + longai = -longai + endif + if( longai .eq. 0d0 ) then + write(imprim,10001) xyz +10001 format('erreur: longueur de areteideale(', + % g14.6,',',g14.6,',',g14.6,')=0!' ) + ierr = 2 + longai = d0 + endif + endif + end + + + subroutine tehote( nutysu, + % nbarpi, mxsomm, nbsomm, pxyd, + % comxmi, aretmx, + % letree, mxqueu, laqueu, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : homogeneisation de l'arbre des te a un saut de taille au plus +c ----- prise en compte des distances souhaitees autour des sommets initiaux +c +c entrees: +c -------- +c nutysu : numero de traitement de areteideale() selon le type de surface +c 0 pas d'emploi de la fonction areteideale() => aretmx active +c 1 il existe une fonction areteideale() +c dont seules les 2 premieres composantes de uv sont actives +c autres options a definir... +c nbarpi : nombre de sommets de la frontiere + nombre de points internes +c imposes par l'utilisateur +c mxsomm : nombre maximal de sommets permis pour la triangulation et te +c mxqueu : nombre d'entiers utilisables dans laqueu +c comxmi : minimum et maximum des coordonnees de l'objet +c aretmx : longueur maximale des aretes des triangles equilateraux +c permtr : perimetre de la ligne enveloppe dans le plan +c avant mise a l'echelle a 2**20 +c +c modifies : +c ---------- +c nbsomm : nombre de sommets apres identification +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) : no du 1-er te vide dans letree +c letree(1,0) : maximum du 1-er indice de letree (ici 8) +c letree(2,0) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c auxiliaire : +c ------------ +c laqueu : mxqueu entiers servant de queue pour le parcours de letree +c +c sorties: +c -------- +c ierr : 0 si pas d'erreur +c 51 si saturation letree dans te4ste +c 52 si saturation pxyd dans te4ste +c >0 si autre erreur +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc avril 1997 +c2345x7..............................................................012 + double precision ampli + parameter (ampli=1.34d0) + common / unites / lecteu, imprim, intera, nunite(29) +c + double precision pxyd(3,mxsomm), d2, aretm2 + double precision comxmi(3,2),aretmx,a,s,xrmin,xrmax,yrmin,yrmax + double precision dmin, dmax + integer letree(0:8,0:*) +c + integer laqueu(1:mxqueu),lequeu +c lequeu : entree dans la queue +c lhqueu : longueur de la queue +c gestion circulaire +c + integer nuste(3) + equivalence (nuste(1),ns1),(nuste(2),ns2),(nuste(3),ns3) +c +c existence ou non de la fonction 'taille_ideale' des aretes +c autour du point. ici la carte est supposee isotrope +c ========================================================== +c attention: si la fonction taille_ideale existe +c alors pxyd(3,*) est la taille_ideale dans l'espace initial +c sinon pxyd(3,*) est la distance calculee dans le plan par +c propagation a partir des tailles des aretes de la frontiere +c + if( nutysu .gt. 0 ) then +c +c la fonction taille_ideale(x,y,z) existe +c --------------------------------------- +c initialisation de la distance souhaitee autour des points 1 a nbsomm + do 1 i=1,nbsomm +c calcul de pxyzd(3,i) + call tetaid( nutysu, pxyd(1,i), pxyd(2,i), + % pxyd(3,i), ierr ) + if( ierr .ne. 0 ) goto 9999 + 1 continue +c + else +c +c la fonction taille_ideale(x,y,z) n'existe pas +c --------------------------------------------- +c prise en compte des distances souhaitees dans le plan +c autour des points frontaliers et des points internes imposes +c toutes les autres distances souhaitees ont ete mis a aretmx +c lors de l'execution du sp teqini + do 3 i=1,nbarpi +c le sommet i n'est pas un sommet de letree => sommet frontalier +c recherche du sous-triangle minimal feuille contenant le point i + nte = 1 + 2 nte = notrpt( pxyd(1,i), pxyd, nte, letree ) +c la distance au sommet le plus eloigne est elle inferieure +c a la distance souhaitee? + ns1 = letree(6,nte) + ns2 = letree(7,nte) + ns3 = letree(8,nte) + d2 = max( ( pxyd(1,i)-pxyd(1,ns1) )**2 + + % ( pxyd(2,i)-pxyd(2,ns1) )**2 + % , ( pxyd(1,i)-pxyd(1,ns2) )**2 + + % ( pxyd(2,i)-pxyd(2,ns2) )**2 + % , ( pxyd(1,i)-pxyd(1,ns3) )**2 + + % ( pxyd(2,i)-pxyd(2,ns3) )**2 ) + if( d2 .gt. pxyd(3,i)**2 ) then +c le triangle nte trop grand doit etre subdivise en 4 sous-triangle + call te4ste( nbsomm, mxsomm, pxyd, nte, letree, + & ierr ) + if( ierr .ne. 0 ) return + goto 2 + endif + 3 continue + endif +c +c le sous-triangle central de la racine est decoupe systematiquement +c ================================================================== + nte = 2 + if( letree(0,2) .le. 0 ) then +c le sous-triangle central de la racine n'est pas subdivise +c il est donc decoupe en 4 soustriangles + nbsom0 = nbsomm + call te4ste( nbsomm, mxsomm, pxyd, nte, letree, + % ierr ) + if( ierr .ne. 0 ) return + do 4 i=nbsom0+1,nbsomm +c mise a jour de taille_ideale des nouveaux sommets de te + call tetaid( nutysu, pxyd(1,i), pxyd(2,i), pxyd(3,i), ierr ) + if( ierr .ne. 0 ) goto 9999 + 4 continue + endif +c +c le carre de la longueur de l'arete de triangles equilateraux +c souhaitee pour le fond de la triangulation + aretm2 = (aretmx*ampli) ** 2 +c +c tout te contenu dans le rectangle englobant doit avoir un +c cote < aretmx et etre de meme taille que les te voisins +c s'il contient un point; sinon un seul saut de taille est permis +c =============================================================== +c le rectangle englobant pour selectionner les te "internes" +c le numero des 3 sommets du te englobant racine de l'arbre des te + ns1 = letree(6,1) + ns2 = letree(7,1) + ns3 = letree(8,1) + a = aretmx * 0.01d0 +c abscisse du milieu de l'arete gauche du te 1 + s = ( pxyd(1,ns1) + pxyd(1,ns3) ) / 2 + xrmin = min( s, comxmi(1,1) - aretmx ) - a +c abscisse du milieu de l'arete droite du te 1 + s = ( pxyd(1,ns2) + pxyd(1,ns3) ) / 2 + xrmax = max( s, comxmi(1,2) + aretmx ) + a + yrmin = comxmi(2,1) - aretmx +c ordonnee de la droite passant par les milieus des 2 aretes +c droite gauche du te 1 + s = ( pxyd(2,ns1) + pxyd(2,ns3) ) / 2 + yrmax = max( s, comxmi(2,2) + aretmx ) + a +c +c cas particulier de 3 ou 4 ou peu d'aretes frontalieres + if( nbarpi .le. 8 ) then +c tout le triangle englobant (racine) est a prendre en compte + xrmin = pxyd(1,ns1) - a + xrmax = pxyd(1,ns2) + a + yrmin = pxyd(2,ns1) - a + yrmax = pxyd(2,ns3) + a + endif +c + nbs0 = nbsomm + nbiter = -1 +c +c initialisation de la queue + 5 nbiter = nbiter + 1 + lequeu = 1 + lhqueu = 0 +c la racine de letree initialise la queue + laqueu(1) = 1 +c +c tant que la longueur de la queue est >=0 traiter le debut de queue + 10 if( lhqueu .ge. 0 ) then +c +c le triangle te a traiter + i = lequeu - lhqueu + if( i .le. 0 ) i = mxqueu + i + nte = laqueu( i ) +c la longueur de la queue est reduite + lhqueu = lhqueu - 1 +c +c nte est il un sous-triangle feuille minimal ? + 15 if( letree(0,nte) .gt. 0 ) then +c +c non les 4 sous-triangles sont mis dans la queue + if( lhqueu + 4 .ge. mxqueu ) then + write(imprim,*) 'tehote: saturation de la queue' + ierr = 7 + return + endif + do 20 i=3,0,-1 +c ajout du sous-triangle i + lhqueu = lhqueu + 1 + lequeu = lequeu + 1 + if( lequeu .gt. mxqueu ) lequeu = lequeu - mxqueu + laqueu( lequeu ) = letree( i, nte ) + 20 continue + goto 10 +c + endif +c +c ici nte est un triangle minimal non subdivise +c --------------------------------------------- +c le te est il dans le cadre englobant de l'objet ? + ns1 = letree(6,nte) + ns2 = letree(7,nte) + ns3 = letree(8,nte) + if( pxyd(1,ns1) .gt. pxyd(1,ns2) ) then + dmin = pxyd(1,ns2) + dmax = pxyd(1,ns1) + else + dmin = pxyd(1,ns1) + dmax = pxyd(1,ns2) + endif + if( (xrmin .le. dmin .and. dmin .le. xrmax) .or. + % (xrmin .le. dmax .and. dmax .le. xrmax) ) then + if( pxyd(2,ns1) .gt. pxyd(2,ns3) ) then + dmin = pxyd(2,ns3) + dmax = pxyd(2,ns1) + else + dmin = pxyd(2,ns1) + dmax = pxyd(2,ns3) + endif + if( (yrmin .le. dmin .and. dmin .le. yrmax) .or. + % (yrmin .le. dmax .and. dmax .le. yrmax) ) then +c +c nte est un te feuille et interne au rectangle englobant +c ======================================================= +c le carre de la longueur de l'arete du te de numero nte + d2 = (pxyd(1,ns1)-pxyd(1,ns2)) ** 2 + + % (pxyd(2,ns1)-pxyd(2,ns2)) ** 2 +c + if( nutysu .eq. 0 ) then +c +c il n'existe pas de fonction 'taille_ideale' +c ------------------------------------------- +c si la taille effective de l'arete du te est superieure a aretmx +c alors le te est decoupe + if( d2 .gt. aretm2 ) then +c le triangle nte trop grand doit etre subdivise +c en 4 sous-triangles + call te4ste( nbsomm,mxsomm, pxyd, + % nte, letree, ierr ) + if( ierr .ne. 0 ) return + goto 15 + endif +c + else +c +c il existe ici une fonction 'taille_ideale' +c ------------------------------------------ +c si la taille effective de l'arete du te est superieure au mini +c des 3 tailles_ideales aux sommets alors le te est decoupe + do 28 i=1,3 + if( d2 .gt. (pxyd(3,nuste(i))*ampli)**2 ) then +c le triangle nte trop grand doit etre subdivise +c en 4 sous-triangles + nbsom0 = nbsomm + call te4ste( nbsomm, mxsomm, pxyd, + & nte, letree, ierr ) + if( ierr .ne. 0 ) return + do 27 j=nbsom0+1,nbsomm +c mise a jour de taille_ideale des nouveaux sommets de + call tetaid( nutysu, pxyd(1,j), pxyd(2,j), + % pxyd(3,j), ierr ) + if( ierr .ne. 0 ) goto 9999 + 27 continue + goto 15 + endif + 28 continue + endif +c +c recherche du nombre de niveaux entre nte et les te voisins par se +c si la difference de subdivisions excede 1 alors le plus grand des +c ================================================================= + 29 do 30 i=1,3 +c +c noteva triangle voisin de nte par l'arete i + call n1trva( nte, i, letree, noteva, niveau ) + if( noteva .le. 0 ) goto 30 +c il existe un te voisin + if( niveau .gt. 0 ) goto 30 +c nte a un te voisin plus petit ou egal + if( letree(0,noteva) .le. 0 ) goto 30 +c nte a un te voisin noteva subdivise au moins une fois +c + if( nbiter .gt. 0 ) then +c les 2 sous triangles voisins sont-ils subdivises? + ns2 = letree(i,noteva) + if( letree(0,ns2) .le. 0 ) then +c ns2 n'est pas subdivise + ns2 = letree(nosui3(i),noteva) + if( letree(0,ns2) .le. 0 ) then +c les 2 sous-triangles ne sont pas subdivises + goto 30 + endif + endif + endif +c +c saut>1 => le triangle nte doit etre subdivise en 4 sous-triang +c -------------------------------------------------------------- + nbsom0 = nbsomm + call te4ste( nbsomm,mxsomm, pxyd, nte, letree, + & ierr ) + if( ierr .ne. 0 ) return + if( nutysu .gt. 0 ) then + do 32 j=nbsom0+1,nbsomm +c mise a jour de taille_ideale des nouveaux sommets de te + call tetaid( nutysu, pxyd(1,j), pxyd(2,j), + % pxyd(3,j), ierr ) + if( ierr .ne. 0 ) goto 9999 + 32 continue + endif + goto 15 +c + 30 continue + endif + endif + goto 10 + endif + if( nbs0 .lt. nbsomm ) then + nbs0 = nbsomm + goto 5 + endif + return +c +c pb dans le calcul de la fonction taille_ideale + + 9999 write(imprim,*) 'pb dans le calcul de taille_ideale' +c nblgrc(nrerr) = 1 +c kerr(1) = 'pb dans le calcul de taille_ideale' +c call lereur + return + end + + + subroutine tetrte( comxmi, aretmx, nbarpi, mxsomm, pxyd, + % mxqueu, laqueu, letree, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : trianguler les triangles equilateraux feuilles et +c ----- les points de la frontiere et les points internes imposes +c +c attention: la triangulation finale n'est pas de type delaunay! +c +c entrees: +c -------- +c comxmi : minimum et maximum des coordonnees de l'objet +c aretmx : longueur maximale des aretes des triangles equilateraux +c nbarpi : nombre de sommets de la frontiere + nombre de points internes +c imposes par l'utilisateur +c mxsomm : nombre maximal de sommets declarables dans pxyd +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c +c mxqueu : nombre d'entiers utilisables dans laqueu +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) : no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c noarst : noarst(i) numero d'une arete de sommet i +c +c auxiliaire : +c ------------ +c laqueu : mxqueu entiers servant de queue pour le parcours de letree +c +c sorties: +c -------- +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes d'un t +c =5 si saturation de la queue de parcours de l'arbre des te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, intera, nunite(29) +c + double precision pxyd(3,mxsomm) + double precision comxmi(3,2),aretmx,a,s,xrmin,xrmax,yrmin,yrmax + double precision dmin, dmax +c + integer nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(mxsomm) +c + integer letree(0:8,0:*) + integer laqueu(1:mxqueu) +c lequeu:entree dans la queue en gestion circulaire +c lhqueu:longueur de la queue en gestion circulaire +c + integer milieu(3), nutr(1:13) +c +c le rectangle englobant pour selectionner les te "internes" +c le numero des 3 sommets du te englobant racine de l'arbre des te + ns1 = letree(6,1) + ns2 = letree(7,1) + ns3 = letree(8,1) + a = aretmx * 0.01d0 +c abscisse du milieu de l'arete gauche du te 1 + s = ( pxyd(1,ns1) + pxyd(1,ns3) ) / 2 + xrmin = min( s, comxmi(1,1) - aretmx ) - a +c abscisse du milieu de l'arete droite du te 1 + s = ( pxyd(1,ns2) + pxyd(1,ns3) ) / 2 + xrmax = max( s, comxmi(1,2) + aretmx ) + a + yrmin = comxmi(2,1) - aretmx +c ordonnee de la droite passant par les milieus des 2 aretes +c droite gauche du te 1 + s = ( pxyd(2,ns1) + pxyd(2,ns3) ) / 2 + yrmax = max( s, comxmi(2,2) + aretmx ) + a +c +c cas particulier de 3 ou 4 ou peu d'aretes frontalieres + if( nbarpi .le. 8 ) then +c tout le triangle englobant (racine) est a prendre en compte + xrmin = pxyd(1,ns1) - a + xrmax = pxyd(1,ns2) + a + yrmin = pxyd(2,ns1) - a + yrmax = pxyd(2,ns3) + a + endif +c +c initialisation du tableau noartr + do 5 i=1,mxartr +c le numero de l'arete est inconnu + noartr(1,i) = 0 +c le chainage sur le triangle vide suivant + noartr(2,i) = i+1 + 5 continue + noartr(2,mxartr) = 0 + n1artr = 1 +c +c parcours des te jusqu'a trianguler toutes les feuilles (triangles eq) +c ===================================================================== +c initialisation de la queue sur les te + ierr = 0 + lequeu = 1 + lhqueu = 0 +c la racine de letree initialise la queue + laqueu(1) = 1 +c +c tant que la longueur de la queue est >=0 traiter le debut de queue + 10 if( lhqueu .ge. 0 ) then +c +c le triangle te a traiter + i = lequeu - lhqueu + if( i .le. 0 ) i = mxqueu + i + nte = laqueu( i ) +c la longueur est reduite + lhqueu = lhqueu - 1 +c +c nte est il un sous-triangle feuille (minimal) ? + 15 if( letree(0,nte) .gt. 0 ) then +c non les 4 sous-triangles sont mis dans la queue + if( lhqueu + 4 .ge. mxqueu ) then + write(imprim,*) 'tetrte: saturation de la queue' + ierr = 5 + return + endif + do 20 i=3,0,-1 +c ajout du sous-triangle i + lhqueu = lhqueu + 1 + lequeu = lequeu + 1 + if( lequeu .gt. mxqueu ) lequeu = lequeu - mxqueu + laqueu( lequeu ) = letree( i, nte ) + 20 continue + goto 10 + endif +c +c ici nte est un triangle minimal non subdivise +c --------------------------------------------- +c le te est il dans le cadre englobant de l'objet ? + ns1 = letree(6,nte) + ns2 = letree(7,nte) + ns3 = letree(8,nte) + if( pxyd(1,ns1) .gt. pxyd(1,ns2) ) then + dmin = pxyd(1,ns2) + dmax = pxyd(1,ns1) + else + dmin = pxyd(1,ns1) + dmax = pxyd(1,ns2) + endif + if( (xrmin .le. dmin .and. dmin .le. xrmax) .or. + % (xrmin .le. dmax .and. dmax .le. xrmax) ) then + if( pxyd(2,ns1) .gt. pxyd(2,ns3) ) then + dmin = pxyd(2,ns3) + dmax = pxyd(2,ns1) + else + dmin = pxyd(2,ns1) + dmax = pxyd(2,ns3) + endif + if( (yrmin .le. dmin .and. dmin .le. yrmax) .or. + % (yrmin .le. dmax .and. dmax .le. yrmax) ) then +c +c te minimal et interne au rectangle englobant +c -------------------------------------------- +c recherche du nombre de niveaux entre nte et les te voisins +c par ses aretes + nbmili = 0 + do 30 i=1,3 +c +c a priori pas de milieu de l'arete i du te nte + milieu(i) = 0 +c +c recherche de noteva te voisin de nte par l'arete i + call n1trva( nte, i, letree, noteva, niveau ) +c noteva : >0 numero letree du te voisin par l'arete i +c =0 si pas de te voisin (racine , ... ) +c niveau : =0 si nte et noteva ont meme taille +c >0 nte est 4**niveau fois plus petit que noteva + if( noteva .gt. 0 ) then +c il existe un te voisin + if( letree(0,noteva) .gt. 0 ) then +c noteva est plus petit que nte +c => recherche du numero du milieu du cote=sommet du te no +c le sous-te 0 du te noteva + nsot = letree(0,noteva) +c le numero dans pxyd du milieu de l'arete i de nte + milieu( i ) = letree( 5+nopre3(i), nsot ) + nbmili = nbmili + 1 + endif + endif +c + 30 continue +c +c triangulation du te nte en fonction du nombre de ses milieux + goto( 50, 100, 200, 300 ) , nbmili + 1 +c +c 0 milieu => 1 triangle = le te nte +c ---------------------------------- + 50 call f0trte( letree(0,nte), pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) + if( ierr .ne. 0 ) return + goto 10 +c +c 1 milieu => 2 triangles = 2 demi te +c ----------------------------------- + 100 call f1trte( letree(0,nte), pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) + if( ierr .ne. 0 ) return + goto 10 +c +c 2 milieux => 3 triangles +c ----------------------------------- + 200 call f2trte( letree(0,nte), pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) + if( ierr .ne. 0 ) return + goto 10 +c +c 3 milieux => 4 triangles = 4 quart te +c ------------------------------------- + 300 call f3trte( letree(0,nte), pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) + if( ierr .ne. 0 ) return + goto 10 + endif + endif + goto 10 + endif + end + + + subroutine aisoar( mosoar, mxsoar, nosoar, na1 ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : chainer en colonne lchain les aretes non vides et +c ----- non frontalieres du tableau nosoar +c +c entrees: +c -------- +c mosoar : nombre maximal d'entiers par arete dans le tableau nosoar +c mxsoar : nombre maximal d'aretes frontalieres declarables +c +c modifies : +c ---------- +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c nosoar(lchain,i)=arete interne suivante +c +c sortie : +c -------- +c na1 : numero dans nosoar de la premiere arete interne +c les suivantes sont nosoar(lchain,na1), ... +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter (lchain=6) + integer nosoar(mosoar,mxsoar) +c +c formation du chainage des aretes internes a echanger eventuellement +c recherche de la premiere arete non vide et non frontaliere + do 10 na1=1,mxsoar + if( nosoar(1,na1) .gt. 0 .and. nosoar(3,na1) .le. 0 ) goto 15 + 10 continue +c +c protection de la premiere arete non vide et non frontaliere + 15 na0 = na1 + do 20 na=na1+1,mxsoar + if( nosoar(1,na) .gt. 0 .and. nosoar(3,na) .le. 0 ) then +c arete interne => elle est chainee a partir de la precedente + nosoar(lchain,na0) = na + na0 = na + endif + 20 continue +c +c la derniere arete interne n'a pas de suivante + nosoar(lchain,na0) = 0 + end + + + subroutine tedela( pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, n1ardv, + % moartr, mxartr, n1artr, noartr, modifs ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : pour toutes les aretes chainees dans nosoar(lchain,*) +c ----- du tableau nosoar +c echanger la diagonale des 2 triangles si le sommet oppose +c a un triangle ayant en commun une arete appartient au cercle +c circonscrit de l'autre (violation boule vide delaunay) +c +c entrees: +c -------- +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c +c modifies : +c ---------- +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete dans le tableau nosoar +c mxsoar : nombre maximal d'aretes frontalieres declarables +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c n1ardv : numero dans nosoar de la premiere arete du chainage +c des aretes a rendre delaunay +c +c moartr : nombre d'entiers par triangle dans le tableau noartr +c mxartr : nombre maximal de triangles declarables dans noartr +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c modifs : nombre d'echanges de diagonales pour maximiser la qualite +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter (lchain=6) + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*), surtd2, s123, s142, s143, s234, + % s12, s34, a12, cetria(3), r0 + integer nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*) +c +c le nombre d'echanges de diagonales pour minimiser l'aire + modifs = 0 + r0 = 0 +c +c la premiere arete du chainage des aretes a rendre delaunay + na0 = n1ardv +c +c tant que la pile des aretes a echanger eventuellement est non vide +c ================================================================== + 20 if( na0 .gt. 0 ) then +c +c l'arete a traiter + na = na0 +c la prochaine arete a traiter + na0 = nosoar(lchain,na0) +c +c l'arete est marquee traitee avec le numero -1 + nosoar(lchain,na) = -1 +c +c l'arete est elle active? + if( nosoar(1,na) .eq. 0 ) goto 20 +c +c si arete frontaliere pas d'echange possible + if( nosoar(3,na) .gt. 0 ) goto 20 +c +c existe-t-il 2 triangles ayant cette arete commune? + if( nosoar(4,na) .le. 0 .or. nosoar(5,na) .le. 0 ) goto 20 +c +c aucun des 2 triangles est-il desactive? + if( noartr(1,nosoar(4,na)) .eq. 0 .or. + % noartr(1,nosoar(5,na)) .eq. 0 ) goto 20 +c +c l'arete appartient a deux triangles actifs +c le numero des 4 sommets du quadrangle des 2 triangles + call mt4sqa( na, moartr, noartr, mosoar, nosoar, + % ns1, ns2, ns3, ns4 ) + if( ns4 .eq. 0 ) goto 20 +c +c carre de la longueur de l'arete ns1 ns2 + a12 = (pxyd(1,ns2)-pxyd(1,ns1))**2+(pxyd(2,ns2)-pxyd(2,ns1))**2 +c +c comparaison de la somme des aires des 2 triangles +c ------------------------------------------------- +c calcul des surfaces des triangles 123 et 142 de cette arete + s123=surtd2( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3) ) + s142=surtd2( pxyd(1,ns1), pxyd(1,ns4), pxyd(1,ns2) ) + s12 = abs( s123 ) + abs( s142 ) + if( s12 .le. 0.001*a12 ) goto 20 +c +c calcul des surfaces des triangles 143 et 234 de cette arete + s143=surtd2( pxyd(1,ns1), pxyd(1,ns4), pxyd(1,ns3) ) + s234=surtd2( pxyd(1,ns2), pxyd(1,ns3), pxyd(1,ns4) ) + s34 = abs( s234 ) + abs( s143 ) +c + if( abs(s34-s12) .gt. 1d-15*s34 ) goto 20 +c +c quadrangle convexe : le critere de delaunay intervient +c ------------------ --------------------------------- +c calcul du centre et rayon de la boule circonscrite a 123 +c pas d'affichage si le triangle est degenere + ierr = -1 + call cenced( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3), cetria, + % ierr ) + if( ierr .gt. 0 ) then +c ierr=1 si triangle degenere => abandon + goto 20 + endif +c + if( (cetria(1)-pxyd(1,ns4))**2+(cetria(2)-pxyd(2,ns4))**2 + % .lt. cetria(3) ) then +c +c protection contre une boucle infinie sur le meme cercle + if( r0 .eq. cetria(3) ) goto 20 +c +c oui: ns4 est dans le cercle circonscrit a ns1 ns2 ns3 +c => ns3 est aussi dans le cercle circonscrit de ns1 ns2 ns4 +c +cccc les 2 triangles d'arete na sont effaces +ccc do 25 j=4,5 +ccc nt = nosoar(j,na) +cccc trace du triangle nt +ccc call mttrtr( pxyd, nt, moartr, noartr, mosoar, nosoar, +ccc % ncnoir, ncjaun ) +ccc 25 continue +c +c echange de la diagonale 12 par 34 des 2 triangles + call te2t2t( na, mosoar, n1soar, nosoar, noarst, + % moartr, noartr, na34 ) + if( na34 .eq. 0 ) goto 20 + r0 = cetria(3) +c +c l'arete na34 est marquee traitee + nosoar(lchain,na34) = -1 + modifs = modifs + 1 +c +c les aretes internes peripheriques des 2 triangles sont enchainees + do 60 j=4,5 + nt = nosoar(j,na34) +cccc trace du triangle nt +ccc call mttrtr( pxyd, nt, moartr, noartr, mosoar, nosoar, +ccc % ncoran, ncgric ) + do 50 i=1,3 + n = abs( noartr(i,nt) ) + if( n .ne. na34 ) then + if( nosoar(3,n) .eq. 0 .and. + % nosoar(lchain,n) .eq. -1 ) then +c cette arete marquee est chainee pour etre traitee + nosoar(lchain,n) = na0 + na0 = n + endif + endif + 50 continue + 60 continue + goto 20 + endif +c +c retour en haut de la pile des aretes a traiter + goto 20 + endif + end + + + subroutine terefr( nbarpi, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, larmin, notrcf, + % nbarpe, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : recherche des aretes de la frontiere non dans la triangulation +c ----- triangulation frontale pour les reobtenir +c +c attention: le chainage lchain de nosoar devient celui des cf +c +c entrees: +c -------- +c le tableau nosoar +c nbarpi : numero du dernier point interne impose par l'utilisateur +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxarcf : nombre de variables des tableaux n1arcf, noarcf, larmin, notrcf +c +c modifies: +c --------- +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c +c auxiliaires : +c ------------- +c n1arcf : tableau (0:mxarcf) auxiliaire d'entiers +c noarcf : tableau (3,mxarcf) auxiliaire d'entiers +c larmin : tableau (mxarcf) auxiliaire d'entiers +c notrcf : tableau (mxarcf) auxiliaire d'entiers +c +c sortie : +c -------- +c nbarpe : nombre d'aretes perdues puis retrouvees +c ierr : =0 si pas d'erreur +c >0 si une erreur est survenue +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter (lchain=6) + common / unites / lecteu,imprim,intera,nunite(29) + double precision pxyd(3,*) + integer nosoar(mosoar,mxsoar), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf), + % notrcf(mxarcf) +c +c le nombre d'aretes de la frontiere non arete de la triangulation + nbarpe = 0 +c +c initialisation du chainage des aretes des cf => 0 arete de cf + do 10 narete=1,mxsoar + nosoar( lchain, narete) = -1 + 10 continue +c +c boucle sur l'ensemble des aretes actuelles +c ========================================== + do 30 narete=1,mxsoar +c + if( nosoar(3,narete) .gt. 0 ) then +c arete appartenant a une ligne => frontaliere +c + if(nosoar(4,narete) .le. 0 .or. nosoar(5,narete) .le. 0)then +c l'arete narete frontaliere n'appartient pas a 2 triangles +c => elle est perdue + nbarpe = nbarpe + 1 +c +c le numero des 2 sommets de l'arete frontaliere perdue + ns1 = nosoar( 1, narete ) + ns2 = nosoar( 2, narete ) +c write(imprim,10000) ns1,(pxyd(j,ns1),j=1,2), +c % ns2,(pxyd(j,ns2),j=1,2) +10000 format(' arete perdue a forcer', + % (t24,'sommet=',i6,' x=',g13.5,' y=',g13.5)) +c +c traitement de cette arete perdue ns1-ns2 + call tefoar( narete, nbarpi, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, larmin, notrcf, + % ierr ) + if( ierr .ne. 0 ) return +c +c fin du traitement de cette arete perdue et retrouvee + endif + endif +c + 30 continue + end + + + subroutine tesuex( nblftr, nulftr, + % ndtri0, nbsomm, pxyd, nslign, + % mosoar, mxsoar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % nbtria, letrsu, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : supprimer du tableau noartr les triangles externes au domaine +c ----- en annulant le numero de leur 1-ere arete dans noartr +c et en les chainant comme triangles vides +c +c entrees: +c -------- +c nblftr : nombre de lignes fermees definissant la surface +c nulftr : numero des lignes fermees definissant la surface +c ndtri0 : plus grand numero dans noartr d'un triangle +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c nslign : tableau du numero de sommet dans sa ligne pour chaque +c sommet frontalier +c numero du point dans le lexique point si interne impose +c 0 si le point est interne non impose par l'utilisateur +c -1 si le sommet est externe au domaine +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles declarables +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero nosoar d'une arete de sommet i +c +c sorties: +c -------- +c nbtria : nombre de triangles internes au domaine +c letrsu : letrsu(nt)=numero du triangle interne, 0 sinon +c noarst : noarst(i) numero nosoar d'une arete du sommet i (modifi'e) +c ierr : 0 si pas d'erreur, >0 sinon +cc++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mai 1999 +c2345x7..............................................................012 + double precision pxyd(3,*) + integer nulftr(nblftr),nslign(nbsomm), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*) + integer letrsu(1:ndtri0) + double precision dmin +c +c les triangles sont a priori non marques + do 5 nt=1,ndtri0 + letrsu(nt) = 0 + 5 continue +c +c les aretes sont marquees non chainees + do 10 noar1=1,mxsoar + nosoar(6,noar1) = -2 + 10 continue +c +c recherche du sommet de la triangulation de plus petite abscisse +c =============================================================== + ntmin = 0 + dmin = 1d38 + do 20 i=1,nbsomm + if( pxyd(1,i) .lt. dmin ) then +c le nouveau minimum + noar1 = noarst(i) + if( noar1 .gt. 0 ) then +c le sommet appartient a une arete de triangle + if( nosoar(4,noar1) .gt. 0 ) then +c le nouveau minimum + dmin = pxyd(1,i) + ntmin = i + endif + endif + endif + 20 continue +c +c une arete de sommet ntmin + noar1 = noarst( ntmin ) +c un triangle d'arete noar1 + ntmin = nosoar( 4, noar1 ) + if( ntmin .le. 0 ) then +c nblgrc(nrerr) = 1 +c kerr(1) = 'pas de triangle d''abscisse minimale' +c call lereur + write(imprim,*) 'pas de triangle d''abscisse minimale' + ierr = 2 + goto 9990 + endif +c +c chainage des 3 aretes du triangle ntmin +c ======================================= +c la premiere arete du chainage des aretes traitees + noar1 = abs( noartr(1,ntmin) ) + na0 = abs( noartr(2,ntmin) ) +c elle est chainee sur la seconde arete du triangle ntmin + nosoar(6,noar1) = na0 +c les 2 autres aretes du triangle ntmin sont chainees + na1 = abs( noartr(3,ntmin) ) +c la seconde est chainee sur la troisieme arete + nosoar(6,na0) = na1 +c la troisieme n'a pas de suivante + nosoar(6,na1) = 0 +c +c le triangle ntmin est a l'exterieur du domaine +c tous les triangles externes sont marques -123 456 789 +c les triangles de l'autre cote d'une arete sur une ligne +c sont marques: no de la ligne de l'arete * signe oppose +c ======================================================= + ligne0 = 0 + ligne = -123 456 789 +c + 40 if( noar1 .ne. 0 ) then +c +c l'arete noar1 du tableau nosoar est a traiter +c --------------------------------------------- + noar = noar1 +c l'arete suivante devient la premiere a traiter ensuite + noar1 = nosoar(6,noar1) +c l'arete noar est traitee + nosoar(6,noar) = -3 +c + do 60 i=4,5 +c +c l'un des 2 triangles de l'arete + nt = nosoar(i,noar) + if( nt .gt. 0 ) then +c +c triangle deja traite pour une ligne anterieure? + if( letrsu(nt) .ne. 0 .and. + % abs(letrsu(nt)) .ne. ligne ) goto 60 +c +cccc trace du triangle nt en couleur ligne0 +ccc call mttrtr( pxyd, nt, moartr, noartr, mosoar, nosoar, +ccc % ligne0, ncnoir ) +c +c le triangle est marque avec la valeur de ligne + letrsu(nt) = ligne +c +c chainage eventuel des autres aretes de ce triangle +c si ce n'est pas encore fait + do 50 j=1,3 +c +c le numero na de l'arete j du triangle nt dans nosoar + na = abs( noartr(j,nt) ) + if( nosoar(6,na) .ne. -2 ) goto 50 +c +c le numero de 1 a nblftr dans nulftr de la ligne de l'arete + nl = nosoar(3,na) +c +c si l'arete est sur une ligne fermee differente de celle envelo +c et non marquee alors examen du triangle oppose + if( nl .gt. 0 ) then +c + if( nl .eq. ligne0 ) goto 50 +c +c arete frontaliere de ligne non traitee +c => passage de l'autre cote de la ligne +c le triangle de l'autre cote de la ligne est recherche + if( nt .eq. abs( nosoar(4,na) ) ) then + nt2 = 5 + else + nt2 = 4 + endif + nt2 = abs( nosoar(nt2,na) ) + if( nt2 .gt. 0 ) then +c +c le triangle nt2 de l'autre cote est marque avec le +c avec le signe oppose de celui de ligne + if( ligne .ge. 0 ) then + lsigne = -1 + else + lsigne = 1 + endif + letrsu(nt2) = lsigne * nl +c +c temoin de ligne a traiter ensuite dans nulftr + nulftr(nl) = -abs( nulftr(nl) ) +c +cccc trace du triangle nt2 en jaune borde de magenta +ccc call mttrtr( pxyd,nt2, +ccc % moartr,noartr,mosoar,nosoar, +ccc % ncjaun, ncmage ) +c +c l'arete est traitee + nosoar(6,na) = -3 +c + endif +c +c l'arete est traitee + goto 50 +c + endif +c +c arete non traitee => elle est chainee + nosoar(6,na) = noar1 + noar1 = na +c + 50 continue +c + endif + 60 continue +c + goto 40 + endif +c les triangles de la ligne fermee ont tous ete marques +c plus d'arete chainee +c +c recherche d'une nouvelle ligne fermee a traiter +c =============================================== + 65 do 70 nl=1,nblftr + if( nulftr(nl) .lt. 0 ) goto 80 + 70 continue +c plus de ligne fermee a traiter + goto 110 +c +c tous les triangles de cette composante connexe +c entre ligne et ligne0 vont etre marques +c ============================================== +c remise en etat du numero de ligne +c nl est le numero de la ligne dans nulftr a traiter + 80 nulftr(nl) = -nulftr(nl) + do 90 nt2=1,ndtri0 + if( abs(letrsu(nt2)) .eq. nl ) goto 92 + 90 continue +c +c recherche de l'arete j du triangle nt2 avec ce numero de ligne nl + 92 do 95 j=1,3 +c +c le numero de l'arete j du triangle dans nosoar + noar1 = 0 + na0 = abs( noartr(j,nt2) ) + if( nl .eq. nosoar(3,na0) ) then +c +c na0 est l'arete de ligne nl +c l'arete suivante du triangle nt2 + i = mod(j,3) + 1 +c le numero dans nosoar de l'arete i de nt2 + na1 = abs( noartr(i,nt2) ) + if( nosoar(6,na1) .eq. -2 ) then +c arete non traitee => elle est la premiere du chainage + noar1 = na1 +c pas de suivante dans ce chainage + nosoar(6,na1) = 0 + else + na1 = 0 + endif +c +c l'eventuelle seconde arete suivante + i = mod(i,3) + 1 + na = abs( noartr(i,nt2) ) + if( nosoar(6,na) .eq. -2 ) then + if( na1 .eq. 0 ) then +c 1 arete non traitee et seule a chainer + noar1 = na + nosoar(6,na) = 0 + else +c 2 aretes a chainer + noar1 = na + nosoar(6,na) = na1 + endif + endif +c + if( noar1 .gt. 0 ) then +c +c il existe au moins une arete a visiter pour ligne +c marquage des triangles internes a la ligne nl + ligne = letrsu(nt2) + ligne0 = nl + goto 40 +c + else +c +c nt2 est le seul triangle de la ligne fermee + goto 65 +c + endif + endif + 95 continue +c +c reperage des sommets internes ou externes dans nslign +c nslign(sommet externe au domaine)=-1 +c nslign(sommet interne au domaine)= 0 +c ===================================================== + 110 do 170 ns1=1,nbsomm +c tout sommet non sur la frontiere ou interne impose +c est suppose externe + if( nslign(ns1) .eq. 0 ) nslign(ns1) = -1 + 170 continue +c +c les triangles externes sont marques vides dans le tableau noartr +c ================================================================ + nbtria = 0 + do 200 nt=1,ndtri0 +c + if( letrsu(nt) .le. 0 ) then +c +c triangle nt externe + if( noartr(1,nt) .ne. 0 ) then +c la premiere arete est annulee + noartr(1,nt) = 0 +c le triangle nt est considere comme etant vide + noartr(2,nt) = n1artr + n1artr = nt + endif +c + else +c +c triangle nt interne + nbtria = nbtria + 1 + letrsu(nt) = nbtria +c +c marquage des 3 sommets du triangle nt + do 190 i=1,3 +c le numero nosoar de l'arete i du triangle nt + noar = abs( noartr(i,nt) ) +c le numero des 2 sommets + ns1 = nosoar(1,noar) + ns2 = nosoar(2,noar) +c mise a jour du numero d'une arete des 2 sommets de l'arete + noarst( ns1 ) = noar + noarst( ns2 ) = noar +c ns1 et ns2 sont des sommets de la triangulation du domaine + if( nslign(ns1) .lt. 0 ) nslign(ns1)=0 + if( nslign(ns2) .lt. 0 ) nslign(ns2)=0 + 190 continue +c + endif +c + 200 continue +c ici tout sommet externe ns verifie nslign(ns)=-1 +c +c les triangles externes sont mis a zero dans nosoar +c ================================================== + do 300 noar=1,mxsoar +c + if( nosoar(1,noar) .gt. 0 ) then +c +c le second triangle de l'arete noar + nt = nosoar(5,noar) + if( nt .gt. 0 ) then +c si le triangle nt est externe +c alors il est supprime pour l'arete noar + if( letrsu(nt) .le. 0 ) nosoar(5,noar)=0 + endif +c +c le premier triangle de l'arete noar + nt = nosoar(4,noar) + if( nt .gt. 0 ) then + if( letrsu(nt) .le. 0 ) then +c si le triangle nt est externe +c alors il est supprime pour l'arete noar +c et l'eventuel triangle oppose prend sa place +c en position 4 de nosoar + if( nosoar(5,noar) .gt. 0 ) then + nosoar(4,noar)=nosoar(5,noar) + nosoar(5,noar)=0 + else + nosoar(4,noar)=0 + endif + endif + endif + endif +c + 300 continue +c +c remise en etat pour eviter les modifications de ladefi + 9990 do 9991 nl=1,nblftr + if( nulftr(nl) .lt. 0 ) nulftr(nl)=-nulftr(nl) + 9991 continue + return + end + + + + subroutine trp1st( ns, noarst, mosoar, nosoar, moartr, noartr, + % mxpile, lhpile, lapile ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : recherche des triangles de noartr partageant le sommet ns +c ----- +c limite: un camembert de centre ns entame 2 fois +c ne donne que l'une des parties +c +c entrees: +c -------- +c ns : numero du sommet +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c mxpile : nombre maximal de triangles empilables +c +c sorties : +c -------- +c lhpile : >0 nombre de triangles empiles +c =0 si impossible de tourner autour du point +c =-lhpile si apres butee sur la frontiere il y a a nouveau +c butee sur la frontiere . a ce stade on ne peut dire si tous +c les triangles ayant ce sommet ont ete recenses +c ce cas arrive seulement si le sommet est sur la frontiere +c lapile : numero dans noartr des triangles de sommet ns +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + integer noartr(moartr,*), + % nosoar(mosoar,*), + % noarst(*) + integer lapile(1:mxpile) + integer nosotr(3) +c +c la premiere arete de sommet ns + nar = noarst( ns ) + if( nar .le. 0 ) then + write(imprim,*) 'trp1st: sommet',ns,' sans arete' + goto 9999 + endif +c +c l'arete nar est elle active? + if( nosoar(1,nar) .le. 0 ) then +ccc write(imprim,*) 'trp1st: arete vide',nar, +ccc % ' st1:', nosoar(1,nar),' st2:',nosoar(2,nar) + goto 9999 + endif +c +c le premier triangle de sommet ns + nt0 = abs( nosoar(4,nar) ) + if( nt0 .le. 0 ) then + write(imprim,*) 'trp1st: sommet',ns,' dans aucun triangle' + goto 9999 + endif +c +c le triangle est il interne? + if( noartr(1,nt0) .eq. 0 ) goto 9999 +c +c le numero des 3 sommets du triangle nt0 dans le sens direct + call nusotr( nt0, mosoar, nosoar, moartr, noartr, nosotr ) +c +c reperage du sommet ns dans le triangle nt0 + do 5 nar=1,3 + if( nosotr(nar) .eq. ns ) goto 10 + 5 continue + nta = nt0 + goto 9995 +c +c ns retrouve : le triangle nt0 est empile + 10 lhpile = 1 + lapile(1) = nt0 + nta = nt0 +c +c recherche dans le sens des aiguilles d'une montre +c (sens indirect) du triangle nt1 de l'autre cote de l'arete +c nar du triangle et en tournant autour du sommet ns +c ========================================================== + noar = abs( noartr(nar,nt0) ) +c le triangle nt1 oppose du triangle nt0 par l'arete noar + if( nosoar(4,noar) .eq. nt0 ) then + nt1 = nosoar(5,noar) + else + nt1 = nosoar(4,noar) + endif +c +c la boucle sur les triangles nt1 de sommet ns dans le sens indirect +c ================================================================== + if( nt1 .gt. 0 ) then +c + if( noartr(1,nt1) .eq. 0 ) goto 30 +c +c le triangle nt1 n'a pas ete detruit. il est actif +c le triangle oppose par l'arete noar existe +c le numero des 3 sommets du triangle nt1 dans le sens direct + 15 call nusotr( nt1, mosoar, nosoar, moartr, noartr, nosotr ) +c +c reperage du sommet ns dans nt1 + do 20 nar=1,3 + if( nosotr(nar) .eq. ns ) goto 25 + 20 continue + nta = nt1 + goto 9995 +c +c nt1 est empile + 25 if( lhpile .ge. mxpile ) goto 9990 + lhpile = lhpile + 1 + lapile(lhpile) = nt1 +c +c le triangle nt1 de l'autre cote de l'arete de sommet ns +c sauvegarde du precedent triangle dans nta + nta = nt1 + noar = abs( noartr(nar,nt1) ) + if( nosoar(4,noar) .eq. nt1 ) then + nt1 = nosoar(5,noar) + else + nt1 = nosoar(4,noar) + endif + if( nt1 .le. 0 ) goto 30 +c le triangle suivant est a l'exterieur + if( nt1 .ne. nt0 ) goto 15 +c +c recherche terminee par arrivee sur nt0 +c les triangles forment un "cercle" de "centre" ns + return +c + endif +c +c pas de triangle voisin a nt1 +c ============================ +c le parcours passe par 1 des triangles exterieurs +c le parcours est inverse par l'arete de gauche +c le triangle nta est le premier triangle empile + 30 lhpile = 1 + lapile(lhpile) = nta +c +c le numero des 3 sommets du triangle nta dans le sens direct + call nusotr( nta, mosoar, nosoar, moartr, noartr, nosotr ) + do 32 nar=1,3 + if( nosotr(nar) .eq. ns ) goto 33 + 32 continue + goto 9995 +c +c l'arete qui precede (rotation / ns dans le sens direct) + 33 if( nar .eq. 1 ) then + nar = 3 + else + nar = nar - 1 + endif +c +c le triangle voisin de nta dans le sens direct + noar = abs( noartr(nar,nta) ) + if( nosoar(4,noar) .eq. nta ) then + nt1 = nosoar(5,noar) + else + nt1 = nosoar(4,noar) + endif + if( nt1 .le. 0 ) then +c un seul triangle contient ns + goto 70 + endif +c +c boucle sur les triangles de sommet ns dans le sens direct +c ========================================================== + 40 if( noartr(1,nt1) .eq. 0 ) goto 70 +c +c le triangle nt1 n'a pas ete detruit. il est actif +c le numero des 3 sommets du triangle nt1 dans le sens direct + call nusotr( nt1, mosoar, nosoar, moartr, noartr, nosotr ) +c +c reperage du sommet ns dans nt1 + do 50 nar=1,3 + if( nosotr(nar) .eq. ns ) goto 60 + 50 continue + nta = nt1 + goto 9995 +c +c nt1 est empile + 60 if( lhpile .ge. mxpile ) goto 9990 + lhpile = lhpile + 1 + lapile(lhpile) = nt1 +c +c l'arete qui precede dans le sens direct + if( nar .eq. 1 ) then + nar = 3 + else + nar = nar - 1 + endif +c +c l'arete de sommet ns dans nosoar + noar = abs( noartr(nar,nt1) ) +c +c le triangle voisin de nta dans le sens direct + nta = nt1 + if( nosoar(4,noar) .eq. nt1 ) then + nt1 = nosoar(5,noar) + else + nt1 = nosoar(4,noar) + endif + nta = nt1 + if( nt1 .gt. 0 ) goto 40 +c +c butee sur le trou => fin des triangles de sommet ns +c ---------------------------------------------------- + 70 lhpile = -lhpile +c impossible ici de trouver les autres triangles de sommet ns +c les triangles de sommet ns ne forment pas une boule de centre ns + return +c +c saturation de la pile des triangles +c ----------------------------------- + 9990 write(imprim,*) 'trp1st:saturation pile des triangles autour ', + %'sommet',ns + goto 9999 +c +c erreur triangle ne contenant pas le sommet ns +c ---------------------------------------------- + 9995 write(imprim,*) 'trp1st:triangle ',nta,' st=', + % (nosotr(nar),nar=1,3),' sans le sommet' ,ns +c + 9999 lhpile = 0 + return + end + + + + subroutine nusotr( nt, mosoar, nosoar, moartr, noartr, nosotr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul du numero des 3 sommets du triangle nt de noartr +c ----- dans le sens direct (aire>0 si non degenere) +c +c entrees: +c -------- +c nt : numero du triangle dans le tableau noartr +c mosoar : nombre maximal d'entiers par arete +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c moartr : nombre maximal d'entiers par arete du tableau noartr +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1=0 si triangle vide => arete2=triangle vide suivant +c +c sorties: +c -------- +c nosotr : numero (dans le tableau pxyd) des 3 sommets du triangle +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + integer nosoar(mosoar,*), noartr(moartr,*), nosotr(3) +c +c les 2 sommets de l'arete 1 du triangle nt dans le sens direct + na = noartr( 1, nt ) + if( na .gt. 0 ) then + nosotr(1) = 1 + nosotr(2) = 2 + else + nosotr(1) = 2 + nosotr(2) = 1 + na = -na + endif + nosotr(1) = nosoar( nosotr(1), na ) + nosotr(2) = nosoar( nosotr(2), na ) +c +c l'arete suivante + na = abs( noartr(2,nt) ) +c +c le sommet nosotr(3 du triangle 123 + nosotr(3) = nosoar( 1, na ) + if( nosotr(3) .eq. nosotr(1) .or. nosotr(3) .eq. nosotr(2) ) then + nosotr(3) = nosoar(2,na) + endif + end + + + subroutine tesusp( nbarpi, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, notrcf, liarcf, + % nbstsu, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : supprimer de la triangulation les sommets de te trop proches +c ----- soit d'un sommet frontalier ou point interne impose +c soit d'une arete frontaliere +c +c attention: le chainage lchain de nosoar devient celui des cf +c +c entrees: +c -------- +c nbarpi : numero du dernier point interne impose par l'utilisateur +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxarcf : nombre de variables des tableaux n1arcf, noarcf, larmin, notrcf +c +c modifies: +c --------- +c noarst : noarst(i) numero d'une arete de sommet i +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c +c auxiliaires : +c ------------- +c n1arcf : tableau (0:mxarcf) auxiliaire d'entiers +c noarcf : tableau (3,mxarcf) auxiliaire d'entiers +c larmin : tableau ( mxarcf ) auxiliaire d'entiers +c notrcf : tableau ( mxarcf ) auxiliaire d'entiers +c liarcf : tableau ( mxarcf ) auxiliaire d'entiers +c +c sortie : +c -------- +c nbstsu : nombre de sommets de te supprimes +c ierr : =0 si pas d'erreur +c >0 si une erreur est survenue +c 11 algorithme defaillant +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 +c parameter ( quamal=0.3 ) => ok +c parameter ( quamal=0.4 ) => pb pour le test ocean +c parameter ( quamal=0.5 ) => pb pour le test ocean +c + parameter ( quamal=0.333, lchain=6 ) + common / unites / lecteu,imprim,intera,nunite(29) + double precision pxyd(3,*), qualit + integer nosoar(mosoar,mxsoar), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf), + % notrcf(mxarcf), + % liarcf(mxarcf) +c + integer nosotr(3) + equivalence (nosotr(1),ns1), (nosotr(2),ns2), + % (nosotr(3),ns3) +c +c le nombre de sommets de te supprimes + nbstsu = 0 +c +c initialisation du chainage des aretes des cf => 0 arete de cf + do 10 narete=1,mxsoar + nosoar( lchain, narete ) = -1 + 10 continue +c +c boucle sur l'ensemble des sommets frontaliers ou points internes +c ================================================================ + do 100 ns = 1, nbarpi +c +cccc le nombre de sommets supprimes pour ce sommet ns +ccc nbsuns = 0 +c +c la qualite minimale au dessous de laquelle le point proche +c interne est supprime + quaopt = quamal +c +c une arete de sommet ns + 15 narete = noarst( ns ) + if( narete .le. 0 ) then +c erreur: le point appartient a aucune arete + write(imprim,*) 'sommet ',ns,' dans aucune arete' + pause + ierr = 11 + return + endif +c +c recherche des triangles de sommet ns +c ils doivent former un contour ferme de type etoile + call trp1st( ns, noarst, mosoar, nosoar, moartr, noartr, + % mxarcf, nbtrcf, notrcf ) + if( nbtrcf .le. 0 ) then +c erreur: impossible de trouver tous les triangles de sommet ns +c seule une partie est a priori retrouvee + nbtrcf = -nbtrcf + endif +c +c boucle sur les triangles de l'etoile du sommet ns + quamin = 2.0 + do 20 i=1,nbtrcf +c +c le numero des 3 sommets du triangle nt + nt = notrcf(i) + call nusotr( nt, mosoar, nosoar, moartr, noartr, + % nosotr ) +c nosotr(1:3) est en equivalence avec ns1, ns2, ns3 +c +c la qualite du triangle ns1 ns2 ns3 + call qutr2d( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3), qualit ) + if( qualit .lt. quamin ) then + quamin = qualit + ntqmin = nt + endif + 20 continue +c +c bilan sur la qualite des triangles de sommet ns + if( quamin .lt. quaopt ) then +c +c recherche du sommet de ntqmin le plus proche et non frontalier +c ============================================================== +c le numero des 3 sommets du triangle nt + call nusotr( ntqmin, mosoar, nosoar, moartr, noartr, + % nosotr ) + nste = 0 + quamin = 1e28 + do 30 j=1,3 + if( nosotr(j) .ne. ns .and. nosotr(j) .gt. nbarpi ) then + d = (pxyd(1,nosotr(j))-pxyd(1,ns))**2 + % + (pxyd(2,nosotr(j))-pxyd(2,ns))**2 + if( d .lt. quamin ) then + quamin = d + nste = j + endif + endif + 30 continue +c + if( nste .gt. 0 ) then +c +c nste est le sommet le plus proche de ns de ce +c triangle de mauvaise qualite et sommet non encore traite + nste = nosotr( nste ) +c +c nste est un sommet de triangle equilateral +c => le sommet nste va etre supprime +c ========================================== + call te1stm( nste, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, + % larmin, notrcf, liarcf, ierr ) + if( ierr .eq. 0 ) then +c un sommet de te supprime de plus + nbstsu = nbstsu + 1 + else if( ierr .lt. 0 ) then +c le sommet nste est externe donc non supprime +c ou bien le sommet nste est le centre d'un cf dont toutes +c les aretes simples sont frontalieres +c dans les 2 cas le sommet n'est pas supprime + ierr = 0 + goto 100 + else +c erreur motivant un arret de la triangulation + return + endif +c +c boucle jusqu'a obtenir une qualite suffisante +c si triangulation tres irreguliere => +c destruction de beaucoup de points internes +c les 2 variables suivantes brident ces destructions massives +ccc nbsuns = nbsuns + 1 + quaopt = quaopt * 0.8 +ccc if( nbsuns .le. 5 ) goto 15 + goto 15 + endif + endif +c + 100 continue + end + + + subroutine teamqa( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxtrcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but: si la taille de l'arete moyenne est >ampli*taille souhaitee +c ---- alors ajout d'un sommet barycentre du plus grand triangle +c de sommet ns +c si la taille de l'arete moyenne est aretmx active +c 1 il existe une fonction areteideale() +c dont seules les 2 premieres composantes de uv sont actives +c autres options a definir... +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes frontalieres declarables +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles declarables dans noartr +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c mxtrcf : nombre maximal de triangles empilables +c nbarpi : numero du dernier sommet frontalier ou interne impose +c nslign : tableau du numero de sommet dans sa ligne pour chaque +c sommet frontalier +c numero du point dans le lexique point si interne impose +c 0 si le point est interne non impose par l'utilisateur +c -1 si le sommet est externe au domaine +c comxmi : min et max des coordonneees des sommets du maillage +c +c modifies : +c ---------- +c nbsomm : nombre actuel de sommets de la triangulation +c (certains sommets internes ont ete desactives ou ajoutes) +c pxyd : tableau des coordonnees 2d des points +c +c auxiliaires: +c ------------ +c notrcf : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans noartr des triangles de sommet ns +c nostbo : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans pxyd des sommets des aretes simples de la boule +c n1arcf : tableau (0:mxtrcf) auxiliaire d'entiers +c noarcf : tableau (3,mxtrcf) auxiliaire d'entiers +c larmin : tableau ( mxtrcf ) auxiliaire d'entiers +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juin 1997 +c....................................................................012 + double precision ampli,ampli2 + parameter (ampli=1.34d0,ampli2=ampli/2d0) + parameter (lchain=6) + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + double precision ponder, ponde1, xbar, ybar, x, y, surtd2 + double precision d, dmoy + double precision d2d3(3,3) + real origin(3), xyz(3) + integer noartr(moartr,*), + % nosoar(mosoar,*), + % noarst(*), + % notrcf(mxtrcf), + % nslign(*), + % nostbo(*), + % n1arcf(0:mxtrcf), + % noarcf(3,mxtrcf), + % larmin(mxtrcf) + double precision comxmi(3,2) + integer nosotr(3) +c +c le nombre d'iterations pour ameliorer la qualite + nbitaq = 4 + ier = 0 +c +c initialisation du parcours + nbs1 = nbsomm + nbs2 = nbarpi + 1 + nbs3 = -1 +c + do 5000 iter=1,nbitaq +c +c le nombre de sommets supprimes + nbstsu = 0 + nbbaaj = 0 +c +c coefficient de ponderation croissant avec les iterations + ponder = min( 1d0, ( 50 + (50*iter)/nbitaq ) * 0.01d0 ) + ponde1 = 1d0 - ponder +c +c l'ordre du parcours dans le sens croissant ou decroissant + nt = nbs1 + nbs1 = nbs2 + nbs2 = nt +c alternance du parcours + nbs3 = -nbs3 +c + do 1000 ns = nbs1, nbs2, nbs3 +c +c le sommet est il interne au domaine? + if( nslign(ns) .ne. 0 ) goto 1000 +c +c existe-t-il une arete de sommet ns ? + 10 noar = noarst( ns ) + if( noar .le. 0 ) goto 1000 +c +c le 1-er triangle de l'arete noar + nt = nosoar( 4, noar ) + if( nt .le. 0 ) goto 1000 +c +c recherche des triangles de sommet ns +c ils doivent former un contour ferme de type etoile + call trp1st( ns, noarst, mosoar, nosoar, moartr, noartr, + % mxtrcf, nbtrcf, notrcf ) + if( nbtrcf .le. 0 ) goto 1000 +c +c mise a jour de la distance souhaitee + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,ns) dans le repere initial => xyz(1:3) + call tetaid( nutysu, pxyd(1,ns), pxyd(2,ns), + % pxyd(3,ns), ier ) + endif +c +c boucle sur les triangles qui forment une boule autour du sommet ns + nbstbo = 0 +c chainage des aretes simples de la boule a rendre delaunay + noar0 = 0 + do 40 i=1,nbtrcf +c +c le numero de l'arete du triangle nt ne contenant pas le sommet ns + nt = notrcf(i) + do 20 na=1,3 +c le numero de l'arete na dans le tableau nosoar + noar = abs( noartr(na,nt) ) + if( nosoar(1,noar) .ne. ns .and. + % nosoar(2,noar) .ne. ns ) goto 25 + 20 continue +c +c construction de la liste des sommets des aretes simples +c de la boule des triangles de sommet ns +c ------------------------------------------------------- + 25 do 35 na=1,2 + ns1 = nosoar(na,noar) + do 30 j=nbstbo,1,-1 + if( ns1 .eq. nostbo(j) ) goto 35 + 30 continue +c ns1 est un nouveau sommet a ajouter + nbstbo = nbstbo + 1 + nostbo(nbstbo) = ns1 + 35 continue +c +c noar est une arete potentielle a rendre delaunay + if( nosoar(3,noar) .eq. 0 ) then +c arete non frontaliere + nosoar(lchain,noar) = noar0 + noar0 = noar + endif +c + 40 continue +c +c calcul des 2 coordonnees du barycentre de la boule du sommet ns +c calcul de la longueur moyenne des aretes issues du sommet ns +c --------------------------------------------------------------- + xbar = 0d0 + ybar = 0d0 + dmoy = 0d0 + do 50 i=1,nbstbo + x = pxyd(1,nostbo(i)) + y = pxyd(2,nostbo(i)) + xbar = xbar + x + ybar = ybar + y + dmoy = dmoy + sqrt( (x-pxyd(1,ns))**2+(y-pxyd(2,ns))**2 ) + 50 continue + dmoy = dmoy / nbstbo +c +c pas de modification de la topologie lors de la derniere iteration +c ================================================================= + if( iter .eq. nbitaq ) goto 200 +c +c si la taille de l'arete moyenne est >ampli*taille souhaitee +c alors ajout d'un sommet barycentre du plus grand triangle +c de sommet ns +c =========================================================== + if( dmoy .gt. ampli*pxyd(3,ns) ) then +c + dmoy = 0d0 + do 150 i=1,nbtrcf +c recherche du plus grand triangle en surface + call nusotr( notrcf(i), mosoar, nosoar, + % moartr, noartr, nosotr ) + d = surtd2( pxyd(1,nosotr(1)), + % pxyd(1,nosotr(2)), + % pxyd(1,nosotr(3)) ) + if( d .gt. dmoy ) then + dmoy = d + imax = i + endif + 150 continue +c +c ajout du barycentre du triangle notrcf(imax) + nt = notrcf( imax ) + call nusotr( nt, mosoar, nosoar, + % moartr, noartr, nosotr ) + if( nbsomm .ge. mxsomm ) then + write(imprim,*) 'saturation du tableau pxyd' +c abandon de l'amelioration du sommet ns + goto 9999 + endif + nbsomm = nbsomm + 1 + do 160 i=1,3 + pxyd(i,nbsomm) = ( pxyd(i,nosotr(1)) + % + pxyd(i,nosotr(2)) + % + pxyd(i,nosotr(3)) ) / 3d0 + 160 continue +c + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,nbsomm) dans le repere initial => xyz(1:3) + call tetaid( nutysu, pxyd(1,nbsomm), pxyd(2,nbsomm), + % pxyd(3,nbsomm), ier ) + endif +c +c sommet interne a la triangulation + nslign(nbsomm) = 0 +c +c les 3 aretes du triangle nt sont a rendre delaunay + do 170 i=1,3 + noar = abs( noartr(i,nt) ) + if( nosoar(3,noar) .eq. 0 ) then +c arete non frontaliere + if( nosoar(lchain,noar) .lt. 0 ) then +c arete non encore chainee + nosoar(lchain,noar) = noar0 + noar0 = noar + endif + endif + 170 continue +c +c triangulation du triangle de barycentre nbsomm +c protection a ne pas modifier sinon erreur! + call tr3str( nbsomm, nt, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nosotr, ierr ) + if( ierr .ne. 0 ) goto 9999 +c +c un barycentre ajoute de plus + nbbaaj = nbbaaj + 1 +c +c les aretes chainees de la boule sont rendues delaunay + goto 900 +c + endif +c +c si la taille de l'arete moyenne est xyz(1:3) + call tetaid( nutysu, pxyd(1,ns), pxyd(2,ns), + % pxyd(3,ns), ier ) + endif +c +c les aretes chainees de la boule sont rendues delaunay + 900 call tedela( pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, noar0, + % moartr, mxartr, n1artr, noartr, modifs ) +c + 1000 continue +c +ccc write(imprim,11000) nbstsu, nbbaaj +ccc11000 format( i6,' sommets supprimes ' , +ccc % i6,' barycentres ajoutes' ) +c +c mise a jour pour ne pas oublier les nouveaux sommets + if( nbs1 .gt. nbs2 ) then + nbs1 = nbsomm + else + nbs2 = nbsomm + endif +c + 5000 continue +c + 9999 return + end + + + subroutine teamsf( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxtrcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : modification de la topologie des triangles autour des +c ----- sommets frontaliers et mise en triangulation delaunay locale +c +c entrees: +c -------- +c nutysu : numero de traitement de areteideale() selon le type de surface +c 0 pas d'emploi de la fonction areteideale() => aretmx active +c 1 il existe une fonction areteideale() +c dont seules les 2 premieres composantes de uv sont actives +c autres options a definir... +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes frontalieres declarables +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles declarables dans noartr +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c mxtrcf : nombre maximal de triangles empilables +c nbarpi : numero du dernier sommet frontalier ou interne impose +c nslign : >0 => ns numero du point dans le lexique point si interne impose +c ou => 1 000 000 * n + ns1 +c ou n est le numero (1 a nblftr) de la ligne de ce point +c ns1 est le numero du point dans sa ligne +c = 0 si le point est interne non impose par l'utilisateur +c =-1 si le sommet est externe au domaine +c comxmi : min et max des coordonneees des sommets du maillage +c +c modifies : +c ---------- +c nbsomm : nombre actuel de sommets de la triangulation +c (certains sommets internes ont ete desactives ou ajoutes) +c pxyd : tableau des coordonnees 2d des points +c +c auxiliaires: +c ------------ +c notrcf : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans noartr des triangles de sommet ns +c nostbo : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans pxyd des sommets des aretes simples de la boule +c n1arcf : tableau (0:mxtrcf) auxiliaire d'entiers +c noarcf : tableau (3,mxtrcf) auxiliaire d'entiers +c larmin : tableau ( mxtrcf ) auxiliaire d'entiers +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc janvier 1998 +c....................................................................012 + parameter (lchain=6) + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + double precision a, angle, angled, pi, deuxpi, pis3 + double precision d2d3(3,3) + real origin(3), xyz(3) + integer noartr(moartr,*), + % nosoar(mosoar,*), + % noarst(*), + % notrcf(mxtrcf), + % nslign(*), + % nostbo(*), + % n1arcf(0:mxtrcf), + % noarcf(3,mxtrcf), + % larmin(mxtrcf), + % nosotr(3) + double precision comxmi(3,2) +c +c le nombre d'iterations pour ameliorer la qualite + nbitaq = 2 + ier = 0 +c +c pi / 3 + pi = atan(1d0) * 4d0 + pis3 = pi / 3d0 + deuxpi = 2d0 * pi +c +c initialisation du parcours + modifs = 0 + nbs1 = nbarpi + nbs2 = 1 +c => pas de traitement sur les points des lignes de la frontiere + nbs3 = -1 +c + do 5000 iter=1,nbitaq +c +c le nombre de sommets supprimes + nbstsu = 0 +c +c l'ordre du parcours dans le sens croissant ou decroissant + nt = nbs1 + nbs1 = nbs2 + nbs2 = nt +c alternance du parcours + nbs3 = -nbs3 +c + do 1000 ns = nbs1, nbs2, nbs3 +c +c le sommet est il sur une ligne de la frontiere? +c if( nslign(ns) .lt. 1 000 000 ) goto 1000 +c +c traitement d'un sommet d'une ligne de la frontiere +c ================================================== +c existe-t-il une arete de sommet ns ? + noar = noarst( ns ) + if( noar .le. 0 ) goto 1000 +c +c le 1-er triangle de l'arete noar + nt = nosoar( 4, noar ) + if( nt .le. 0 ) goto 1000 +c +c recherche des triangles de sommet ns +c ils doivent former un contour ferme de type camembert + call trp1st( ns, noarst, mosoar, nosoar, moartr, noartr, + % mxtrcf, nbtrcf, notrcf ) + if( nbtrcf .ge. -1 ) goto 1000 +c +c boucle sur les triangles qui forment un camembert autour du sommet n + nbtrcf = -nbtrcf +c +c angle interne au camembert autour du sommet ns + angle = 0d0 + do 540 i=1,nbtrcf +c +c le numero de l'arete du triangle nt ne contenant pas le sommet ns + nt = notrcf(i) + do 520 na=1,3 +c le numero de l'arete na dans le tableau nosoar + noar = abs( noartr(na,nt) ) + if( nosoar(1,noar) .ne. ns .and. + % nosoar(2,noar) .ne. ns ) goto 525 + 520 continue +c +c calcul de l'angle (ns-st1 arete, ns-st2 arete) + 525 ns1 = nosoar(1,noar) + ns2 = nosoar(2,noar) + a = angled( pxyd(1,ns), pxyd(1,ns1), pxyd(1,ns2) ) + if( a .gt. pi ) a = deuxpi - a + angle = angle + a +c + 540 continue +c +c nombre ideal de triangles autour du sommet ns + n = nint( angle / pis3 ) + if( n .le. 1 ) goto 1000 + i = 1 + if( nbtrcf .gt. n ) then +c +c ajout du barycentre du triangle "milieu" + nt = notrcf( (n+1)/2 ) + call nusotr( nt, mosoar, nosoar, + % moartr, noartr, nosotr ) + if( nbsomm .ge. mxsomm ) then + write(imprim,*) 'saturation du tableau pxyd' +c abandon de l'amelioration du sommet ns + goto 1000 + endif + nbsomm = nbsomm + 1 + do 560 i=1,3 + pxyd(i,nbsomm) = ( pxyd(i,nosotr(1)) + % + pxyd(i,nosotr(2)) + % + pxyd(i,nosotr(3)) ) / 3d0 + 560 continue +c + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,nbsomm) dans le repere initial => xyz(1:3) + call tetaid( nutysu, pxyd(1,nbsomm), pxyd(2,nbsomm), + % pxyd(3,nbsomm), ier ) + endif +c +c sommet interne a la triangulation + nslign(nbsomm) = 0 +c +c les 3 aretes du triangle nt sont a rendre delaunay + noar0 = 0 + do 570 i=1,3 + noar = abs( noartr(i,nt) ) + if( nosoar(3,noar) .eq. 0 ) then +c arete non frontaliere + if( nosoar(lchain,noar) .lt. 0 ) then +c arete non encore chainee + nosoar(lchain,noar) = noar0 + noar0 = noar + endif + endif + 570 continue +c +c triangulation du triangle de barycentre nbsomm +c protection a ne pas modifier sinon erreur! + call tr3str( nbsomm, nt, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nosotr, ierr ) + if( ierr .ne. 0 ) goto 9999 +c +c les aretes chainees de la boule sont rendues delaunay + call tedela( pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, noar0, + % moartr, mxartr, n1artr, noartr, modifs ) + endif +c + 1000 continue +c + 5000 continue +c + 9999 return + end + + + subroutine teamqs( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxtrcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : une iteration de barycentrage des points internes +c ----- modification de la topologie pour avoir 4 ou 5 ou 6 triangles +c pour chaque sommet de la triangulation +c mise en triangulation delaunay +c +c entrees: +c -------- +c nutysu : numero de traitement de areteideale() selon le type de surface +c 0 pas d'emploi de la fonction areteideale() => aretmx active +c 1 il existe une fonction areteideale() +c dont seules les 2 premieres composantes de uv sont actives +c autres options a definir... +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes frontalieres declarables +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles declarables dans noartr +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c mxtrcf : nombre maximal de triangles empilables +c nbarpi : numero du dernier sommet frontalier ou interne impose +c nslign : >0 => ns numero du point dans le lexique point si interne impose +c ou => 1 000 000 * n + ns1 +c ou n est le numero (1 a nblftr) de la ligne de ce point +c ns1 est le numero du point dans sa ligne +c = 0 si le point est interne non impose par l'utilisateur +c =-1 si le sommet est externe au domaine +c comxmi : min et max des coordonneees des sommets du maillage +c +c modifies : +c ---------- +c nbsomm : nombre actuel de sommets de la triangulation +c (certains sommets internes ont ete desactives ou ajoutes) +c pxyd : tableau des coordonnees 2d des points +c +c auxiliaires: +c ------------ +c notrcf : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans noartr des triangles de sommet ns +c nostbo : tableau ( mxtrcf ) auxiliaire d'entiers +c numero dans pxyd des sommets des aretes simples de la boule +c n1arcf : tableau (0:mxtrcf) auxiliaire d'entiers +c noarcf : tableau (3,mxtrcf) auxiliaire d'entiers +c larmin : tableau ( mxtrcf ) auxiliaire d'entiers +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mai 1997 +c....................................................................012 + parameter (lchain=6) + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + double precision ponder, ponde1, xbar, ybar, x, y, d, dmin, dmax + double precision d2d3(3,3) + real origin(3), xyz(3) + integer noartr(moartr,*), + % nosoar(mosoar,*), + % noarst(*), + % notrcf(mxtrcf), + % nslign(*), + % nostbo(*), + % n1arcf(0:mxtrcf), + % noarcf(3,mxtrcf), + % larmin(mxtrcf) + integer nosotr(3,2) + double precision comxmi(3,2) +c +c le nombre d'iterations pour ameliorer la qualite + nbitaq = 6 + ier = 0 +c +c initialisation du parcours + nbs1 = nbsomm + nbs2 = nbarpi + 1 +c => pas de traitement sur les points des lignes de la frontiere + nbs3 = -1 +c + do 5000 iter=1,nbitaq +c +c le nombre de sommets supprimes + nbstsu = 0 +c +c les compteurs de passage sur les differents cas + nbst4 = 0 + nbst5 = 0 + nbst8 = 0 +c +c coefficient de ponderation croissant avec les iterations + ponder = min( 1d0, ( 50 + (50*iter)/nbitaq ) * 0.01d0 ) + ponde1 = 1d0 - ponder +c +c l'ordre du parcours dans le sens croissant ou decroissant + nt = nbs1 + nbs1 = nbs2 + nbs2 = nt +c alternance du parcours + nbs3 = -nbs3 +c + do 1000 ns = nbs1, nbs2, nbs3 +c +c le sommet est il interne au domaine? + if( nslign(ns) .ne. 0 ) goto 1000 +c +c traitement d'un sommet interne non impose par l'utilisateur +c =========================================================== +c existe-t-il une arete de sommet ns ? + 10 noar = noarst( ns ) + if( noar .le. 0 ) goto 1000 +c +c le 1-er triangle de l'arete noar + nt = nosoar( 4, noar ) + if( nt .le. 0 ) goto 1000 +c +c recherche des triangles de sommet ns +c ils doivent former un contour ferme de type etoile + call trp1st( ns, noarst, mosoar, nosoar, moartr, noartr, + % mxtrcf, nbtrcf, notrcf ) + if( nbtrcf .le. 0 ) goto 1000 +c +c boucle sur les triangles qui forment une boule autour du sommet ns + nbstbo = 0 +c chainage des aretes simples de la boule a rendre delaunay + noar0 = 0 + do 40 i=1,nbtrcf +c +c le numero de l'arete du triangle nt ne contenant pas le sommet ns + nt = notrcf(i) + do 20 na=1,3 +c le numero de l'arete na dans le tableau nosoar + noar = abs( noartr(na,nt) ) + if( nosoar(1,noar) .ne. ns .and. + % nosoar(2,noar) .ne. ns ) goto 25 + 20 continue +c +c construction de la liste des sommets des aretes simples +c de la boule des triangles de sommet ns +c ------------------------------------------------------- + 25 do 35 na=1,2 + ns1 = nosoar(na,noar) + do 30 j=nbstbo,1,-1 + if( ns1 .eq. nostbo(j) ) goto 35 + 30 continue +c ns1 est un nouveau sommet a ajouter + nbstbo = nbstbo + 1 + nostbo(nbstbo) = ns1 + 35 continue +c +c noar est une arete potentielle a rendre delaunay + if( nosoar(3,noar) .eq. 0 ) then +c arete non frontaliere + nosoar(lchain,noar) = noar0 + noar0 = noar + endif +c + 40 continue +c +c calcul des 2 coordonnees du barycentre de la boule du sommet ns +c calcul de l'arete de taille maximale et minimale issue de ns +c --------------------------------------------------------------- + xbar = 0d0 + ybar = 0d0 + dmin = 1d28 + dmax = 0d0 + do 50 i=1,nbstbo + x = pxyd(1,nostbo(i)) + y = pxyd(2,nostbo(i)) + xbar = xbar + x + ybar = ybar + y + d = (x-pxyd(1,ns)) ** 2 + (y-pxyd(2,ns)) ** 2 + if( d .gt. dmax ) then + dmax = d + imax = i + endif + if( d .lt. dmin ) then + dmin = d + imin = i + endif + 50 continue +c +c pas de modification de la topologie lors de la derniere iteration +c ================================================================= + if( iter .ge. nbitaq ) goto 200 +c +c si la boule de ns contient 3 ou 4 triangles le sommet ns est detruit +c ==================================================================== + if( nbtrcf .le. 4 ) then +c +c remise a -1 du chainage des aretes peripheriques de la boule ns + noar = noar0 + 60 if( noar .gt. 0 ) then +c protection du no de l'arete suivante + na = nosoar(lchain,noar) +c l'arete interne est remise a -1 + nosoar(lchain,noar) = -1 +c l'arete suivante + noar = na + goto 60 + endif + call te1stm( ns, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxtrcf, n1arcf, noarcf, + % larmin, notrcf, nostbo, + % ierr ) + if( ierr .lt. 0 ) then +c le sommet ns est externe donc non supprime +c ou bien le sommet ns est le centre d'un cf dont toutes +c les aretes simples sont frontalieres +c dans les 2 cas le sommet ns n'est pas supprime + ierr = 0 + goto 200 + else if( ierr .eq. 0 ) then + nbst4 = nbst4 + 1 + nbstsu = nbstsu + 1 + else +c erreur irrecuperable + goto 9999 + endif + goto 1000 +c + endif +c +c si la boule de ns contient 5 triangles et a un sommet voisin +c sommet de 5 triangles alors l'arete joignant ces 2 sommets +c est transformee en un seul sommet de 6 triangles +c ============================================================ + if( nbtrcf .eq. 5 ) then +c + do 80 i=1,5 +c le numero du sommet de l'arete i et different de ns + ns1 = nostbo(i) +c la liste des triangles de sommet ns1 + call trp1st( ns1, noarst, + % mosoar, nosoar, moartr, noartr, + % mxtrcf-5, nbtrc1, notrcf(6) ) + if( nbtrc1 .eq. 5 ) then +c +c l'arete de sommets ns-ns1 devient un point +c par suppression du sommet ns +c +c remise a -1 du chainage des aretes peripheriques de la boul + noar = noar0 + 70 if( noar .gt. 0 ) then +c protection du no de l'arete suivante + na = nosoar(lchain,noar) +c l'arete interne est remise a -1 + nosoar(lchain,noar) = -1 +c l'arete suivante + noar = na + goto 70 + endif +c +c le point ns1 devient le milieu de l'arete ns-ns1 + do 75 j=1,3 + pxyd(j,ns1) = (pxyd(j,ns) + pxyd(j,ns1)) * 0.5d0 + 75 continue +c + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,ns1) dans le repere initial => xyz(1:3 + call tetaid( nutysu,pxyd(1,ns1),pxyd(2,ns1), + % pxyd(3,ns1), ier ) + endif +c +c suppression du point ns et mise en delaunay + call te1stm( ns, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxtrcf, n1arcf, noarcf, + % larmin, notrcf, nostbo, + % ierr ) + if( ierr .lt. 0 ) then +c le sommet ns est externe donc non supprime +c ou bien le sommet ns est le centre d'un cf dont toutes +c les aretes simples sont frontalieres +c dans les 2 cas le sommet ns n'est pas supprime + ierr = 0 + goto 200 + else if( ierr .eq. 0 ) then + nbstsu = nbstsu + 1 + nbst5 = nbst5 + 1 + goto 1000 + else +c erreur irrecuperable + goto 9999 + endif + endif + 80 continue + endif +c +c si la boule de ns contient au moins 8 triangles +c alors un triangle interne est ajoute + 3 triangles (1 par arete) +c ================================================================ + if( nbtrcf .ge. 8 ) then +c +c modification des coordonnees du sommet ns +c il devient le barycentre du triangle notrcf(1) + call nusotr( notrcf(1), mosoar, nosoar, + % moartr, noartr, nosotr ) + do 110 i=1,3 + pxyd(i,ns) = ( pxyd(i,nosotr(1,1)) + % + pxyd(i,nosotr(2,1)) + % + pxyd(i,nosotr(3,1)) ) / 3d0 + 110 continue +c + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,nbsomm) dans le repere initial => xyz(1:3) + call tetaid( nutysu, pxyd(1,ns), pxyd(2,ns), + % pxyd(3,ns), ier ) + endif +c +c ajout des 2 autres sommets comme barycentres des triangles +c notrcf(1+nbtrcf/3) et notrcf(1+2*nbtrcf/3) + nbt1 = ( nbtrcf + 1 ) / 3 + do 140 n=1,2 +c +c le triangle traite + nt = notrcf(1 + n * nbt1 ) +c +c le numero pxyd de ses 3 sommets + call nusotr( nt, mosoar, nosoar, + % moartr, noartr, nosotr ) +c +c ajout du nouveau barycentre + if( nbsomm .ge. mxsomm ) then + write(imprim,*) 'saturation du tableau pxyd' +c abandon de l'amelioration + goto 1100 + endif + nbsomm = nbsomm + 1 + do 120 i=1,3 + pxyd(i,nbsomm) = ( pxyd(i,nosotr(1,1)) + % + pxyd(i,nosotr(2,1)) + % + pxyd(i,nosotr(3,1)) ) / 3d0 + 120 continue +c + if( nutysu .gt. 0 ) then +c la fonction taille_ideale(x,y,z) existe +c calcul de pxyzd(3,nbsomm) dans le repere initial => xyz(1:3 + call tetaid( nutysu, pxyd(1,nbsomm),pxyd(2,nbsomm), + % pxyd(3,nbsomm), ier ) + endif +c +c sommet interne a la triangulation + nslign(nbsomm) = 0 +c +c les 3 aretes du triangle nt sont a rendre delaunay + do 130 i=1,3 + noar = abs( noartr(i,nt) ) + if( nosoar(3,noar) .eq. 0 ) then +c arete non frontaliere + if( nosoar(lchain,noar) .lt. 0 ) then +c arete non encore chainee + nosoar(lchain,noar) = noar0 + noar0 = noar + endif + endif + 130 continue +c +c triangulation du triangle de barycentre nbsomm +c protection a ne pas modifier sinon erreur! + call tr3str( nbsomm, nt, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nosotr, ierr ) + if( ierr .ne. 0 ) goto 9999 + 140 continue +c + nbst8 = nbst8 + 1 +c +c les aretes chainees de la boule sont rendues delaunay + goto 300 +c + endif +c +c nbtrcf est compris entre 5 et 7 => barycentrage simple +c ====================================================== +c les 2 coordonnees du barycentre des sommets des aretes +c simples de la boule du sommet ns + 200 xbar = xbar / nbstbo + ybar = ybar / nbstbo +c +c ponderation pour eviter les degenerescenses + pxyd(1,ns) = ponde1 * pxyd(1,ns) + ponder * xbar + pxyd(2,ns) = ponde1 * pxyd(2,ns) + ponder * ybar +c +c les aretes chainees de la boule sont rendues delaunay + 300 call tedela( pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, noar0, + % moartr, mxartr, n1artr, noartr, modifs ) +c + 1000 continue +c +c trace de la triangulation actuelle et calcul de la qualite + 1100 continue +c +ccc write(imprim,11000) nbst4, nbst5, nbst8 +ccc11000 format( i7,' sommets de 4t', +ccc % i7,' sommets 5t+5t', +ccc % i7,' sommets >7t' ) +c +c mise a jour pour ne pas oublier les nouveaux sommets + if( nbs1 .gt. nbs2 ) then + nbs1 = nbsomm + nbs2 = nbarpi + 1 + else + nbs1 = nbarpi + 1 + nbs2 = nbsomm + endif +c + 5000 continue +c + 9999 return + end + + + subroutine teamqt( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : amelioration de la qualite de la triangulation issue de teabr4 +c ----- +c +c entrees: +c -------- +c nutysu : numero de traitement de areteideale() selon le type de surface +c 0 pas d'emploi de la fonction areteideale() => aretmx active +c 1 il existe une fonction areteideale() +c dont seules les 2 premieres composantes de uv sont actives +c autres options a definir... +c noarst : noarst(i) numero d'une arete de sommet i +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes frontalieres declarables +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles declarables dans noartr +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c mxarcf : nombre maximal de triangles empilables +c nbarpi : numero du dernier sommet frontalier ou interne impose +c nslign : tableau du numero de sommet dans sa ligne pour chaque +c sommet frontalier +c numero du point dans le lexique point si interne impose +c 0 si le point est interne non impose par l'utilisateur +c -1 si le sommet est externe au domaine +c comxmi : min et max des coordonneees des sommets du maillage +c +c modifies : +c ---------- +c nbsomm : nombre actuel de sommets de la triangulation +c (certains sommets internes ont ete desactives ou ajoutes) +c pxyd : tableau des coordonnees 2d des points +c +c auxiliaires: +c ------------ +c notrcf : tableau ( mxarcf ) auxiliaire d'entiers +c numero dans noartr des triangles de sommet ns +c nostbo : tableau ( mxarcf ) auxiliaire d'entiers +c numero dans pxyd des sommets des aretes simples de la boule +c n1arcf : tableau (0:mxarcf) auxiliaire d'entiers +c noarcf : tableau (3,mxarcf) auxiliaire d'entiers +c larmin : tableau ( mxarcf ) auxiliaire d'entiers +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juin 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*), d2d3(3,3) + integer noartr(moartr,*), + % nosoar(mosoar,*), + % noarst(*), + % notrcf(mxarcf), + % nslign(*), + % nostbo(mxarcf), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf) + double precision comxmi(3,2) +c +c suppression des sommets de triangles equilateraux trop proches +c d'un sommet frontalier ou d'un point interne impose par +c triangulation frontale de l'etoile et mise en delaunay +c ============================================================== + call tesusp( nbarpi, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, notrcf, nostbo, + % nbstsu, ierr ) + if( ierr .ne. 0 ) goto 9999 +c write(imprim,*) 'retrait de',nbstsu, +c % ' sommets de te trop proches de la frontiere' +c +c ajustage des tailles moyennes des aretes avec ampli=1.34d0 entre +c ampli/2 x taille_souhaitee et ampli x taille_souhaitee +c + barycentrage des sommets et mise en triangulation delaunay +c ================================================================ + call teamqa( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) + if( ierr .ne. 0 ) goto 9999 +c +c modification de la topologie autour des sommets frontaliers +c pour avoir un nombre de triangles egal a l'angle/60 degres +c et mise en triangulation delaunay locale +c =========================================================== + call teamsf( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) + if( ierr .ne. 0 ) goto 9999 +c +c quelques iterations de barycentrage des points internes +c modification de la topologie pour avoir 4 ou 5 ou 6 triangles +c pour chaque sommet de la triangulation +c et mise en triangulation delaunay +c ============================================================= + call teamqs( nutysu, + % noarst, mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, notrcf, nostbo, + % n1arcf, noarcf, larmin, + % comxmi, nbarpi, nbsomm, mxsomm, pxyd, nslign, + % ierr ) +c + 9999 return + end + + subroutine trfrcf( nscent, mosoar, nosoar, moartr, noartr, + % nbtrcf, notrcf, nbarfr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calculer le nombre d'aretes simples du contour ferme des +c ----- nbtrcf triangles de numeros stockes dans le tableau notrcf +c ayant tous le sommet nscent +c +c entrees: +c -------- +c nscent : numero du sommet appartenant a tous les triangles notrcf +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c moartr : nombre maximal d'entiers par arete du tableau noartr +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c nbtrcf : >0 nombre de triangles empiles +c =0 si impossible de tourner autour du point +c =-nbtrcf si apres butee sur la frontiere il y a a nouveau +c butee sur la frontiere . a ce stade on ne peut dire si tous +c les triangles ayant ce sommet ont ete recenses +c ce cas arrive seulement si le sommet est sur la frontiere +c notrcf : numero dans noartr des triangles de sommet ns +c +c sortie : +c -------- +c nbarfr : nombre d'aretes simples frontalieres +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juin 1997 +c....................................................................012 + integer noartr(moartr,*), + % nosoar(mosoar,*), + % notrcf(1:nbtrcf) +c + nbarfr = 0 + do 50 n=1,nbtrcf +c le numero du triangle n dans le tableau noartr + nt = notrcf( n ) +c parcours des 3 aretes du triangle nt + do 40 i=1,3 +c le numero de l'arete i dans le tableau nosoar + noar = abs( noartr( i, nt ) ) + do 30 j=1,2 +c le numero du sommet j de l'arete noar + ns = nosoar( j, noar ) + if( ns .eq. nscent ) goto 40 + 30 continue +c l'arete noar (sans sommet nscent) est elle frontaliere? + if( nosoar( 5, noar ) .le. 0 ) then +c l'arete appartient au plus a un triangle +c une arete simple frontaliere de plus + nbarfr = nbarfr + 1 + endif +c le triangle a au plus une arete sans sommet nscent + goto 50 + 40 continue + 50 continue + end + + subroutine int2ar( p1, p2, p3, p4, oui ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : les 2 aretes de r**2 p1-p2 p3-p4 s'intersectent elles +c ----- entre leurs sommets? +c +c entrees: +c -------- +c p1,p2,p3,p4 : les 2 coordonnees reelles des sommets des 2 aretes +c +c sortie : +c -------- +c oui : .true. si intersection, .false. sinon +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc octobre 1991 +c2345x7..............................................................012 + double precision p1(2),p2(2),p3(2),p4(2) + double precision x21,y21,d21,x43,y43,d43,d,x,y,xx + logical oui +c +c longueur des aretes + x21 = p2(1)-p1(1) + y21 = p2(2)-p1(2) + d21 = x21**2 + y21**2 +c + x43 = p4(1)-p3(1) + y43 = p4(2)-p3(2) + d43 = x43**2 + y43**2 +c +c les 2 aretes sont-elles jugees paralleles ? + d = x43 * y21 - y43 * x21 + if( abs(d) .le. 0.001 * sqrt(d21 * d43) ) then +c aretes paralleles . pas d'intersection + oui = .false. + return + endif +c +c les 2 coordonnees du point d'intersection + x = ( p1(1)*x43*y21 - p3(1)*x21*y43 - (p1(2)-p3(2))*x21*x43 ) / d + y =-( p1(2)*y43*x21 - p3(2)*y21*x43 - (p1(1)-p3(1))*y21*y43 ) / d +c +c coordonnees de x,y dans le repere ns1-ns2 + xx = ( x - p1(1) ) * x21 + ( y - p1(2) ) * y21 +c le point est il entre p1 et p2 ? + oui = -0.00001d0*d21 .le. xx .and. xx .le. 1.00001d0*d21 +c +c coordonnees de x,y dans le repere ns3-ns4 + xx = ( x - p3(1) ) * x43 + ( y - p3(2) ) * y43 +c le point est il entre p3 et p4 ? + oui = oui .and. -0.00001d0*d43 .le. xx .and. xx .le. 1.00001d0*d43 + end + + + subroutine trchtd( pxyd, nar00, nar0, noarcf, + % namin0, namin, larmin ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : recherche dans le contour ferme du sommet qui joint a la plus +c ----- courte arete nar00 donne le triangle sans intersection +c avec le contour ferme de meilleure qualite +c +c entrees: +c -------- +c pxyd : tableau des coordonnees des sommets et distance_souhaitee +c +c entrees et sorties: +c ------------------- +c nar00 : numero dans noarcf de l'arete avant nar0 +c nar0 : numero dans noarcf de la plus petite arete du contour ferme +c a joindre a noarcf(1,namin) pour former le triangle ideal +c noarcf : numero du sommet , numero de l'arete suivante +c numero du triangle exterieur a l'etoile +c +c sortie : +c -------- +c namin0 : numero dans noarcf de l'arete avant namin +c namin : numero dans noarcf du sommet choisi +c 0 si contour ferme reduit a moins de 3 aretes +c larmin : tableau auxiliaire pour stocker la liste des numeros des +c aretes de meilleure qualite pour faire le choix final +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + double precision dmaxim, precision + parameter (dmaxim=1.7d+308, precision=1d-16) +c ATTENTION:variables a ajuster selon la machine! +c ATTENTION:dmaxim : le plus grand reel machine +c ATTENTION:sur dec-alpha la precision est de 10**-14 seulement + + common / unites / lecteu,imprim,nunite(30) + double precision pxyd(1:3,1:*) + integer noarcf(1:3,1:*), + % larmin(1:*) + double precision q, dd, dmima, + % unpeps, rayon, surtd2 + logical oui + double precision centre(3) +c +c initialisations +c dmaxim : le plus grand reel machine + unpeps = 1d0 + 100d0 * precision +c +c recherche de la plus courte arete du contour ferme + nbmin = 0 + na00 = nar00 + dmima = dmaxim + nbar = 0 +c + 2 na0 = noarcf( 2, na00 ) + na1 = noarcf( 2, na0 ) + nbar = nbar + 1 +c les 2 sommets de l'arete na0 du cf + ns1 = noarcf( 1, na0 ) + ns2 = noarcf( 1, na1 ) + dd = (pxyd(1,ns2)-pxyd(1,ns1))**2 + (pxyd(2,ns2)-pxyd(2,ns1))**2 + if( dd .lt. dmima ) then + dmima = dd + larmin(1) = na00 + endif + na00 = na0 + if( na00 .ne. nar00 ) then +c derniere arete non atteinte + goto 2 + endif +c + if( nbar .eq. 3 ) then +c +c contour ferme reduit a un triangle +c ---------------------------------- + namin = nar00 + nar0 = noarcf( 2, nar00 ) + namin0 = noarcf( 2, nar0 ) + return +c + else if( nbar .le. 2 ) then + write(imprim,*) 'erreur trchtd: cf<3 aretes' + pause + namin = 0 + namin0 = 0 + return + endif +c +c cf non reduit a un triangle +c la plus petite arete est nar0 dans noarcf + nar00 = larmin( 1 ) + nar0 = noarcf( 2, nar00 ) + nar = noarcf( 2, nar0 ) +c + ns1 = noarcf( 1, nar0 ) + ns2 = noarcf( 1, nar ) +c +c recherche dans cette etoile du sommet offrant la meilleure qualite +c du triangle ns1-ns2 ns3 sans intersection avec le contour ferme +c ================================================================== + nar3 = nar + qmima = -1 +c +c parcours des sommets possibles ns3 + 10 nar3 = noarcf( 2, nar3 ) + if( nar3 .ne. nar0 ) then +c +c il existe un sommet ns3 different de ns1 et ns2 + ns3 = noarcf( 1, nar3 ) +c +c les aretes ns1-ns3 et ns2-ns3 intersectent-elles une arete +c du contour ferme ? +c ---------------------------------------------------------- +c intersection de l'arete ns2-ns3 et des aretes du cf +c jusqu'au sommet ns3 + nar1 = noarcf( 2, nar ) +c + 15 if( nar1 .ne. nar3 .and. noarcf( 2, nar1 ) .ne. nar3 ) then +c l'arete suivante + nar2 = noarcf( 2, nar1 ) +c le numero des 2 sommets de l'arete + np1 = noarcf( 1, nar1 ) + np2 = noarcf( 1, nar2 ) + call int2ar( pxyd(1,ns2), pxyd(1,ns3), + % pxyd(1,np1), pxyd(1,np2), oui ) + if( oui ) goto 10 +c les 2 aretes ne s'intersectent pas entre leurs sommets + nar1 = nar2 + goto 15 + endif +c +c intersection de l'arete ns3-ns1 et des aretes du cf +c jusqu'au sommet de l'arete nar0 + nar1 = noarcf( 2, nar3 ) +c + 18 if( nar1 .ne. nar0 .and. noarcf( 2, nar1 ) .ne. nar0 ) then +c l'arete suivante + nar2 = noarcf( 2, nar1 ) +c le numero des 2 sommets de l'arete + np1 = noarcf( 1, nar1 ) + np2 = noarcf( 1, nar2 ) + call int2ar( pxyd(1,ns1), pxyd(1,ns3), + % pxyd(1,np1), pxyd(1,np2), oui ) + if( oui ) goto 10 +c les 2 aretes ne s'intersectent pas entre leurs sommets + nar1 = nar2 + goto 18 + endif +c +c le triangle ns1-ns2-ns3 n'intersecte pas une arete du contour ferme +c le calcul de la surface du triangle + dd = surtd2( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3) ) + if( dd .le. 0d0 ) then +c surface negative => triangle a rejeter + q = 0 + else +c calcul de la qualite du triangle ns1-ns2-ns3 + call qutr2d( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3), q ) + endif +c + if( q .ge. qmima*1.00001 ) then +c q est un vrai maximum de la qualite + qmima = q + nbmin = 1 + larmin(1) = nar3 + else if( q .ge. qmima*0.999998 ) then +c q est voisin de qmima +c il est empile + nbmin = nbmin + 1 + larmin( nbmin ) = nar3 + endif + goto 10 + endif +c +c bilan : existe t il plusieurs sommets de meme qualite? +c ====================================================== + if( nbmin .gt. 1 ) then +c +c oui:recherche de ceux de cercle ne contenant pas d'autres sommets + do 80 i=1,nbmin +c le sommet + nar = larmin( i ) + if( nar .le. 0 ) goto 80 + ns3 = noarcf(1,nar) +c les coordonnees du centre du cercle circonscrit +c et son rayon + ier = -1 + call cenced( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3), + % centre, ier ) + if( ier .ne. 0 ) then +c le sommet ns3 ne convient pas + larmin( i ) = 0 + goto 80 + endif + rayon = centre(3) * unpeps + do 70 j=1,nbmin + if( j .ne. i ) then +c l'autre sommet + nar1 = larmin(j) + if( nar1 .le. 0 ) goto 70 + ns4 = noarcf(1,nar1) +c appartient t il au cercle ns1 ns2 ns3 ? + dd = (centre(1)-pxyd(1,ns4))**2 + + % (centre(2)-pxyd(2,ns4))**2 + if( dd .le. rayon ) then +c ns4 est dans le cercle circonscrit ns1 ns2 ns3 +c le sommet ns3 ne convient pas + larmin( i ) = 0 + goto 80 + endif + endif + 70 continue + 80 continue +c +c existe t il plusieurs sommets ? + j = 0 + do 90 i=1,nbmin + if( larmin( i ) .gt. 0 ) then +c compactage des min + j = j + 1 + larmin(j) = larmin(i) + endif + 90 continue +c + if( j .gt. 1 ) then +c oui : choix du plus petit rayon de cercle circonscrit + dmima = dmaxim + do 120 i=1,nbmin + ns3 = noarcf(1,larmin(i)) +c +c les coordonnees du centre de cercle circonscrit +c au triangle nt et son rayon + ier = -1 + call cenced( pxyd(1,ns1), pxyd(1,ns2), pxyd(1,ns3), + % centre, ier ) + if( ier .ne. 0 ) then +c le sommet ns3 ne convient pas + goto 120 + endif + rayon = sqrt( centre(3) ) + if( rayon .lt. dmima ) then + dmima = rayon + larmin(1) = larmin(i) + endif + 120 continue + endif + endif +c +c le choix final +c ============== + namin = larmin(1) +c +c recherche de l'arete avant namin ( nar0 <> namin ) +c ================================================== + nar1 = nar0 + 200 if( nar1 .ne. namin ) then + namin0 = nar1 + nar1 = noarcf( 2, nar1 ) + goto 200 + endif + end + + subroutine trcf0a( nbcf, na01, na1, na2, na3, + % noar1, noar2, noar3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : modification de la triangulation du contour ferme nbcf +c ----- par ajout d'un triangle ayant 0 arete sur le contour +c creation des 3 aretes dans le tableau nosoar +c modification du contour par ajout de la 3-eme arete +c creation d'un contour ferme a partir de la seconde arete +c +c entrees: +c -------- +c nbcf : numero dans n1arcf du cf traite ici +c na01 : numero noarcf de l'arete precedent l'arete na1 de noarcf +c na1 : numero noarcf du 1-er sommet du triangle +c implicitement l'arete na1 n'est pas une arete du triangle +c na2 : numero noarcf du 2-eme sommet du triangle +c implicitement l'arete na1 n'est pas une arete du triangle +c na3 : numero noarcf du 3-eme sommet du triangle +c implicitement l'arete na1 n'est pas une arete du triangle +c +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c +c entrees et sorties : +c -------------------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c noarst : noarst(i) numero d'une arete de sommet i +c n1arcf : numero d'une arete de chaque contour +c noarcf : numero des aretes de la ligne du contour ferme +c attention : chainage circulaire des aretes +c +c sortie : +c -------- +c noar1 : numero dans le tableau nosoar de l'arete 1 du triangle +c noar2 : numero dans le tableau nosoar de l'arete 2 du triangle +c noar3 : numero dans le tableau nosoar de l'arete 3 du triangle +c nt : numero du triangle ajoute dans noartr +c 0 si saturation du tableau noartr ou noarcf ou n1arcf +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) + integer nosoar(mosoar,*), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:*), + % noarcf(3,*) +c + ierr = 0 +c +c 2 contours fermes peuvent ils etre ajoutes ? + if( nbcf+2 .gt. mxarcf ) goto 9100 +c +c creation des 3 aretes du triangle dans le tableau nosoar +c ======================================================== +c la formation de l'arete sommet1-sommet2 dans le tableau nosoar + call fasoar( noarcf(1,na1), noarcf(1,na2), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar1, ierr ) + if( ierr .ne. 0 ) goto 9900 +c +c la formation de l'arete sommet2-sommet3 dans le tableau nosoar + call fasoar( noarcf(1,na2), noarcf(1,na3), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar2, ierr ) + if( ierr .ne. 0 ) goto 9900 +c +c la formation de l'arete sommet3-sommet1 dans le tableau nosoar + call fasoar( noarcf(1,na3), noarcf(1,na1), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar3, ierr ) + if( ierr .ne. 0 ) goto 9900 +c +c ajout dans noartr de ce triangle nt +c =================================== + call trcf3a( noarcf(1,na1), noarcf(1,na2), noarcf(1,na3), + % noar1, noar2, noar3, + % mosoar, nosoar, + % moartr, n1artr, noartr, + % nt ) + if( nt .le. 0 ) return +c +c modification du contour nbcf existant +c chainage de l'arete na2 vers l'arete na1 +c ======================================== +c modification du cf en pointant na2 sur na1 + na2s = noarcf( 2, na2 ) + noarcf( 2, na2 ) = na1 +c le numero de l'arete dans le tableau nosoar + noar2s = noarcf( 3, na2 ) +c le numero de l'arete dans le tableau nosoar + noarcf( 3, na2 ) = noar1 +c debut du cf + n1arcf( nbcf ) = na2 +c +c creation d'un nouveau contour ferme na2 - na3 +c ============================================= + nbcf = nbcf + 1 +c recherche d'une arete de cf vide + nav = n1arcf(0) + if( nav .le. 0 ) goto 9100 +c la 1-ere arete vide est mise a jour + n1arcf(0) = noarcf( 2, nav ) +c +c ajout de l'arete nav pointant sur na2s +c le numero du sommet + noarcf( 1, nav ) = noarcf( 1, na2 ) +c l'arete suivante + noarcf( 2, nav ) = na2s +c le numero nosoar de cette arete + noarcf( 3, nav ) = noar2s +c +c l'arete na3 se referme sur nav + na3s = noarcf( 2, na3 ) + noarcf( 2, na3 ) = nav +c le numero de l'arete dans le tableau nosoar + noar3s = noarcf( 3, na3 ) + noarcf( 3, na3 ) = noar2 +c debut du cf+1 + n1arcf( nbcf ) = na3 +c +c creation d'un nouveau contour ferme na3 - na1 +c ============================================= + nbcf = nbcf + 1 +c recherche d'une arete de cf vide + nav = n1arcf(0) + if( nav .le. 0 ) goto 9100 +c la 1-ere arete vide est mise a jour + n1arcf(0) = noarcf( 2, nav ) +c +c ajout de l'arete nav pointant sur na3s +c le numero du sommet + noarcf( 1, nav ) = noarcf( 1, na3 ) +c l'arete suivante + noarcf( 2, nav ) = na3s +c le numero de l'arete dans le tableau nosoar + noarcf( 3, nav ) = noar3s +c +c recherche d'une arete de cf vide + nav1 = n1arcf(0) + if( nav1 .le. 0 ) goto 9100 +c la 1-ere arete vide est mise a jour + n1arcf(0) = noarcf( 2, nav1 ) +c +c l'arete precedente na01 de na1 pointe sur la nouvelle nav1 + noarcf( 2, na01 ) = nav1 +c +c ajout de l'arete nav1 pointant sur nav +c le numero du sommet + noarcf( 1, nav1 ) = noarcf( 1, na1 ) +c l'arete suivante + noarcf( 2, nav1 ) = nav +c le numero de l'arete dans le tableau nosoar + noarcf( 3, nav1 ) = noar3 +c +c debut du cf+2 + n1arcf( nbcf ) = nav1 + return +c +c erreur + 9100 write(imprim,*) 'saturation du tableau mxarcf' + nt = 0 + return +c +c erreur tableau nosoar sature + 9900 write(imprim,*) 'saturation du tableau nosoar' + nt = 0 + return + end + + + subroutine trcf1a( nbcf, na01, na1, na2, noar1, noar3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : modification de la triangulation du contour ferme nbcf +c ----- par ajout d'un triangle ayant 1 arete sur le contour +c modification du contour par ajout de la 3-eme arete +c creation d'un contour ferme a partir de la seconde arete +c +c entrees: +c -------- +c nbcf : numero dans n1arcf du cf traite ici +c na01 : numero noarcf de l'arete precedant l'arete na1 de noarcf +c na1 : numero noarcf du 1-er sommet du triangle +c implicitement l'arete na1 n'est pas une arete du triangle +c na2 : numero noarcf du 2-eme sommet du triangle +c cette arete est l'arete 2 du triangle a ajouter +c son arete suivante dans noarcf n'est pas sur le contour +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c +c entrees et sorties : +c -------------------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c noarst : noarst(i) numero d'une arete de sommet i +c n1arcf : numero d'une arete de chaque contour +c noarcf : numero des aretes de la ligne du contour ferme +c attention : chainage circulaire des aretes +c +c sortie : +c -------- +c noar1 : numero nosoar de l'arete 1 du triangle cree +c noar3 : numero nosoar de l'arete 3 du triangle cree +c nt : numero du triangle ajoute dans notria +c 0 si saturation du tableau notria ou noarcf ou n1arcf +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) + integer nosoar(mosoar,mxsoar), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:*), + % noarcf(3,*) +c +c un cf supplementaire peut il etre ajoute ? + if( nbcf .ge. mxarcf ) then + write(imprim,*) 'saturation du tableau noarcf' + nt = 0 + return + endif +c + ierr = 0 +c +c l' arete suivante du triangle non sur le cf + na3 = noarcf( 2, na2 ) +c +c creation des 2 nouvelles aretes du triangle dans le tableau nosoar +c ================================================================== +c la formation de l'arete sommet1-sommet2 dans le tableau nosoar + call fasoar( noarcf(1,na1), noarcf(1,na2), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar1, ierr ) + if( ierr .ne. 0 ) goto 9900 +c +c la formation de l'arete sommet1-sommet3 dans le tableau nosoar + call fasoar( noarcf(1,na3), noarcf(1,na1), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar3, ierr ) + if( ierr .ne. 0 ) goto 9900 +c +c le triangle nt de noartr a l'arete 2 comme arete du contour na2 +c =============================================================== + call trcf3a( noarcf(1,na1), noarcf(1,na2), noarcf(1,na3), + % noar1, noarcf(3,na2), noar3, + % mosoar, nosoar, + % moartr, n1artr, noartr, + % nt ) + if( nt .le. 0 ) return +c +c modification du contour ferme existant +c suppression de l'arete na2 du cf +c ====================================== +c modification du cf en pointant na2 sur na1 + noarcf( 2, na2 ) = na1 + noarcf( 3, na2 ) = noar1 +c debut du cf + n1arcf( nbcf ) = na2 +c +c creation d'un nouveau contour ferme na3 - na1 +c ============================================= + nbcf = nbcf + 1 +c +c recherche d'une arete de cf vide + nav = n1arcf(0) + if( nav .le. 0 ) then + write(imprim,*) 'saturation du tableau noarcf' + nt = 0 + return + endif +c +c la 1-ere arete vide est mise a jour + n1arcf(0) = noarcf( 2, nav ) +c +c ajout de l'arete nav pointant sur na3 +c le numero du sommet + noarcf( 1, nav ) = noarcf( 1, na1 ) +c l'arete suivante + noarcf( 2, nav ) = na3 +c le numero de l'arete dans le tableau nosoar + noarcf( 3, nav ) = noar3 +c +c l'arete precedente na01 de na1 pointe sur la nouvelle nav + noarcf( 2, na01 ) = nav +c +c debut du cf + n1arcf( nbcf ) = nav + return +c +c erreur tableau nosoar sature + 9900 write(imprim,*) 'saturation du tableau nosoar' + nt = 0 + return + end + + + subroutine trcf2a( nbcf, na1, noar3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % n1arcf, noarcf, nt ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : modification de la triangulation du contour ferme nbcf +c ----- par ajout d'un triangle ayant 2 aretes sur le contour +c creation d'une arete dans nosoar (sommet3-sommet1) +c et modification du contour par ajout de la 3-eme arete +c +c entrees: +c -------- +c nbcf : numero dans n1arcf du cf traite ici +c na1 : numero noarcf de la premiere arete sur le contour +c implicitement sa suivante est sur le contour +c la suivante de la suivante n'est pas sur le contour +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c +c entrees et sorties : +c -------------------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c noarst : noarst(i) numero d'une arete de sommet i +c n1arcf : numero d'une arete de chaque contour +c noarcf : numero des aretes de la ligne du contour ferme +c attention : chainage circulaire des aretes +c +c sortie : +c -------- +c noar3 : numero de l'arete 3 dans le tableau nosoar +c nt : numero du triangle ajoute dans noartr +c 0 si saturation du tableau noartr ou nosoar +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) + integer nosoar(mosoar,*), + % noartr(moartr,*), + % noarst(*) + integer n1arcf(0:*), + % noarcf(3,*) +c + ierr = 0 +c +c l'arete suivante de l'arete na1 dans noarcf + na2 = noarcf( 2, na1 ) +c l'arete suivante de l'arete na2 dans noarcf + na3 = noarcf( 2, na2 ) +c +c la formation de l'arete sommet3-sommet1 dans le tableau nosoar + call fasoar( noarcf(1,na3), noarcf(1,na1), -1, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar3, ierr ) + if( ierr .ne. 0 ) then + if( ierr .eq. 1 ) then + write(imprim,*) 'saturation des aretes (tableau nosoar)' + endif + nt = 0 + return + endif +c +c le triangle a ses 2 aretes na1 na2 sur le contour ferme +c ajout dans noartr de ce triangle nt + call trcf3a( noarcf(1,na1), noarcf(1,na2), noarcf(1,na3), + % noarcf(3,na1), noarcf(3,na2), noar3, + % mosoar, nosoar, + % moartr, n1artr, noartr, + % nt ) + if( nt .le. 0 ) return +c +c suppression des 2 aretes (na1 na2) du cf +c ces 2 aretes se suivent dans le chainage du cf +c ajout de la 3-eme arete (noar3) dans le cf +c l'arete suivante de na1 devient la suivante de na2 + noarcf(2,na1) = na3 + noarcf(3,na1) = noar3 +c +c l'arete na2 devient vide dans noarcf + noarcf(2,na2) = n1arcf( 0 ) + n1arcf( 0 ) = na2 +c +c la premiere pointee dans noarcf est na1 +c chainage circulaire => ce peut etre n'importe laquelle + n1arcf(nbcf) = na1 + end + + + subroutine trcf3a( ns1, ns2, ns3, + % noar1, noar2, noar3, + % mosoar, nosoar, + % moartr, n1artr, noartr, + % nt ) +c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : ajouter dans le tableau noartr le triangle +c ----- de sommets ns1 ns2 ns3 +c d'aretes noar1 noar2 noar3 deja existantes +c dans le tableau nosoar des aretes +c +c entrees: +c -------- +c ns1, ns2, ns3 : le numero dans pxyd des 3 sommets du triangle +c noar1,noar2,noar3 : le numero dans nosoar des 3 aretes du triangle +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies : +c ---------- +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c sorties: +c -------- +c nt : numero dans noartr du triangle ajoute +c =0 si le tableau noartr est sature +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu,imprim,nunite(30) + integer nosoar(mosoar,*), + % noartr(moartr,*) +c +c recherche d'un triangle libre dans le tableau noartr + if( n1artr .le. 0 ) then + write(imprim,*) 'saturation du tableau noartr des aretes' + nt = 0 + return + endif +c +c le numero dans noartr du nouveau triangle + nt = n1artr +c +c le nouveau premier triangle vide dans le tableau noartr + n1artr = noartr(2,n1artr) +c +c arete 1 du triangle nt +c ====================== +c orientation des 3 aretes du triangle pour qu'il soit direct + if( ns1 .eq. nosoar(1,noar1) ) then + n = 1 + else + n = -1 + endif +c le numero de l'arete 1 du triangle nt + noartr(1,nt) = n * noar1 +c +c le numero du triangle nt pour l'arete + if( nosoar(4,noar1) .le. 0 ) then + n = 4 + else + n = 5 + endif + nosoar(n,noar1) = nt +c +c arete 2 du triangle nt +c ====================== +c orientation des 3 aretes du triangle pour qu'il soit direct + if( ns2 .eq. nosoar(1,noar2) ) then + n = 1 + else + n = -1 + endif +c le numero de l'arete 2 du triangle nt + noartr(2,nt) = n * noar2 +c +c le numero du triangle nt pour l'arete + if( nosoar(4,noar2) .le. 0 ) then + n = 4 + else + n = 5 + endif + nosoar(n,noar2) = nt +c +c arete 3 du triangle nt +c ====================== +c orientation des 3 aretes du triangle pour qu'il soit direct + if( ns3 .eq. nosoar(1,noar3) ) then + n = 1 + else + n = -1 + endif +c le numero de l'arete 3 du triangle nt + noartr(3,nt) = n * noar3 +c +c le numero du triangle nt pour l'arete + if( nosoar(4,noar3) .le. 0 ) then + n = 4 + else + n = 5 + endif + nosoar(n,noar3) = nt + end + + + + subroutine trcf3s( nbcf, na01, na1, na02, na2, na03, na3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : ajout d'un triangle d'aretes na1 2 3 du tableau noarcf +c ----- a la triangulation d'un contour ferme (cf) +c +c entrees: +c -------- +c nbcf : numero dans n1arcf du cf traite ici +c mais aussi nombre actuel de cf avant ajout du triangle +c na01 : numero noarcf de l'arete precedent l'arete na1 de noarcf +c na1 : numero noarcf du 1-er sommet du triangle +c na02 : numero noarcf de l'arete precedent l'arete na2 de noarcf +c na2 : numero noarcf du 2-eme sommet du triangle +c na03 : numero noarcf de l'arete precedent l'arete na3 de noarcf +c na3 : numero noarcf du 3-eme sommet du triangle +c +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxarcf : nombre maximal d'aretes declarables dans noarcf, n1arcf +c +c modifies: +c --------- +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c n1arcf : numero d'une arete de chaque contour ferme +c noarcf : numero du sommet , numero de l'arete suivante +c numero de l'arete dans le tableau nosoar +c attention : chainage circulaire des aretes +c +c sortie : +c -------- +c nbcf : nombre actuel de cf apres ajout du triangle +c nt : numero du triangle ajoute dans noartr +c 0 si saturation du tableau nosoar ou noartr ou noarcf ou n1arcf +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + integer nosoar(mosoar,*), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf) +c +c combien y a t il d'aretes nbascf sur le cf ? +c ============================================ +c la premiere arete est elle sur le cf? + if( noarcf(2,na1) .eq. na2 ) then +c la 1-ere arete est sur le cf + na1cf = 1 + else +c la 1-ere arete n'est pas sur le cf + na1cf = 0 + endif +c +c la seconde arete est elle sur le cf? + if( noarcf(2,na2) .eq. na3 ) then +c la 2-eme arete est sur le cf + na2cf = 1 + else + na2cf = 0 + endif +c +c la troisieme arete est elle sur le cf? + if( noarcf(2,na3) .eq. na1 ) then +c la 3-eme arete est sur le cf + na3cf = 1 + else + na3cf = 0 + endif +c +c le nombre d'aretes sur le cf + nbascf = na1cf + na2cf + na3cf +c +c traitement selon le nombre d'aretes sur le cf +c ============================================= + if( nbascf .eq. 3 ) then +c +c le contour ferme se reduit a un triangle avec 3 aretes sur le cf +c ---------------------------------------------------------------- +c ajout dans noartr de ce nouveau triangle + call trcf3a( noarcf(1,na1), noarcf(1,na2), noarcf(1,na3), + % noarcf(3,na1), noarcf(3,na2), noarcf(3,na3), + % mosoar, nosoar, + % moartr, n1artr, noartr, + % nt ) + if( nt .le. 0 ) return +c +c le cf est supprime et chaine vide + noarcf(2,na3) = n1arcf(0) + n1arcf( 0 ) = na1 +c +c ce cf a ete traite => un cf de moins a traiter + nbcf = nbcf - 1 +c + else if( nbascf .eq. 2 ) then +c +c le triangle a 2 aretes sur le contour +c ------------------------------------- +c les 2 aretes sont la 1-ere et 2-eme du triangle + if( na1cf .eq. 0 ) then +c l'arete 1 n'est pas sur le cf + naa1 = na2 + else if( na2cf .eq. 0 ) then +c l'arete 2 n'est pas sur le cf + naa1 = na3 + else +c l'arete 3 n'est pas sur le cf + naa1 = na1 + endif +c le triangle oppose a l'arete 3 est inconnu +c modification du contour apres integration du +c triangle ayant ses 2-eres aretes sur le cf + call trcf2a( nbcf, naa1, naor3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % n1arcf, noarcf, nt ) +c + else if( nbascf .eq. 1 ) then +c +c le triangle a 1 arete sur le contour +c ------------------------------------ +c cette arete est la seconde du triangle + if( na3cf .ne. 0 ) then +c l'arete 3 est sur le cf + naa01 = na02 + naa1 = na2 + naa2 = na3 + else if( na1cf .ne. 0 ) then +c l'arete 1 est sur le cf + naa01 = na03 + naa1 = na3 + naa2 = na1 + else +c l'arete 2 est sur le cf + naa01 = na01 + naa1 = na1 + naa2 = na2 + endif +c le triangle oppose a l'arete 1 et 3 est inconnu +c modification du contour apres integration du +c triangle ayant 1 arete sur le cf avec creation +c d'un nouveau contour ferme + call trcf1a( nbcf, naa01, naa1, naa2, naor1, naor3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) +c + else +c +c le triangle a 0 arete sur le contour +c ------------------------------------ +c modification du contour apres integration du +c triangle ayant 0 arete sur le cf avec creation +c de 2 nouveaux contours fermes + call trcf0a( nbcf, na01, na1, na2, na3, + % naa1, naa2, naa01, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) + endif + end + + + subroutine tridcf( nbcf0, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, + % nbtrcf, notrcf, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : triangulation directe de nbcf0 contours fermes (cf) +c ----- definis par la liste circulaire de leurs aretes peripheriques +c +c entrees: +c -------- +c nbcf0 : nombre initial de cf a trianguler +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxarcf : nombre maximal d'aretes declarables dans noarcf, n1arcf, larmin, not +c +c modifies: +c --------- +c noarst : noarst(i) numero d'une arete de sommet i +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c n1arcf : numero de la premiere arete de chacun des nbcf0 cf +c n1arcf(0) no de la premiere arete vide du tableau noarcf +c noarcf(2,i) no de l'arete suivante +c noarcf : numero du sommet , numero de l'arete suivante du cf +c numero de l'arete dans le tableau nosoar +c +c auxiliaires : +c ------------- +c larmin : tableau (mxarcf) auxiliaire +c stocker la liste des numeros des meilleures aretes +c lors de la selection du meilleur sommet du cf a trianguler +c cf le sp trchtd +c +c sortie : +c -------- +c nbtrcf : nombre de triangles des nbcf0 cf +c notrcf : numero des triangles des nbcf0 cf dans le tableau noartr +c ierr : 0 si pas d'erreur +c 2 saturation de l'un des des tableaux nosoar, noartr, ... +c 3 si contour ferme reduit a moins de 3 aretes +c 4 saturation du tableau notrcf +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer noartr(moartr,*), + % nosoar(mosoar,mxsoar), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf), + % notrcf(mxarcf) +c +ccc integer nosotr(3) +ccc double precision d, surtd2 +c +c depart avec nbcf0 cf a trianguler + nbcf = nbcf0 +c +c le nombre de triangles formes dans l'ensemble des cf + nbtrcf = 0 +c +c tant qu'il existe un cf a trianguler faire +c la triangulation directe du cf +c ========================================== + 10 if( nbcf .gt. 0 ) then +c +c le cf en haut de pile a pour premiere arete + na01 = n1arcf( nbcf ) + na1 = noarcf( 2, na01 ) +c +c choix du sommet du cf a relier a l'arete na1 +c -------------------------------------------- + call trchtd( pxyd, na01, na1, noarcf, + % na03, na3, larmin ) + if( na3 .eq. 0 ) then + ierr = 3 + return + endif +c +c l'arete suivante de na1 + na02 = na1 + na2 = noarcf( 2, na1 ) +c +c formation du triangle arete na1 - sommet noarcf(1,na3) +c ------------------------------------------------------ + call trcf3s( nbcf, na01, na1, na02, na2, na03, na3, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, nt ) + if( nt .le. 0 ) then +c saturation du tableau noartr ou noarcf ou n1arcf + ierr = 2 + return + endif +c +c ajout du triangle cree a sa pile + if( nbtrcf .ge. mxarcf ) then + write(imprim,*) 'saturation du tableau notrcf' + ierr = 4 + return + endif + nbtrcf = nbtrcf + 1 + notrcf( nbtrcf ) = nt + goto 10 + endif +c +c mise a jour du chainage des triangles des aretes +c ================================================ + do 30 ntp0 = 1, nbtrcf +c +c le numero du triangle ajoute dans le tableau noartr + nt0 = notrcf( ntp0 ) +c +cccc aire signee du triangle nt0 +cccc le numero des 3 sommets du triangle nt +ccc call nusotr( nt0, mosoar, nosoar, moartr, noartr, +ccc % nosotr ) +ccc d = surtd2( pxyd(1,nosotr(1)), pxyd(1,nosotr(2)), +ccc % pxyd(1,nosotr(3)) ) +ccc if( d .le. 0 ) then +cccc +cccc un triangle d'aire negative de plus +ccc write(imprim,*) 'triangle ',nt0,' st:',nosotr, +ccc % ' d aire ',d,'<=0' +ccc pause +ccc endif +c +cccc trace du triangle nt0 +ccc call mttrtr( pxyd, nt0, moartr, noartr, mosoar, nosoar, +ccc % ncturq, ncblan ) +c +c boucle sur les 3 aretes du triangle + do 20 i=1,3 +c +c le numero de l'arete i du triangle dans le tableau nosoar + noar = abs( noartr(i,nt0) ) +c +c ce triangle est il deja chaine dans cette arete? + nt1 = nosoar(4,noar) + nt2 = nosoar(5,noar) + if( nt1 .eq. nt0 .or. nt2 .eq. nt0 ) goto 20 +c +c ajout de ce triangle nt0 a l'arete noar + if( nt1 .le. 0 ) then +c le triangle est ajoute a l'arete + nosoar( 4, noar ) = nt0 + else if( nt2 .le. 0 ) then +c le triangle est ajoute a l'arete + nosoar( 5, noar ) = nt0 + else +c l'arete appartient a 2 triangles differents de nt0 +c anomalie. chainage des triangles des aretes defectueux +c a corriger + write(imprim,*) 'pause dans tridcf' + pause + ierr = 5 + return + endif +c + 20 continue +c + 30 continue + end + + + subroutine te1stm( nsasup, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, notrcf, liarcf, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : supprimer de la triangulation le sommet nsasup qui doit +c ----- etre un sommet interne ("centre" d'une boule de triangles) +c +c attention: le chainage lchain de nosoar devient celui des cf +c +c entrees: +c -------- +c nsasup : numero dans le tableau pxyd du sommet a supprimer +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxarcf : nombre de variables des tableaux n1arcf, noarcf, larmin, notrcf +c +c modifies: +c --------- +c noarst : noarst(i) numero d'une arete de sommet i +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c +c auxiliaires : +c ------------- +c n1arcf : tableau (0:mxarcf) auxiliaire d'entiers +c noarcf : tableau (3,mxarcf) auxiliaire d'entiers +c larmin : tableau ( mxarcf ) auxiliaire d'entiers +c notrcf : tableau ( mxarcf ) auxiliaire d'entiers +c liarcf : tableau ( mxarcf ) auxiliaire d'entiers +c +c sortie : +c -------- +c ierr : =0 si pas d'erreur +c -1 le sommet a supprimer n'est pas le centre d'une boule +c de triangles. il est suppose externe +c ou bien le sommet est centre d'un cf dont toutes les +c aretes sont frontalieres +c dans les 2 cas => retour sans modifs +c >0 si une erreur est survenue +c =11 algorithme defaillant +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter ( lchain=6, quamal=0.3) + common / unites / lecteu,imprim,intera,nunite(29) + double precision pxyd(3,*) + integer nosoar(mosoar,mxsoar), + % noartr(moartr,*), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf), + % notrcf(mxarcf), + % liarcf(mxarcf) +c +c nsasup est il un sommet interne, "centre" d'une boule de triangles? +c => le sommet nsasup peut etre supprime +c =================================================================== +c formation du cf de ''centre'' le sommet nsasup + call trp1st( nsasup, noarst, mosoar, nosoar, + % moartr, noartr, + % mxarcf, nbtrcf, notrcf ) + if( nbtrcf .le. 0 ) then +c erreur: impossible de trouver tous les triangles de sommet nsasup +c le sommet nsasup n'est pas supprime de la triangulation + ierr = -1 + return + else if( nbtrcf .le. 2 ) then +c le sommet nsasup n'est pas supprime + ierr = -1 + return + endif + if( nbtrcf*3 .gt. mxarcf ) then + write(imprim,*) 'saturation du tableau noarcf' + ierr = 10 + return + endif +c +ccc trace des triangles de l'etoile du sommet nsasup +ccc call trpltr( nbtrcf, notrcf, pxyd, +ccc % moartr, noartr, mosoar, nosoar, +ccc % ncroug, ncblan ) +c +c si toutes les aretes du cf sont frontalieres, alors il est +c interdit de detruire le sommet "centre" du cf +c calcul du nombre nbarfr des aretes simples des nbtrcf triangles + call trfrcf( nsasup, mosoar, nosoar, moartr, noartr, + % nbtrcf, notrcf, nbarfr ) + if( nbarfr .ge. nbtrcf ) then +c toutes les aretes simples sont frontalieres +c le sommet nsasup ("centre" de la cavite) n'est pas supprime + ierr = -1 + return + endif +c +c formation du contour ferme (liste chainee des aretes simples) +c forme a partir des aretes des triangles de l'etoile du sommet nsasup + call focftr( nbtrcf, notrcf, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % nbarcf, n1arcf, noarcf, + % ierr ) + if( ierr .ne. 0 ) return +c +c ici le sommet nsasup appartient a aucune arete + noarst( nsasup ) = 0 +c +c chainage des aretes vides dans le tableau noarcf + n1arcf(0) = nbarcf+1 + mmarcf = min(8*nbarcf,mxarcf) + do 40 i=nbarcf+1,mmarcf + noarcf(2,i) = i+1 + 40 continue + noarcf(2,mmarcf) = 0 +c +c sauvegarde du chainage des aretes peripheriques +c pour la mise en delaunay du maillage + nbcf = n1arcf(1) + do 50 i=1,nbarcf +c le numero de l'arete dans le tableau nosoar + liarcf( i ) = noarcf( 3, nbcf ) +c l'arete suivante dans le cf + nbcf = noarcf( 2, nbcf ) + 50 continue +c +c triangulation directe du contour ferme sans le sommet nsasup +c ============================================================ + nbcf = 1 + call tridcf( nbcf, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, + % nbtrcf, notrcf, ierr ) + if( ierr .ne. 0 ) return +c +c transformation des triangles du cf en triangles delaunay +c ======================================================== +c construction du chainage lchain dans nosoar +c des aretes peripheriques du cf a partir de la sauvegarde liarcf + noar0 = liarcf(1) + do 60 i=2,nbarcf +c le numero de l'arete peripherique du cf dans nosoar + noar = liarcf( i ) + if( nosoar(3,noar) .le. 0 ) then +c arete interne => elle est chainee a partir de la precedente + nosoar( lchain, noar0 ) = noar + noar0 = noar + endif + 60 continue +c la derniere arete peripherique n'a pas de suivante + nosoar(lchain,noar0) = 0 +c +c mise en delaunay des aretes chainees + call tedela( pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, liarcf(1), + % moartr, mxartr, n1artr, noartr, modifs ) +ccc write(imprim,*) 'nombre echanges diagonales =',modifs + return + end + + + subroutine tr3str( np, nt, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former les 3 sous-triangles du triangle nt a partir +c ----- du point interne np +c +c entrees: +c -------- +c np : numero dans le tableau pxyd du point +c nt : numero dans le tableau noartr du triangle a trianguler +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c sorties: +c -------- +c nutr : le numero des 3 sous-triangles du triangle nt +c nt : en sortie le triangle initial n'est plus actif dans noartr +c c'est en fait le premier triangle vide de noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + integer nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(3) +c + integer nosotr(3), nu2sar(2), nuarco(3) +c +c reservation des 3 nouveaux triangles dans le tableau noartr +c =========================================================== + do 10 i=1,3 +c le numero du sous-triangle i dans le tableau noartr + if( n1artr .le. 0 ) then +c tableau noartr sature + ierr = 2 + return + endif + nutr(i) = n1artr +c le nouveau premier triangle libre dans noartr + n1artr = noartr(2,n1artr) + 10 continue +c +c les numeros des 3 sommets du triangle nt + call nusotr( nt, mosoar, nosoar, moartr, noartr, nosotr ) +c +c formation des 3 aretes nosotr(i)-np dans le tableau nosoar +c ========================================================== + nt0 = nutr(3) + do 20 i=1,3 +c +c le triangle a creer + nti = nutr(i) +c +c les 2 sommets du cote i du triangle nosotr + nu2sar(1) = nosotr(i) + nu2sar(2) = np + call hasoar( mosoar, mxsoar, n1soar, nosoar, nu2sar, noar ) +c en sortie: noar>0 => no arete retrouvee +c <0 => no arete ajoutee +c =0 => saturation du tableau nosoar +c + if( noar .eq. 0 ) then +c saturation du tableau nosoar + ierr = 1 + return + else if( noar .lt. 0 ) then +c l'arete a ete ajoutee. initialisation des autres informations + noar = -noar +c le numero des 2 sommets a ete initialise par hasoar +c et (nosoar(1,noar) le triangle nt0 + nosoar(4,noar) = nt0 +c le triangle 2 de l'arete noar => le triangle nti + nosoar(5,noar) = nti +c +c le sommet nosotr(i) appartient a l'arete noar + noarst( nosotr(i) ) = noar +c +c le numero d'arete nosotr(i)-np + nuarco(i) = noar +c +c le triangle qui precede le suivant + nt0 = nti + 20 continue +c +c le numero d'une arete du point np + noarst( np ) = noar +c +c les 3 sous-triangles du triangle nt sont formes dans le tableau noartr +c ====================================================================== + do 30 i=1,3 +c +c le numero suivant i => i mod 3 + 1 + if( i .ne. 3 ) then + i1 = i + 1 + else + i1 = 1 + endif +c +c le numero dans noartr du sous-triangle a ajouter + nti = nutr( i ) +c +c le numero de l'arete i du triangle initial nt +c est l'arete 1 du sous-triangle i + noar = noartr(i,nt) + noartr( 1, nti ) = noar +c +c mise a jour du numero de triangle de cette arete + noar = abs( noar ) + if( nosoar(4,noar) .eq. nt ) then +c le sous-triangle nti remplace le triangle nt + nosoar(4,noar) = nti + else +c le sous-triangle nti remplace le triangle nt + nosoar(5,noar) = nti + endif +c +c l'arete 2 du sous-triangle i est l'arete i1 ajoutee + if( nosotr(i1) .eq. nosoar(1,nuarco(i1)) ) then +c l'arete ns i1-np dans nosoar est dans le sens direct + noartr( 2, nti ) = nuarco(i1) + else +c l'arete ns i1-np dans nosoar est dans le sens indirect + noartr( 2, nti ) = -nuarco(i1) + endif +c +c l'arete 3 du sous-triangle i est l'arete i ajoutee + if( nosotr(i) .eq. nosoar(1,nuarco(i)) ) then +c l'arete ns i1-np dans nosoar est dans le sens indirect + noartr( 3, nti ) = -nuarco(i) + else +c l'arete ns i1-np dans nosoar est dans le sens direct + noartr( 3, nti ) = nuarco(i) + endif + 30 continue +c +c le triangle nt est rendu libre +c ============================== +c il devient n1artr le premier triangle libre + noartr( 1, nt ) = 0 + noartr( 2, nt ) = n1artr + n1artr = nt + end + + + subroutine mt4sqa( na, moartr, noartr, mosoar, nosoar, + % ns1, ns2, ns3, ns4) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul du numero des 4 sommets de l'arete na de nosoar +c ----- formant un quadrangle +c +c entrees: +c -------- +c na : numero de l'arete dans nosoar a traiter +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1=0 si triangle vide => arete2=triangle vide suivant +c mosoar : nombre maximal d'entiers par arete +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c +c sorties: +c -------- +c ns1,ns2,ns3 : les 3 numeros des sommets du triangle t1 en sens direct +c ns1,ns4,ns2 : les 3 numeros des sommets du triangle t2 en sens direct +c +c si erreur rencontree => ns4 = 0 +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + common / unites / lecteu, imprim, nunite(30) + integer noartr(moartr,*), nosoar(mosoar,*) +c +c le numero de triangle est il correct ? +c a supprimer apres mise au point + if( na .le. 0 ) then +c nblgrc(nrerr) = 1 +c write(kerr(mxlger)(1:6),'(i6)') na +c kerr(1) = kerr(mxlger)(1:6) // +c % ' no incorrect arete dans nosoar' +c call lereur + write(imprim,*) na, ' no incorrect arete dans nosoar' + ns4 = 0 + return + endif +c + if( nosoar(1,na) .le. 0 ) then +c nblgrc(nrerr) = 1 +c write(kerr(mxlger)(1:6),'(i6)') na +c kerr(1) = kerr(mxlger)(1:6) // +c % ' arete non active dans nosoar' +c call lereur + write(imprim,*) na, ' arete non active dans nosoar' + ns4 = 0 + return + endif +c +c recherche de l'arete na dans le premier triangle + nt = nosoar(4,na) + if( nt .le. 0 ) then +c nblgrc(nrerr) = 1 +c write(kerr(mxlger)(1:6),'(i6)') na +c kerr(1) = 'triangle 1 incorrect pour l''arete ' // +c % kerr(mxlger)(1:6) +c call lereur + write(imprim,*) 'triangle 1 incorrect pour l''arete ', na + ns4 = 0 + return + endif +c + do 5 i=1,3 + if( abs( noartr(i,nt) ) .eq. na ) goto 8 + 5 continue +c si arrivee ici => bogue avant + write(imprim,*) 'mt4sqa: arete',na,' non dans le triangle',nt + ns4 = 0 + return +c +c les 2 sommets de l'arete na + 8 if( noartr(i,nt) .gt. 0 ) then + ns1 = 1 + ns2 = 2 + else + ns1 = 2 + ns2 = 1 + endif + ns1 = nosoar(ns1,na) + ns2 = nosoar(ns2,na) +c +c l'arete suivante + if( i .lt. 3 ) then + i = i + 1 + else + i = 1 + endif + naa = abs( noartr(i,nt) ) +c +c le sommet ns3 du triangle 123 + ns3 = nosoar(1,naa) + if( ns3 .eq. ns1 .or. ns3 .eq. ns2 ) then + ns3 = nosoar(2,naa) + endif +c +c le triangle de l'autre cote de l'arete na +c ========================================= + nt = nosoar(5,na) + if( nt .le. 0 ) then +c nblgrc(nrerr) = 1 +c write(kerr(mxlger)(1:6),'(i6)') na +c kerr(1) = 'triangle 2 incorrect pour l''arete ' // +c % kerr(mxlger)(1:6) +c call lereur + write(imprim,*) 'triangle 2 incorrect pour l''arete ',na + ns4 = 0 + return + endif +c +c le numero de l'arete naa du triangle nt + naa = abs( noartr(1,nt) ) + if( naa .eq. na ) naa = abs( noartr(2,nt) ) + ns4 = nosoar(1,naa) + if( ns4 .eq. ns1 .or. ns4 .eq. ns2 ) then + ns4 = nosoar(2,naa) + endif + end + + + subroutine te2t2t( noaret, mosoar, n1soar, nosoar, noarst, + % moartr, noartr, noar34 ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : echanger la diagonale des 2 triangles ayant en commun +c ----- l'arete noaret du tableau nosoar si c'est possible +c +c entrees: +c -------- +c noaret : numero de l'arete a echanger entre les 2 triangles +c mosoar : nombre maximal d'entiers par arete +c moartr : nombre maximal d'entiers par triangle +c +c modifies : +c ---------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c noarst : noarst(i) numero d'une arete de sommet i +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c sortie : +c -------- +c noar34 : numero nosoar de la nouvelle arete diagonale +c 0 si pas d'echange des aretes diagonales +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc avril 1997 +c....................................................................012 + integer nosoar(mosoar,*), + % noartr(moartr,*), + % noarst(*) +c +c une arete frontaliere ne peut etre echangee + noar34 = 0 + if( nosoar(3,noaret) .gt. 0 ) return +c +c les 4 sommets des 2 triangles ayant l'arete noaret en commun + call mt4sqa( noaret, moartr, noartr, mosoar, nosoar, + % ns1, ns2, ns3, ns4) +c ns1,ns2,ns3 : les 3 numeros des sommets du triangle nt1 en sens direct +c ns1,ns4,ns2 : les 3 numeros des sommets du triangle nt2 en sens direct +c +c recherche du numero de l'arete noaret dans le triangle nt1 + nt1 = nosoar(4,noaret) + do 10 n1 = 1, 3 + if( abs(noartr(n1,nt1)) .eq. noaret ) goto 15 + 10 continue +c impossible d'arriver ici sans bogue! + write(imprim,*) 'pause dans te2t2t 1' + pause +c +c l'arete de sommets 2 et 3 + 15 if( n1 .lt. 3 ) then + n2 = n1 + 1 + else + n2 = 1 + endif + na23 = noartr(n2,nt1) +c +c l'arete de sommets 3 et 1 + if( n2 .lt. 3 ) then + n3 = n2 + 1 + else + n3 = 1 + endif + na31 = noartr(n3,nt1) +c +c recherche du numero de l'arete noaret dans le triangle nt2 + nt2 = nosoar(5,noaret) + do 20 n1 = 1, 3 + if( abs(noartr(n1,nt2)) .eq. noaret ) goto 25 + 20 continue +c impossible d'arriver ici sans bogue! + write(imprim,*) 'pause dans te2t2t 2' + pause +c +c l'arete de sommets 1 et 4 + 25 if( n1 .lt. 3 ) then + n2 = n1 + 1 + else + n2 = 1 + endif + na14 = noartr(n2,nt2) +c +c l'arete de sommets 4 et 2 + if( n2 .lt. 3 ) then + n3 = n2 + 1 + else + n3 = 1 + endif + na42 = noartr(n3,nt2) +c +c les triangles 123 142 deviennent 143 234 +c ======================================== +c ajout de l'arete ns3-ns4 +c on evite l'affichage de l'erreur + ierr = -1 + call fasoar( ns3, ns4, nt1, nt2, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % noar34, ierr ) + if( ierr .gt. 0 ) then +c ierr=1 si le tableau nosoar est sature +c =2 si arete a creer et appartenant a 2 triangles distincts +c des triangles nt1 et nt2 +c =3 si arete appartenant a 2 triangles distincts +c differents des triangles nt1 et nt2 +c =4 si arete appartenant a 2 triangles distincts +c dont le second n'est pas le triangle nt2 +c => pas d'echange + noar34 = 0 + return + endif +c +c suppression de l'arete noaret + call sasoar( noaret, mosoar, mxsoar, n1soar, nosoar ) +c +c nt1 = triangle 143 + noartr(1,nt1) = na14 +c sens de stockage de l'arete ns3-ns4 dans nosoar? + if( nosoar(1,noar34) .eq. ns3 ) then + n1 = -1 + else + n1 = 1 + endif + noartr(2,nt1) = noar34 * n1 + noartr(3,nt1) = na31 +c +c nt2 = triangle 234 + noartr(1,nt2) = na23 + noartr(2,nt2) = -noar34 * n1 + noartr(3,nt2) = na42 +c +c echange nt1 -> nt2 pour l'arete na23 + na23 = abs( na23 ) + if( nosoar(4,na23) .eq. nt1 ) then + n1 = 4 + else + n1 = 5 + endif + nosoar(n1,na23) = nt2 +c +c echange nt2 -> nt1 pour l'arete na14 + na14 = abs( na14 ) + if( nosoar(4,na14) .eq. nt2 ) then + n1 = 4 + else + n1 = 5 + endif + nosoar(n1,na14) = nt1 +c +c numero d'une arete de chacun des 4 sommets + noarst(ns1) = na14 + noarst(ns2) = na23 + noarst(ns3) = noar34 + noarst(ns4) = noar34 + end + + + + subroutine f0trte( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former le ou les triangles du triangle equilateral letree +c ----- les points internes au te deviennent des sommets des +c sous-triangles du te +c +c entrees: +c -------- +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c si letree(0)>0 alors +c letree(0:3) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( le te est une feuille de l'arbre ) +c letree(4) : no letree du sur-triangle du triangle j +c letree(5) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8) : no pxyd des 3 sommets du triangle j +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c sorties: +c -------- +c nbtr : nombre de sous-triangles du te, triangulation du te +c nutr : numero des nbtr sous-triangles du te dans le tableau noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes au te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer letree(0:8), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(1:nbtr) + integer nuarco(3) +c +c le numero nt du triangle dans le tableau noartr + if( n1artr .le. 0 ) then +c tableau noartr sature + write(imprim,*) 'f0trte: tableau noartr sature' + ierr = 2 + return + endif + nt = n1artr +c le numero du nouveau premier triangle libre dans noartr + n1artr = noartr( 2, n1artr ) +c +c formation du triangle = le triangle equilateral letree + do 10 i=1,3 + if( i .ne. 3 ) then + i1 = i + 1 + else + i1 = 1 + endif +c ajout eventuel de l'arete si si+1 dans le tableau nosoar + call fasoar( letree(5+i), letree(5+i1), nt, -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(i), ierr ) + if( ierr .ne. 0 ) return + 10 continue +c +c le triangle nt est forme dans le tableau noartr + do 20 i=1,3 +c letree(5+i) est le numero du sommet 1 de l'arete i du te + if( letree(5+i) .eq. nosoar(1,nuarco(i)) ) then + lesign = 1 + else + lesign = -1 + endif +c l'arete ns1-ns2 dans nosoar est celle du cote du te + noartr( i, nt ) = lesign * nuarco(i) + 20 continue +c +c triangulation du te=triangle nt par ajout des points internes du te + nbtr = 1 + nutr(1) = nt + call trpite( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % nbtr, nutr, ierr ) + end + + + subroutine f1trte( letree, pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former les triangles du triangle equilateral letree +c ----- a partir de l'un des 3 milieux des cotes du te +c et des points internes au te +c ils deviennent tous des sommets des sous-triangles du te +c +c entrees: +c -------- +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c si letree(0)>0 alors +c letree(0:3) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( le te est une feuille de l'arbre ) +c letree(4) : no letree du sur-triangle du triangle j +c letree(5) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8) : no pxyd des 3 sommets du triangle j +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c milieu : milieu(i) numero dans pxyd du milieu de l'arete i du te +c 0 si pas de milieu du cote i a ajouter +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(np) numero d'une arete du sommet np +c +c sorties: +c -------- +c nbtr : nombre de sous-triangles du te, triangulation du te +c nutr : numero des nbtr sous-triangles du te dans le tableau noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes au te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + double precision pxyd(3,*) + integer letree(0:8), + % milieu(3), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(1:nbtr) +c + integer nosotr(3), nuarco(5) +c +c le numero des 2 triangles (=2 demi te) a creer dans le tableau noartr + do 5 nbtr=1,2 + if( n1artr .le. 0 ) then +c tableau noartr sature + ierr = 2 + return + endif + nutr(nbtr) = n1artr +c le nouveau premier triangle libre dans noartr + n1artr = noartr(2,n1artr) + 5 continue + nbtr = 2 +c +c recherche du milieu a creer + do 7 i=1,3 + if( milieu(i) .ne. 0 ) goto 9 + 7 continue +c le numero pxyd du point milieu du cote i + 9 nm = milieu( i ) +c +c on se ramene au seul cas i=3 c-a-d le milieu est sur le cote 3 + if( i .eq. 1 ) then +c milieu sur le cote 1 + nosotr(1) = letree(7) + nosotr(2) = letree(8) + nosotr(3) = letree(6) + else if( i .eq. 2 ) then +c milieu sur le cote 2 + nosotr(1) = letree(8) + nosotr(2) = letree(6) + nosotr(3) = letree(7) + else +c milieu sur le cote 3 + nosotr(1) = letree(6) + nosotr(2) = letree(7) + nosotr(3) = letree(8) + endif +c +c formation des 2 aretes s1 s2 et s2 s3 + do 10 i=1,2 + if( i .ne. 3 ) then + i1 = i + 1 + else + i1 = 1 + endif +c ajout eventuel de l'arete dans nosoar + call fasoar( nosotr(i), nosotr(i1), nutr(i), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(i), ierr ) + if( ierr .ne. 0 ) return + 10 continue +c +c ajout eventuel de l'arete s3 milieu dans nosoar + call fasoar( nosotr(3), nm, nutr(2), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(3), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete milieu s1 dans nosoar + call fasoar( nosotr(1), nm, nutr(1), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(4), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete milieu s2 dans nosoar + call fasoar( nosotr(2), nm, nutr(1), nutr(2), 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(5), ierr ) + if( ierr .ne. 0 ) return +c +c les aretes s1 s2 et s2 s3 dans le tableau noartr + do 20 i=1,2 +c nosotr(i) est le numero du sommet 1 de l'arete i du te + if( nosotr(i) .eq. nosoar(1,nuarco(i)) ) then + lesign = 1 + else + lesign = -1 + endif +c l'arete ns1-ns2 dans nosoar est celle du cote du te + noartr( 1, nutr(i) ) = lesign * nuarco(i) + 20 continue +c +c l'arete mediane s2 milieu + if( nm .eq. nosoar(1,nuarco(5)) ) then + lesign = -1 + else + lesign = 1 + endif + noartr( 2, nutr(1) ) = lesign * nuarco(5) + noartr( 3, nutr(2) ) = -lesign * nuarco(5) +c +c l'arete s1 milieu + if( nm .eq. nosoar(1,nuarco(4)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 3, nutr(1) ) = lesign * nuarco(4) +c +c l'arete s3 milieu + if( nm .eq. nosoar(1,nuarco(3)) ) then + lesign = -1 + else + lesign = 1 + endif + noartr( 2, nutr(2) ) = lesign * nuarco(3) +c +c triangulation des 2 demi te par ajout des points internes du te + call trpite( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % nbtr, nutr, ierr ) + end + + + subroutine f2trte( letree, pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former les triangles du triangle equilateral letree +c ----- a partir de 2 milieux des cotes du te +c et des points internes au te +c ils deviennent tous des sommets des sous-triangles du te +c +c entrees: +c -------- +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c si letree(0)>0 alors +c letree(0:3) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( le te est une feuille de l'arbre ) +c letree(4) : no letree du sur-triangle du triangle j +c letree(5) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8) : no pxyd des 3 sommets du triangle j +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c milieu : milieu(i) numero dans pxyd du milieu de l'arete i du te +c 0 si pas de milieu du cote i a ajouter +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(np) numero d'une arete du sommet np +c +c sorties: +c -------- +c nbtr : nombre de sous-triangles du te, triangulation du te +c nutr : numero des nbtr sous-triangles du te dans le tableau noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes au te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer letree(0:8), + % milieu(3), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(1:nbtr) +c + integer nosotr(3), nuarco(7) +c +c le numero des 3 triangles a creer dans le tableau noartr + do 5 nbtr=1,3 + if( n1artr .le. 0 ) then +c tableau noartr sature + ierr = 2 + return + endif + nutr(nbtr) = n1artr +c le nouveau premier triangle libre dans noartr + n1artr = noartr(2,n1artr) + 5 continue + nbtr = 3 +c +c recherche du premier milieu a creer + do 7 i=1,3 + if( milieu(i) .ne. 0 ) goto 9 + 7 continue +c +c on se ramene au seul cas i=2 c-a-d le cote 1 n'a pas de milieu + 9 if( i .eq. 2 ) then +c pas de milieu sur le cote 1 + nosotr(1) = letree(6) + nosotr(2) = letree(7) + nosotr(3) = letree(8) +c le numero pxyd du milieu du cote 2 + nm2 = milieu( 2 ) +c le numero pxyd du milieu du cote 3 + nm3 = milieu( 3 ) + else if( milieu(2) .ne. 0 ) then +c pas de milieu sur le cote 3 + nosotr(1) = letree(8) + nosotr(2) = letree(6) + nosotr(3) = letree(7) +c le numero pxyd du milieu du cote 2 + nm2 = milieu( 1 ) +c le numero pxyd du milieu du cote 3 + nm3 = milieu( 2 ) + else +c pas de milieu sur le cote 2 + nosotr(1) = letree(7) + nosotr(2) = letree(8) + nosotr(3) = letree(6) +c le numero pxyd du milieu du cote 2 + nm2 = milieu( 3 ) +c le numero pxyd du milieu du cote 3 + nm3 = milieu( 1 ) + endif +c +c ici seul le cote 1 n'a pas de milieu +c nm2 est le milieu du cote 2 +c nm3 est le milieu du cote 3 +c +c ajout eventuel de l'arete s1 s2 dans nosoar + call fasoar( nosotr(1), nosotr(2), nutr(1), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(1), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete s1 s2 dans nosoar + call fasoar( nosotr(2), nm2, nutr(1), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(2), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete s1 nm2 dans nosoar + call fasoar( nosotr(1), nm2, nutr(1), nutr(2), 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(3), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete nm2 nm3 dans nosoar + call fasoar( nm3, nm2, nutr(2), nutr(3), 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(4), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete s1 nm3 dans nosoar + call fasoar( nosotr(1), nm3, nutr(2), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(5), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete nm2 s3 dans nosoar + call fasoar( nm2, nosotr(3), nutr(3), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(6), ierr ) +c +c ajout eventuel de l'arete nm3 s3 dans nosoar + call fasoar( nosotr(3), nm3, nutr(3), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(7), ierr ) + if( ierr .ne. 0 ) return +c +c le triangle s1 s2 nm2 ou arete1 arete2 arete3 + do 20 i=1,2 +c nosotr(i) est le numero du sommet 1 de l'arete i du te + if( nosotr(i) .eq. nosoar(1,nuarco(i)) ) then + lesign = 1 + else + lesign = -1 + endif +c l'arete ns1-ns2 dans nosoar est celle du cote du te + noartr( i, nutr(1) ) = lesign * nuarco(i) + 20 continue + if( nm2 .eq. nosoar(1,nuarco(3)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 3, nutr(1) ) = lesign * nuarco(3) +c +c le triangle s1 nm2 nm3 + noartr( 1, nutr(2) ) = -lesign * nuarco(3) + if( nm2 .eq. nosoar(1,nuarco(4)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 2, nutr(2) ) = lesign * nuarco(4) + noartr( 1, nutr(3) ) = -lesign * nuarco(4) + if( nm3 .eq. nosoar(1,nuarco(5)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 3, nutr(2) ) = lesign * nuarco(5) +c +c le triangle nm2 nm3 s3 + if( nm2 .eq. nosoar(1,nuarco(6)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 2, nutr(3) ) = lesign * nuarco(6) + if( nm3 .eq. nosoar(1,nuarco(7)) ) then + lesign = -1 + else + lesign = 1 + endif + noartr( 3, nutr(3) ) = lesign * nuarco(7) +c +c triangulation des 3 sous-te par ajout des points internes du te + call trpite( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % nbtr, nutr, ierr ) + end + + + subroutine f3trte( letree, pxyd, milieu, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former les triangles du triangle equilateral letree +c ----- a partir de 3 milieux des cotes du te +c et des points internes au te +c ils deviennent tous des sommets des sous-triangles du te +c +c entrees: +c -------- +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c si letree(0)>0 alors +c letree(0:3) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( le te est une feuille de l'arbre ) +c letree(4) : no letree du sur-triangle du triangle j +c letree(5) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8) : no pxyd des 3 sommets du triangle j +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c milieu : milieu(i) numero dans pxyd du milieu de l'arete i du te +c 0 si pas de milieu du cote i a ajouter +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(np) numero d'une arete du sommet np +c +c sorties: +c -------- +c nbtr : nombre de sous-triangles du te, triangulation du te +c nutr : numero des nbtr sous-triangles du te dans le tableau noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes au te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer letree(0:8), + % milieu(3), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(1:nbtr) +c + integer nuarco(9) +c +c le numero des 4 triangles a creer dans le tableau noartr + do 5 nbtr=1,4 + if( n1artr .le. 0 ) then +c tableau noartr sature + ierr = 2 + return + endif + nutr(nbtr) = n1artr +c le nouveau premier triangle libre dans noartr + n1artr = noartr(2,n1artr) + 5 continue + nbtr = 4 +c + do 10 i=1,3 +c le sommet suivant + if( i .ne. 3 ) then + i1 = i + 1 + else + i1 = 1 + endif +c le sommet precedant + if( i .ne. 1 ) then + i0 = i - 1 + else + i0 = 3 + endif + i3 = 3 * i +c +c ajout eventuel de l'arete si mi dans nosoar + call fasoar( letree(5+i), milieu(i), nutr(i), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(i3-2), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete mi mi-1 dans nosoar + call fasoar( milieu(i), milieu(i0), nutr(i), nutr(4), 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(i3-1), ierr ) + if( ierr .ne. 0 ) return +c +c ajout eventuel de l'arete m i-1 si dans nosoar + call fasoar( milieu(i0), letree(5+i), nutr(i), -1, 0, + % mosoar, mxsoar, n1soar, nosoar, noarst, + % nuarco(i3), ierr ) + if( ierr .ne. 0 ) return +c + 10 continue +c +c les 3 sous-triangles pres des sommets + do 20 i=1,3 +c le sommet suivant + if( i .ne. 3 ) then + i1 = i + 1 + else + i1 = 1 + endif +c le sommet precedant + if( i .ne. 1 ) then + i0 = i - 1 + else + i0 = 3 + endif + i3 = 3 * i +c +c ajout du triangle arete3i-2 arete3i-1 arete3i + if( letree(5+i) .eq. nosoar(1,nuarco(i3-2)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 1, nutr(i) ) = lesign * nuarco(i3-2) +c + if( milieu(i) .eq. nosoar(1,nuarco(i3-1)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 2, nutr(i) ) = lesign * nuarco(i3-1) +c + if( milieu(i0) .eq. nosoar(1,nuarco(i3)) ) then + lesign = 1 + else + lesign = -1 + endif + noartr( 3, nutr(i) ) = lesign * nuarco(i3) +c + 20 continue +c +c le sous triangle central + i3 = -1 + do 30 i=1,3 + i3 = i3 + 3 + if( milieu(i) .eq. nosoar(1,nuarco(i3)) ) then + lesign = -1 + else + lesign = 1 + endif + noartr( i, nutr(4) ) = lesign * nuarco(i3) + 30 continue +c +c triangulation des 3 sous-te par ajout des points internes du te + call trpite( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, noarst, + % nbtr, nutr, ierr ) + end + + + + subroutine hasoar( mosoar, mxsoar, n1soar, nosoar, nu2sar, + % noar ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : rechercher le numero des 2 sommets d'une arete parmi +c ----- les numeros des 2 sommets des aretes du tableau nosoar +c s ils n y sont pas stockes les y ajouter +c dans tous les cas retourner le numero de l'arete dans nosoar +c +c la methode employee ici est celle du hachage +c avec pour fonction d'adressage h(ns1,ns2)=min(ns1,ns2) +c +c remarque: h(ns1,ns2)=ns1 + 2*ns2 +c ne marche pas si des aretes sont detruites +c et ajoutees aux aretes vides +c le chainage est commun a plusieurs hachages! +c d'ou ce choix du minimum pour le hachage +c +c entrees: +c -------- +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c chainage des aretes vides amont et aval +c l'arete vide qui precede=nosoar(4,i) +c l'arete vide qui suit =nosoar(5,i) +c nosoar : numero des 2 sommets, no ligne, 2 triangles de l'arete, +c chainage momentan'e d'aretes, chainage du hachage des aretes +c hachage des aretes = min( nosoar(1), nosoar(2) ) +c nu2sar : en entree les 2 numeros des sommets de l'arete +c en sortie nu2sar(1)0 si le tableau nu2sar est l'arete noar retrouvee +c dans le tableau nosoar +c <0 si le tableau nu2sar a ete ajoute et forme l'arete +c -noar du tableau nosoar avec nosoar(1,noar) elle devient la nouvelle arete +c retouche des chainages de cette arete noar qui ne sera plus vide + noar = nu2sar(1) +c l'eventuel chainage du hachage n'est pas modifie +c + else +c +c la premiere arete dans l'adressage du hachage n'est pas libre +c => choix quelconque d'une arete vide pour ajouter cette arete + if( n1soar .le. 0 ) then +c +c le tableau nosoar est sature avec pour temoin d'erreur + noar = 0 + return +c + else +c +c l'arete n1soar est vide => c'est la nouvelle arete +c mise a jour du chainage de la derniere arete noar du chainage +c sa suivante est la nouvelle arete n1soar + nosoar( mosoar, noar ) = n1soar +c +c l'arete ajoutee est n1soar + noar = n1soar +c +c la nouvelle premiere arete vide + n1soar = nosoar( 5, n1soar ) +c +c la premiere arete vide n1soar n'a pas d'arete vide precedente + nosoar( 4, n1soar ) = 0 +c +c noar la nouvelle arete est la derniere du chainage du hachage + nosoar( mosoar, noar ) = 0 +c + endif +c + endif +c +c les 2 sommets de la nouvelle arete noar + nosoar( 1, noar ) = nu2sar(1) + nosoar( 2, noar ) = nu2sar(2) +c +c le tableau nu2sar a ete ajoute avec l'indice -noar + noar = - noar + end + + + subroutine mt3str( nt, moartr, noartr, mosoar, nosoar, + % ns1, ns2, ns3 ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : calcul du numero des 3 sommets du triangle nt du tableau noartr +c ----- +c +c entrees: +c -------- +c nt : numero du triangle de noartr a traiter +c moartr : nombre maximal d'entiers par triangle +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1=0 si triangle vide => arete2=triangle vide suivant +c mosoar : nombre maximal d'entiers par arete +c nosoar : numero des 2 sommets , no ligne, 2 triangles, chainages en + +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c +c sorties: +c -------- +c ns1,ns2,ns3 : les 3 numeros des sommets du triangle en sens direct +c +c si erreur rencontree => ns1 = 0 +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juillet 1995 +c2345x7..............................................................012 + integer noartr(moartr,*), nosoar(mosoar,*) +c +c le numero de triangle est il correct ? +c a supprimer apres mise au point + if( nt .le. 0 ) then +c nblgrc(nrerr) = 1 +c write(kerr(mxlger)(1:6),'(i6)') nt +c kerr(1) = kerr(mxlger)(1:6) // +c % ' no triangle dans noartr incorrect' +c call lereur + write(imprim,*) nt,' no triangle dans noartr incorrect' + ns1 = 0 + return + endif +c + na = noartr(1,nt) + if( na .gt. 0 ) then +c arete dans le sens direct + ns1 = nosoar(1,na) + ns2 = nosoar(2,na) + else +c arete dans le sens indirect + ns1 = nosoar(2,-na) + ns2 = nosoar(1,-na) + endif +c + na = noartr(2,nt) + if( na .gt. 0 ) then +c arete dans le sens direct => ns3 est le second sommet de l'arete + ns3 = nosoar(2,na) + else +c arete dans le sens indirect => ns3 est le premier sommet de l'arete + ns3 = nosoar(1,-na) + endif + end + subroutine trpite( letree, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nbtr, nutr, ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former le ou les sous-triangles des nbtr triangles nutr +c ----- qui forment le triangle equilateral letree par ajout +c des points internes au te qui deviennent des sommets des +c sous-triangles des nbtr triangles +c +c entrees: +c -------- +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0:3):-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( le te est ici une feuille de l'arbre ) +c letree(4) : no letree du sur-triangle du triangle j +c letree(5) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8) : no pxyd des 3 sommets du triangle j +c pxyd : tableau des x y distance_souhaitee de chaque sommet +c mosoar : nombre maximal d'entiers par arete du tableau nosoar +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c moartr : nombre maximal d'entiers par arete du tableau noartr +c mxartr : nombre maximal de triangles stockables dans le tableau noartr +c +c modifies: +c --------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = (nosoar(1)+nosoar(2)) modulo mxsoar +c sommet 1 = 0 si arete vide => sommet 2 = arete vide suivante +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c sorties: +c -------- +c nbtr : nombre de sous-triangles du te +c nutr : numero des nbtr sous-triangles du te dans le tableau noartr +c ierr : =0 si pas d'erreur +c =1 si le tableau nosoar est sature +c =2 si le tableau noartr est sature +c =3 si aucun des triangles ne contient l'un des points internes au te +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + logical tratri + common / dv2dco / tratri +c trace ou non des triangles generes dans la triangulation + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer letree(0:8), + % nosoar(mosoar,mxsoar), + % noartr(moartr,mxartr), + % noarst(*), + % nutr(1:nbtr) +c + integer nosotr(3) +c +c si pas de point interne alors trace eventuel puis retour + if( letree(0) .eq. 0 ) goto 150 +c +c il existe au moins un point interne a trianguler +c dans les nbtr triangles + do 100 k=0,3 +c +c le numero du point + np = -letree(k) + if( np .eq. 0 ) goto 150 +c +c le point np dans pxyd est a traiter + do 10 n = 1, nbtr +c +c les numeros des 3 sommets du triangle nt=nutr(n) + nt = nutr(n) + call nusotr( nt, mosoar, nosoar, moartr, noartr, nosotr ) +c +c le triangle nt contient il le point np? + call ptdatr( pxyd(1,np), pxyd, nosotr, nsigne ) +c nsigne>0 si le point est dans le triangle ou sur une des 3 aretes +c =0 si triangle degenere ou indirect ou ne contient pas le poin +c + if( nsigne .gt. 0 ) then +c +c le triangle nt est triangule en 3 sous-triangles + call tr3str( np, nt, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, mxartr, n1artr, noartr, + % noarst, + % nutr(nbtr+1), ierr ) + if( ierr .ne. 0 ) return +c +c reamenagement des 3 triangles crees dans nutr +c en supprimant le triangle nt + nutr( n ) = nutr( nbtr + 3 ) + nbtr = nbtr + 2 +c le point np est triangule + goto 100 +c + endif + 10 continue +c +c erreur: le point np n'est pas dans l'un des nbtr triangles + write(imprim,10010) np + pause + ierr = 3 + return +c + 100 continue +10010 format(' erreur trpite: pas de triangle contenant le point',i7) +c + 150 continue + +ccc 150 if( tratri ) then +cccc les traces sont demandes +ccc call efface +cccc le cadre objet global en unites utilisateur +ccc xx1 = min(pxyd(1,nosotr(1)),pxyd(1,nosotr(2)),pxyd(1,nosotr(3))) +ccc xx2 = max(pxyd(1,nosotr(1)),pxyd(1,nosotr(2)),pxyd(1,nosotr(3))) +ccc yy1 = min(pxyd(2,nosotr(1)),pxyd(2,nosotr(2)),pxyd(2,nosotr(3))) +ccc yy2 = max(pxyd(2,nosotr(1)),pxyd(2,nosotr(2)),pxyd(2,nosotr(3))) +ccc if( xx1 .ge. xx2 ) xx2 = xx1 + (yy2-yy1) +ccc if( yy1 .ge. yy2 ) yy2 = yy1 + (xx2-xx1)*0.5 +ccc call isofenetre( xx1-(xx2-xx1), xx2+(xx2-xx1), +ccc % yy1-(yy2-yy1), yy2+(yy2-yy1) ) +ccc do 200 i=1,nbtr +cccc trace du triangle nutr(i) +ccc call mttrtr( pxyd, nutr(i), moartr, noartr, mosoar, nosoar, +ccc % i, ncblan ) +ccc 200 continue +ccc endif + + end + + + subroutine sasoar( noar, mosoar, mxsoar, n1soar, nosoar ) +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : supprimer l'arete noar du tableau nosoar +c ----- si celle ci n'est pas une arete des lignes de la frontiere +c +c la methode employee ici est celle du hachage +c avec pour fonction d'adressage h = min( nu2sar(1), nu2sar(2) ) +c +c attention: il faut mettre a jour le no d'arete des 2 sommets +c de l'arete supprimee dans le tableau noarst! +c +c entrees: +c -------- +c noar : numero de l'arete de nosoar a supprimer +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage h +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c +c modifies: +c --------- +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(4,arete vide)=l'arete vide qui precede +c nosoar(5,arete vide)=l'arete vide qui suit +c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique upmc paris mars 1997 +c ...................................................................012 + common / unites / lecteu, imprim, nunite(30) + integer nosoar(mosoar,mxsoar) +c + if( nosoar(3,noar) .le. 0 ) then +c +c l'arete n'est pas frontaliere => elle devient une arete vide +c +c recherche de l'arete qui precede dans le chainage du hachage + noar1 = nosoar(1,noar) +c +c parcours du chainage du hachage jusqu'a retrouver l'arete noar + 10 if( noar1 .ne. noar ) then +c +c l'arete suivante parmi celles ayant meme fonction d'adressage + noar0 = noar1 + noar1 = nosoar( mosoar, noar1 ) + if( noar1 .gt. 0 ) goto 10 +c +c l'arete noar n'a pas ete retrouvee dans le chainage => erreur + write(imprim,*) 'erreur sasoar:arete non dans le chainage ' + % ,noar + write(imprim,*) 'arete de st1=',nosoar(1,noar), + % ' st2=',nosoar(2,noar),' ligne=',nosoar(3,noar), + % ' tr1=',nosoar(4,noar),' tr2=',nosoar(5,noar) + write(imprim,*) 'chainages=',(nosoar(i,noar),i=6,mosoar) + pause +c l'arete n'est pas detruite + return +c + endif +c + if( noar .ne. nosoar(1,noar) ) then +c +c saut de l'arete noar dans le chainage du hachage +c noar0 initialisee est ici l'arete qui precede noar dans ce chainage + nosoar( mosoar, noar0 ) = nosoar( mosoar, noar ) +c +c le chainage du hachage n'existe plus pour noar +c pas utile car mise a zero faite dans le sp hasoar +ccc nosoar( mosoar, noar ) = 0 +c +c noar devient la nouvelle premiere arete du chainage des vides + nosoar( 4, noar ) = 0 + nosoar( 5, noar ) = n1soar +c la nouvelle precede l'ancienne premiere + nosoar( 4, n1soar ) = noar + n1soar = noar +c +ccc else +c +c noar est la premiere arete du chainage du hachage h +c cette arete ne peut etre consideree dans le chainage des vides +c car le chainage du hachage doit etre conserve (sinon perte...) +c + endif +c +c le temoin d'arete vide + nosoar( 1, noar ) = 0 + endif + end + + + subroutine caetoi( noar, mosoar, mxsoar, n1soar, nosoar, + % n1aeoc, nbtrar ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : ajouter (ou retirer) l'arete noar de nosoar de l'etoile +c ----- des aretes simples chainees en position lchain de nosoar +c detruire du tableau nosoar les aretes doubles +c +c attention: le chainage lchain de nosoar devient celui des cf +c +c entree : +c -------- +c noar : numero dans le tableau nosoar de l'arete a traiter +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c +c entrees et sorties: +c ------------------- +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c n1aeoc : numero dans nosoar de la premiere arete simple de l'etoile +c +c sortie : +c -------- +c nbtrar : 1 si arete ajoutee, 2 si arete double supprimee +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c2345x7..............................................................012 + parameter (lchain=6) + integer nosoar(mosoar,mxsoar) +c +c si l'arete n'appartient pas aux aretes de l'etoile naetoi +c alors elle est ajoutee a l'etoile dans naetoi +c sinon elle est empilee dans npile pour etre detruite ensuite +c elle est supprimee de l'etoile naetoi +c + if( nosoar( lchain, noar ) .lt. 0 ) then +c +c arete de l'etoile vue pour la premiere fois +c elle est ajoutee au chainage + nosoar( lchain, noar ) = n1aeoc +c elle devient la premiere du chainage + n1aeoc = noar +c arete simple + nbtrar = 1 +c + else +c +c arete double de l'etoile. elle est supprimee du chainage + na0 = 0 + na = n1aeoc +c parcours des aretes chainees jusqu'a trouver l'arete noar + 10 if( na .ne. noar ) then +c passage a la suivante + na0 = na + na = nosoar( lchain, na ) + goto 10 + endif +c +c suppression de noar du chainage des aretes simples de l'etoile + if( na0 .gt. 0 ) then +c il existe une arete qui precede + nosoar( lchain, na0 ) = nosoar( lchain, noar ) + else +c noar est en fait n1aeoc la premiere du chainage + n1aeoc = nosoar( lchain, noar ) + endif +c noar n'est plus une arete simple de l'etoile + nosoar( lchain, noar ) = -1 +c +c destruction du tableau nosoar de l'arete double noar + call sasoar( noar, mosoar, mxsoar, n1soar, nosoar ) +c +c arete double + nbtrar = 2 + endif + end + + + subroutine focftr( nbtrcf, notrcf, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % nbarcf, n1arcf, noarcf, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : former un contour ferme (cf) avec les aretes simples des +c ----- nbtrcf triangles du tableau notrcf +c destruction des nbtrcf triangles du tableau noartr +c destruction des aretes doubles du tableau nosoar +c +c attention: le chainage lchain de nosoar devient celui des cf +c +c entrees: +c -------- +c nbtrcf : nombre de triangles du cf a former +c notrcf : numero des triangles dans le tableau noartr +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c +c entrees et sorties : +c -------------------- +c noarst : noarst(i) numero d'une arete de sommet i +c n1soar : numero de la premiere arete vide dans le tableau nosoar +c une arete i de nosoar est vide <=> nosoar(1,i)=0 +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c +c sorties: +c -------- +c nbarcf : nombre d'aretes du cf +c n1arcf : numero d'une arete de chaque contour +c noarcf : numero des aretes de la ligne du contour ferme +c attention: chainage circulaire des aretes +c les aretes vides pointes par n1arcf(0) ne sont pas chainees +c ierr : 0 si pas d'erreur +c 14 si les lignes fermees se coupent => donnees a revoir +c 15 si une seule arete simple frontaliere +c 16 si boucle infinie car toutes les aretes simples +c de la boule sont frontalieres! +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter (lchain=6) + common / unites / lecteu, imprim, nunite(30) + double precision pxyd(3,*) + integer notrcf(1:nbtrcf) + integer nosoar(mosoar,mxsoar), + % noartr(moartr,*), + % n1arcf(0:*), + % noarcf(3,*), + % noarst(*) +c +c formation des aretes simples du cf autour de l'arete ns1-ns2 +c attention: le chainage lchain du tableau nosoar devient actif +c ============================================================ +c ici toutes les aretes du tableau nosoar verifient nosoar(lchain,i) = -1 +c ce qui equivaut a dire que l'etoile des aretes simples est vide +c (initialisation dans le sp insoar puis remise a -1 dans la suite!) + n1aeoc = 0 +c +c ajout a l'etoile des aretes simples des 3 aretes des triangles a supprimer +c suppression des triangles de l'etoile pour les aretes simples de l'etoile + do 10 i=1,nbtrcf +c ajout ou retrait des 3 aretes du triangle notrcf(i) de l'etoile + nt = notrcf( i ) + do 5 j=1,3 +c l'arete de nosoar a traiter + noar = abs( noartr(j,nt) ) + call caetoi( noar, mosoar, mxsoar, n1soar, nosoar, + % n1aeoc, nbtrar ) +c si arete simple alors suppression du numero de triangle pour cette a + if( nbtrar .eq. 1 ) then + if( nosoar(4,noar) .eq. nt ) then + nosoar(4,noar) = nosoar(5,noar) + endif + nosoar(5,noar) = -1 +c else +c l'arete appartient a aucun triangle => elle est vide +c les positions 4 et 5 servent maintenant aux chainages des vides + endif + 5 continue + 10 continue +c +c les aretes simples de l'etoile sont reordonnees pour former une +c ligne fermee = un contour ferme peripherique de l'etoile encore dit 1 cf +c ======================================================================== + n1ae00 = n1aeoc + 12 na1 = n1aeoc +c la premiere arete du contour ferme + ns0 = nosoar(1,na1) + ns1 = nosoar(2,na1) +c +c l'arete est-elle dans le sens direct? +c recherche de l'arete du triangle exterieur nt d'arete na1 + nt = nosoar(4,na1) + if( nt .le. 0 ) nt = nosoar(5,na1) +c +c attention au cas de l'arete initiale frontaliere de no de triangles 0 et - + if( nt .le. 0 ) then +c permutation circulaire des aretes simples chainees +c la premiere arete doit devenir la derniere du chainage, +c la 2=>1, la 3=>2, ... , la derniere=>l'avant derniere, 1=>derniere + n1aeoc = nosoar( lchain, n1aeoc ) + if( n1aeoc .eq. n1ae00 ) then +c attention: boucle infinie si toutes les aretes simples +c de la boule sont frontalieres!... arretee par ce test + ierr = 16 + return + endif + noar = n1aeoc + na0 = 0 + 14 if( noar .gt. 0 ) then +c la sauvegarde de l'arete et l'arete suivante + na0 = noar + noar = nosoar(lchain,noar) + goto 14 + endif + if( na0 .le. 0 ) then +c une seule arete simple frontaliere + ierr = 15 + return + endif +c le suivant de l'ancien dernier est l'ancien premier + nosoar(lchain,na0) = na1 +c le nouveau dernier est l'ancien premier + nosoar(lchain,na1) = 0 + goto 12 + endif +c +c ici l'arete na1 est l'une des aretes du triangle nt + do 15 i=1,3 + if( abs(noartr(i,nt)) .eq. na1 ) then +c c'est l'arete + if( noartr(i,nt) .gt. 0 ) then +c elle est parcourue dans le sens indirect de l'etoile +c (car c'est en fait le triangle exterieur a la boule) + ns0 = nosoar(2,na1) + ns1 = nosoar(1,na1) + endif + goto 17 + endif + 15 continue +c +c le 1-er sommet ou arete du contour ferme + 17 n1arcf( 1 ) = 1 +c le nombre de sommets du contour ferme de l'etoile + nbarcf = 1 +c le premier sommet de l'etoile + noarcf( 1, nbarcf ) = ns0 +c l'arete suivante du cf + noarcf( 2, nbarcf ) = nbarcf + 1 +c le numero de cette arete dans le tableau nosoar + noarcf( 3, nbarcf ) = na1 +c mise a jour du numero d'arete du sommet ns0 + noarst(ns0) = na1 +c +cccc trace de l'arete +ccc call dvtrar( pxyd, ns0, ns1, ncvert, ncblan ) +c +c l'arete suivante a chainer + n1aeoc = nosoar( lchain, na1 ) +c l'arete na1 n'est plus dans l'etoile + nosoar( lchain, na1 ) = -1 +c +c boucle sur les aretes simples de l'etoile + 20 if( n1aeoc .gt. 0 ) then +c +c recherche de l'arete de 1-er sommet ns1 + na0 = -1 + na1 = n1aeoc + 25 if( na1 .gt. 0 ) then +c +c le numero du dernier sommet de l'arete precedente +c est il l'un des 2 sommets de l'arete na1? + if ( ns1 .eq. nosoar(1,na1) ) then +c l'autre sommet de l'arete na1 + ns2 = nosoar(2,na1) + else if( ns1 .eq. nosoar(2,na1) ) then +c l'autre sommet de l'arete na1 + ns2 = nosoar(1,na1) + else +c non: passage a l'arete suivante + na0 = na1 + na1 = nosoar( lchain, na1 ) + goto 25 + endif +c +c oui: na1 est l'arete peripherique suivante +c na0 est sa precedente dans le chainage +c une arete de plus dans le contour ferme (cf) + nbarcf = nbarcf + 1 +c le premier sommet de l'arete nbarcf peripherique + noarcf( 1, nbarcf ) = ns1 +c l'arete suivante du cf + noarcf( 2, nbarcf ) = nbarcf + 1 +c le numero de cette arete dans le tableau nosoar + noarcf( 3, nbarcf ) = na1 +c mise a jour du numero d'arete du sommet ns1 + noarst(ns1) = na1 +c +cccc trace de l'arete +ccc call dvtrar( pxyd, ns1, ns2, ncvert, ncblan ) +c +c suppression de l'arete des aretes simples de l'etoile + if( n1aeoc .eq. na1 ) then + n1aeoc = nosoar( lchain, na1 ) + else + nosoar( lchain, na0 ) = nosoar( lchain, na1 ) + endif +c l'arete n'est plus une arete simple de l'etoile + nosoar( lchain, na1 ) = -1 +c +c le sommet final de l'arete a rechercher ensuite + ns1 = ns2 + goto 20 + endif + endif +c +c verification + if( ns1 .ne. ns0 ) then +c arete non retrouvee : l'etoile ne se referme pas +c nblgrc(nrerr) = 3 +c kerr(1) = 'focftr: revoyez vos donnees' +c kerr(2) = 'les lignes fermees doivent etre disjointes' +c kerr(3) = 'verifiez si elles ne se coupent pas' +c call lereur + write(imprim,*) 'focftr: revoyez vos donnees' + write(imprim,*)'les lignes fermees doivent etre disjointes' + write(imprim,*)'verifiez si elles ne se coupent pas' + ierr = 14 + return + endif +c +c l'arete suivant la derniere arete du cf est la premiere du cf +c => realisation d'un chainage circulaire des aretes du cf + noarcf( 2, nbarcf ) = 1 +c +c destruction des triangles de l'etoile du tableau noartr +c ------------------------------------------------------- + do 50 i=1,nbtrcf +c le numero du triangle dans noartr + nt0 = notrcf( i ) +c l'arete 1 de nt0 devient nulle + noartr( 1, nt0 ) = 0 +c chainage de nt0 en tete du chainage des triangles vides de noartr + noartr( 2, nt0 ) = n1artr + n1artr = nt0 + 50 continue + end + + + subroutine int1sd( ns1, ns2, ns3, ns4, pxyd, linter, x0, y0 ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : existence ou non d'une intersection a l'interieur +c ----- des 2 aretes ns1-ns2 et ns3-ns4 +c attention les intersections au sommet sont comptees +c +c entrees: +c -------- +c ns1,...ns4 : numero pxyd des 4 sommets +c pxyd : les coordonnees des sommets +c +c sortie : +c -------- +c linter : -1 si ns3-ns4 parallele a ns1 ns2 +c 0 si ns3-ns4 n'intersecte pas ns1-ns2 entre les aretes +c 1 si ns3-ns4 intersecte ns1-ns2 entre les aretes +c 2 si le point d'intersection est ns1 entre ns3-ns4 +c 3 si le point d'intersection est ns3 entre ns1-ns2 +c 4 si le point d'intersection est ns4 entre ns1-ns2 +c x0,y0 : 2 coordonnees du point d'intersection s'il existe(linter>=1) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc fevrier 1992 +c2345x7..............................................................012 + parameter ( epsmoi=-0.000001d0, eps=0.001d0, + % unmeps= 0.999d0, unpeps=1.000001d0 ) + double precision pxyd(3,*), x0, y0 + double precision x1,y1,x21,y21,d21,x43,y43,d43,d,x,y,p21,p43 +c + x1 = pxyd(1,ns1) + y1 = pxyd(2,ns1) + x21 = pxyd(1,ns2) - x1 + y21 = pxyd(2,ns2) - y1 + d21 = x21**2 + y21**2 +c + x43 = pxyd(1,ns4) - pxyd(1,ns3) + y43 = pxyd(2,ns4) - pxyd(2,ns3) + d43 = x43**2 + y43**2 +c +c les 2 aretes sont-elles jugees paralleles ? + d = x43 * y21 - y43 * x21 + if( d*d .le. 0.000001d0 * d21 * d43 ) then +c cote i parallele a ns1-ns2 + linter = -1 + return + endif +c +c les 2 coordonnees du point d'intersection + x =( x1*x43*y21-pxyd(1,ns3)*x21*y43-(y1-pxyd(2,ns3))*x21*x43)/d + y =(-y1*y43*x21+pxyd(2,ns3)*y21*x43+(x1-pxyd(1,ns3))*y21*y43)/d +c +c coordonnee barycentrique de x,y dans le repere ns1-ns2 + p21 = ( ( x - x1 ) * x21 + ( y - y1 ) * y21 ) / d21 +c coordonnee barycentrique de x,y dans le repere ns3-ns4 + p43 = ( (x - pxyd(1,ns3))* x43 + (y - pxyd(2,ns3)) * y43 ) / d43 +c +c + if( epsmoi .le. p21 .and. p21 .le. unpeps ) then +c x,y est entre ns1-ns2 + if( (p21 .le. eps) .and. + % (epsmoi .le. p43 .and. p43 .le. unpeps) ) then +c le point x,y est proche de ns1 et interne a ns3-ns4 + linter = 2 + x0 = pxyd(1,ns1) + y0 = pxyd(2,ns1) + return + else if( epsmoi .le. p43 .and. p43 .le. eps ) then +c le point x,y est proche de ns3 et entre ns1-ns2 + linter = 3 + x0 = pxyd(1,ns3) + y0 = pxyd(2,ns3) + return + else if( unmeps .le. p43 .and. p43 .le. unpeps ) then +c le point x,y est proche de ns4 et entre ns1-ns2 + linter = 4 + x0 = pxyd(1,ns4) + y0 = pxyd(2,ns4) + return + else if( eps .le. p43 .and. p43 .le. unmeps ) then +c le point x,y est entre ns3-ns4 + linter = 1 + x0 = x + y0 = y + return + endif + endif +c +c pas d'intersection a l'interieur des aretes + linter = 0 + end + + + subroutine tefoar( narete, nbarpi, pxyd, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, noarst, + % mxarcf, n1arcf, noarcf, larmin, notrcf, + % ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : forcer l'arete narete de nosoar dans la triangulation actuelle +c ----- triangulation frontale pour la reobtenir +c +c attention: le chainage lchain(=6) de nosoar devient actif +c durant la formation des contours fermes (cf) +c +c entrees: +c -------- +c narete : numero nosoar de l'arete frontaliere a forcer +c nbarpi : numero du dernier point interne impose par l'utilisateur +c pxyd : tableau des coordonnees 2d des points +c par point : x y distance_souhaitee +c +c mosoar : nombre maximal d'entiers par arete et +c indice dans nosoar de l'arete suivante dans le hachage +c mxsoar : nombre maximal d'aretes stockables dans le tableau nosoar +c attention: mxsoar>3*mxsomm obligatoire! +c moartr : nombre maximal d'entiers par arete du tableau noartr +c +c modifies: +c --------- +c n1soar : no de l'eventuelle premiere arete libre dans le tableau nosoar +c chainage des vides suivant en 3 et precedant en 2 de nosoar +c nosoar : numero des 2 sommets , no ligne, 2 triangles de l'arete, +c chainage des aretes frontalieres, chainage du hachage des aretes +c hachage des aretes = nosoar(1)+nosoar(2)*2 +c avec mxsoar>=3*mxsomm +c une arete i de nosoar est vide <=> nosoar(1,i)=0 et +c nosoar(2,arete vide)=l'arete vide qui precede +c nosoar(3,arete vide)=l'arete vide qui suit +c n1artr : numero du premier triangle vide dans le tableau noartr +c le chainage des triangles vides se fait sur noartr(2,.) +c noartr : les 3 aretes des triangles +-arete1, +-arete2, +-arete3 +c arete1 = 0 si triangle vide => arete2 = triangle vide suivant +c noarst : noarst(i) numero d'une arete de sommet i +c +c mxarcf : nombre de variables des tableaux n1arcf, noarcf, larmin, notrcf +c +c tableaux auxiliaires : +c ---------------------- +c n1arcf : tableau (0:mxarcf) auxiliaire +c noarcf : tableau (3,mxarcf) auxiliaire +c larmin : tableau (mxarcf) auxiliaire +c notrcf : tableau (1:mxarcf) auxiliaire +c +c sortie : +c -------- +c ierr : 0 si pas d'erreur +c 1 saturation des sommets +c 2 ns1 dans aucun triangle +c 9 tableau nosoar de taille insuffisante car trop d'aretes +c a probleme +c 10 un des tableaux n1arcf, noarcf notrcf est sature +c augmenter a l'appel mxarcf +c 11 algorithme defaillant +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc mars 1997 +c....................................................................012 + parameter (mxpitr=32) + common / unites / lecteu,imprim,intera,nunite(29) + logical tratri + common / dv2dco / tratri + double precision pxyd(3,*) + integer noartr(moartr,*), + % nosoar(mosoar,mxsoar), + % noarst(*), + % n1arcf(0:mxarcf), + % noarcf(3,mxarcf), + % larmin(mxarcf), + % notrcf(mxarcf) +c + integer lapitr(mxpitr) + double precision x1,y1,x2,y2,d12,d3,d4,x,y,d,dmin + integer nosotr(3), ns(2) + integer nacf(1:2), nacf1, nacf2 + equivalence (nacf(1),nacf1), (nacf(2),nacf2) +c +c traitement de cette arete perdue + ns1 = nosoar( 1, narete ) + ns2 = nosoar( 2, narete ) +c + if( tratri ) then +c les traces sont demandes +c call efface +c le cadre objet global en unites utilisateur + xx1 = min( pxyd(1,ns1), pxyd(1,ns2) ) + xx2 = max( pxyd(1,ns1), pxyd(1,ns2) ) + yy1 = min( pxyd(2,ns1), pxyd(2,ns2) ) + yy2 = max( pxyd(2,ns1), pxyd(2,ns2) ) + if( xx1 .ge. xx2 ) xx2 = xx1 + (yy2-yy1) + if( yy1 .ge. yy2 ) yy2 = yy1 + (xx2-xx1)*0.5 +c call isofenetre( xx1-(xx2-xx1), xx2+(xx2-xx1), +c % yy1-(yy2-yy1), yy2+(yy2-yy1) ) + endif +c +cccc trace de l'arete perdue +ccc call dvtrar( pxyd, ns1, ns2, ncroug, ncblan ) +c +c le sommet ns2 est il correct? + na = noarst( ns2 ) + if( na .le. 0 ) then + write(imprim,*) 'tefoar: erreur sommet ',ns2,' sans arete' + ierr = 8 + return + endif + if( nosoar(4,na) .le. 0 ) then + write(imprim,*) 'tefoar: erreur sommet ',ns2, + % ' dans aucun triangle' + ierr = 8 + return + endif +c +c recherche du triangle voisin dans le sens indirect de rotation + nsens = -1 +c le premier passage: recherche dans le sens ns1->ns2 + ipas = 0 +c +c recherche des triangles intersectes par le segment ns1-ns2 +c ========================================================== + 3 x1 = pxyd(1,ns1) + y1 = pxyd(2,ns1) + x2 = pxyd(1,ns2) + y2 = pxyd(2,ns2) + d12 = (x2-x1)**2 + (y2-y1)**2 +c +c recherche du no local du sommet ns1 dans l'un de ses triangles + na01 = noarst( ns1 ) + if( na01 .le. 0 ) then + write(imprim,*) 'tefoar: sommet ',ns1,' sans arete' + ierr = 8 + return + endif + nt0 = nosoar(4,na01) + if( nt0 .le. 0 ) then + write(imprim,*) 'tefoar: sommet ',ns1,' dans aucun triangle' + ierr = 8 + return + endif +c +c le numero des 3 sommets du triangle nt0 dans le sens direct + 20 call nusotr( nt0, mosoar, nosoar, moartr, noartr, nosotr ) + do 22 na00=1,3 + if( nosotr(na00) .eq. ns1 ) goto 26 + 22 continue +c + 25 if( ipas .eq. 0 ) then +c le second passage: recherche dans le sens ns2->ns1 +c tentative d'inversion des 2 sommets extremites de l'arete a forcer + na00 = ns1 + ns1 = ns2 + ns2 = na00 + ipas = 1 + goto 3 + else +c les sens ns1->ns2 et ns2->ns1 ne donne pas de solution! + write(imprim,*)'tefoar:arete ',ns1,' - ',ns2,' a imposer' + write(imprim,*)'tefoar:anomalie sommet ',ns1, + % 'non dans le triangle de sommets ',(nosotr(i),i=1,3) + pause + ierr = 11 + return + endif +c +c le numero des aretes suivante et precedente + 26 na0 = nosui3( na00 ) + na1 = nopre3( na00 ) + ns3 = nosotr( na0 ) + ns4 = nosotr( na1 ) +c +cccc trace du triangle nt0 et de l'arete perdue +ccc call mttrtr( pxyd, nt0, moartr, noartr, mosoar, nosoar, +ccc % ncblan, ncjaun ) +ccc call dvtrar( pxyd, ns1, ns2, ncroug, ncblan ) +ccc call dvtrar( pxyd, ns3, ns4, ncbleu, nccyan ) +c +c point d'intersection du segment ns1-ns2 avec l'arete ns3-ns4 +c ------------------------------------------------------------ + call int1sd( ns1, ns2, ns3, ns4, pxyd, linter, x1, y1 ) + if( linter .le. 0 ) then +c +c pas d'intersection: rotation autour du point ns1 +c pour trouver le triangle de l'autre cote de l'arete na01 + if( nsens .lt. 0 ) then +c sens indirect de rotation: l'arete de sommet ns1 + na01 = abs( noartr(na00,nt0) ) + else +c sens direct de rotation: l'arete de sommet ns1 qui precede + na01 = abs( noartr(na1,nt0) ) + endif +c le triangle de l'autre cote de l'arete na01 + if( nosoar(4,na01) .eq. nt0 ) then + nt0 = nosoar(5,na01) + else + nt0 = nosoar(4,na01) + endif + if( nt0 .gt. 0 ) goto 20 +c +c le parcours sort du domaine +c il faut tourner dans l'autre sens autour de ns1 + if( nsens .lt. 0 ) then + nsens = 1 + nt0 = noarst( ns1 ) + goto 20 + endif +c +c dans les 2 sens, pas d'intersection => impossible +c essai avec l'arete inversee ns1 <-> ns2 + if( ipas .eq. 0 ) goto 25 + write(imprim,*) 'tefoar: arete ',ns1,' ',ns2, + % ' sans intersection avec les triangles actuels' + write(imprim,*) 'revoyez les lignes du contour' + ierr = 11 + return + endif +c +c il existe une intersection avec l'arete opposee au sommet ns1 +c ============================================================= +c nbtrcf : nombre de triangles du cf + nbtrcf = 1 + notrcf( 1 ) = nt0 +c +c le triangle oppose a l'arete na0 de nt0 + 30 noar = abs( noartr(na0,nt0) ) + if( nosoar(4,noar) .eq. nt0 ) then + nt1 = nosoar(5,noar) + else + nt1 = nosoar(4,noar) + endif +c +cccc trace du triangle nt1 et de l'arete perdue +ccc call mttrtr( pxyd, nt1, moartr, noartr, mosoar, nosoar, +ccc % ncjaun, ncmage ) +ccc call dvtrar( pxyd, ns1, ns2, ncroug, ncblan ) +c +c le numero des 3 sommets du triangle nt1 dans le sens direct + call nusotr( nt1, mosoar, nosoar, moartr, noartr, nosotr ) +c +c le triangle nt1 contient il ns2 ? + do 32 j=1,3 + if( nosotr(j) .eq. ns2 ) goto 70 + 32 continue +c +c recherche de l'arete noar, na1 dans nt1 qui est l'arete na0 de nt0 + do 34 na1=1,3 + if( abs( noartr(na1,nt1) ) .eq. noar ) goto 35 + 34 continue +c +c trace du triangle nt1 et de l'arete perdue + 35 continue +ccc 35 call mttrtr( pxyd, nt1, moartr, noartr, mosoar, nosoar, +ccc % ncjaun, ncmage ) +ccc call dvtrar( pxyd, ns1, ns2, ncroug, ncblan ) +c +c recherche de l'intersection de ns1-ns2 avec les 2 autres aretes de nt1 +c ====================================================================== + na2 = na1 + do 50 i1 = 1,2 +c l'arete suivante + na2 = nosui3(na2) +c +c les 2 sommets de l'arete na2 de nt1 + noar = abs( noartr(na2,nt1) ) + ns3 = nosoar( 1, noar ) + ns4 = nosoar( 2, noar ) +ccc call dvtrar( pxyd, ns3, ns4, ncbleu, nccyan ) +c +c point d'intersection du segment ns1-ns2 avec l'arete ns3-ns4 +c ------------------------------------------------------------ + call int1sd( ns1, ns2, ns3, ns4, pxyd, linter, x , y ) + if( linter .gt. 0 ) then +c +c les 2 aretes s'intersectent en (x,y) +c distance de (x,y) a ns3 et ns4 + d3 = (pxyd(1,ns3)-x)**2 + (pxyd(2,ns3)-y)**2 + d4 = (pxyd(1,ns4)-x)**2 + (pxyd(2,ns4)-y)**2 +c nsp est le point le plus proche de (x,y) + if( d3 .lt. d4 ) then + nsp = ns3 + d = d3 + else + nsp = ns4 + d = d4 + endif + if( d .gt. 1d-5*d12 ) goto 60 +c +c ici le sommet nsp est trop proche de l'arete perdue ns1-ns2 + if( nsp .le. nbarpi ) then +c point utilisateur ou frontalier non supprimable + ierr = 11 + write(imprim,*) 'pause dans tefoar 1', d, d3, d4, d12 + pause + return + endif +c +c le sommet interne nsp est supprime en mettant tous les triangles +c l'ayant comme sommet dans la pile notrcf des triangles a supprimer +c ------------------------------------------------------------------ +ccc write(imprim,*) 'tefoar: le sommet ',nsp,' est supprime' +c construction de la liste des triangles de sommet nsp + call trp1st( nsp, noarst, mosoar, nosoar, moartr, noartr, + % mxpitr, nbt, lapitr ) + if( nbt .le. 0 ) then +c les triangles de sommet nsp ne forme pas une "boule" +c avec ce sommet nsp pour "centre" + write(imprim,*) + % 'tefoar: pas d''etoile de triangles autour du sommet',nsp +cccc trace des triangles de l'etoile du sommet nsp +ccc tratri = .true. +ccc call trpltr( nbt, lapitr, pxyd, +ccc % moartr, noartr, mosoar, nosoar, +ccc % ncroug, ncblan ) +ccc tratri = .false. + ierr = 11 + write(imprim,*) 'pause dans tefoar 2' + pause + return + endif +c +c ajout des triangles de sommet ns1 a notrcf + nbtrc0 = nbtrcf + do 38 j=1,nbt + nt = lapitr(j) + do 37 k=nbtrcf,1,-1 + if( nt .eq. notrcf(k) ) goto 38 + 37 continue +c triangle ajoute + nbtrcf = nbtrcf + 1 + notrcf( nbtrcf ) = nt +ccc call mttrtr( pxyd, nt, moartr, noartr, mosoar, nosoar, +ccc % ncjaun, ncmage ) +ccc call dvtrar( pxyd, ns1, ns2, ncroug, ncblan ) + 38 continue +c +c ce sommet supprime n'appartient plus a aucun triangle + noarst( nsp ) = 0 +c +c ns2 est-il un sommet des triangles empiles? +c ------------------------------------------- + do 40 nt=nbtrc0+1,nbtrcf +c le triangle a supprimer nt + nt1 = notrcf( nt ) +c le numero des 3 sommets du triangle nt1 dans le sens direct + call nusotr( nt1, mosoar, nosoar, moartr, noartr, nosotr) + do 39 k=1,3 +c le sommet k de nt1 + if( nosotr( k ) .eq. ns2 ) then +c but atteint + goto 80 + endif + 39 continue + 40 continue +c +c recherche du plus proche point d'intersection de ns1-ns2 +c par rapport a ns2 avec les aretes des triangles ajoutes + nt0 = 0 + dmin = d12 * 10000 + do 48 nt=nbtrc0+1,nbtrcf + nt1 = notrcf( nt ) +c le numero des 3 sommets du triangle nt1 dans le sens direct + call nusotr( nt1, mosoar, nosoar, moartr, noartr, nosotr) + do 45 k=1,3 +c les 2 sommets de l'arete k de nt + ns3 = nosotr( k ) + ns4 = nosotr( nosui3(k) ) +c +c point d'intersection du segment ns1-ns2 avec l'arete ns3-ns4 +c ------------------------------------------------------------ + call int1sd( ns1, ns2, ns3, ns4, pxyd, + % linter, x , y ) + if( linter .gt. 0 ) then +c les 2 aretes s'intersectent en (x,y) + d = (x-x2)**2+(y-y2)**2 + if( d .lt. dmin ) then + nt0 = nt1 + na0 = k + dmin = d + endif + endif + 45 continue + 48 continue +c +c redemarrage avec le triangle nt0 et l'arete na0 + if( nt0 .gt. 0 ) goto 30 +c + write(imprim,*) 'tefoar: algorithme defaillant' + ierr = 11 + pause + return + endif + 50 continue +c +c pas d'intersection differente de l'initiale => sommet sur ns1-ns2 +c rotation autour du sommet par l'arete suivant na1 + write(imprim,*) + write(imprim,*) 'tefoar 50: revoyez vos donnees' + write(imprim,*) 'les lignes fermees doivent etre disjointes' + write(imprim,*) 'verifiez si elles ne se coupent pas' + ierr = 13 + pause + return +c +c cas sans probleme : intersection differente de celle initiale +c ================= ========================================= + 60 nbtrcf = nbtrcf + 1 + notrcf( nbtrcf ) = nt1 +c passage au triangle suivant + na0 = na2 + nt0 = nt1 + goto 30 +c +c ---------------------------------------------------------- +c ici toutes les intersections de ns1-ns2 ont ete parcourues +c tous les triangles intersectes ou etendus forment les +c nbtrcf triangles du tableau notrcf +c ---------------------------------------------------------- + 70 nbtrcf = nbtrcf + 1 + notrcf( nbtrcf ) = nt1 +c +c formation du cf des aretes simples des triangles de notrcf +c et destruction des nbtrcf triangles du tableau noartr +c attention: le chainage lchain du tableau nosoar devient actif +c ============================================================= + 80 if( nbtrcf*3 .gt. mxarcf ) then + write(imprim,*) 'saturation du tableau noarcf' + ierr = 10 + return + endif +c + call focftr( nbtrcf, notrcf, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % nbarcf, n1arcf, noarcf, + % ierr ) + if( ierr .ne. 0 ) return +c +c chainage des aretes vides dans le tableau noarcf +c ------------------------------------------------ +c decalage de 2 aretes car 2 aretes sont necessaires ensuite pour +c integrer 2 fois l'arete perdue et former ainsi 2 cf +c comme nbtrcf*3 minore mxarcf il existe au moins 2 places vides +c derriere => pas de test de debordement + n1arcf(0) = nbarcf+3 + mmarcf = min(8*nbarcf,mxarcf) + do 90 i=nbarcf+3,mmarcf + noarcf(2,i) = i+1 + 90 continue + noarcf(2,mmarcf) = 0 +c +c reperage des sommets ns1 ns2 de l'arete perdue dans le cf +c --------------------------------------------------------- + ns1 = nosoar( 1, narete ) + ns2 = nosoar( 2, narete ) + ns(1) = ns1 + ns(2) = ns2 + do 120 i=1,2 +c la premiere arete dans noarcf du cf + na0 = n1arcf(1) + 110 if( noarcf(1,na0) .ne. ns(i) ) then +c passage a l'arete suivante + na0 = noarcf( 2, na0 ) + goto 110 + endif +c position dans noarcf du sommet i de l'arete perdue + nacf(i) = na0 + 120 continue +c +c formation des 2 cf chacun contenant l'arete ns1-ns2 +c --------------------------------------------------- +c sauvegarde de l'arete suivante de celle de sommet ns1 + na0 = noarcf( 2, nacf1 ) + nt1 = noarcf( 3, nacf1 ) +c +c le premier cf + n1arcf( 1 ) = nacf1 +c l'arete suivante dans le premier cf + noarcf( 2, nacf1 ) = nacf2 +c cette arete est celle perdue + noarcf( 3, nacf1 ) = narete +c +c le second cf +c l'arete doublee + n1 = nbarcf + 1 + n2 = nbarcf + 2 +c le premier sommet de la premiere arete du second cf + noarcf( 1, n1 ) = ns2 +c l'arete suivante dans le second cf + noarcf( 2, n1 ) = n2 +c cette arete est celle perdue + noarcf( 3, n1 ) = narete +c la seconde arete du second cf + noarcf( 1, n2 ) = ns1 + noarcf( 2, n2 ) = na0 + noarcf( 3, n2 ) = nt1 + n1arcf( 2 ) = n1 +c +c recherche du precedent de nacf2 + 130 na1 = noarcf( 2, na0 ) + if( na1 .ne. nacf2 ) then +c passage a l'arete suivante + na0 = na1 + goto 130 + endif +c na0 precede nacf2 => il precede n1 + noarcf( 2, na0 ) = n1 +c +c depart avec 2 cf + nbcf = 2 +c +c triangulation directe des 2 contours fermes +c l'arete ns1-ns2 devient une arete de la triangulation des 2 cf +c ============================================================== + call tridcf( nbcf, pxyd, noarst, + % mosoar, mxsoar, n1soar, nosoar, + % moartr, n1artr, noartr, + % mxarcf, n1arcf, noarcf, larmin, + % nbtrcf, notrcf, ierr ) + end + + + subroutine te4ste( nbsomm, mxsomm, pxyd, ntrp, letree, + & ierr ) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c but : decouper un te ntrp de letree en 4 sous-triangles +c ----- eliminer les sommets de te trop proches des points +c +c entrees: +c -------- +c mxsomm : nombre maximal de points declarables dans pxyd +c ntrp : numero letree du triangle a decouper en 4 sous-triangles +c +c modifies : +c ---------- +c nbsomm : nombre actuel de points dans pxyd +c pxyd : tableau des coordonnees des points +c par point : x y distance_souhaitee +c letree : arbre-4 des triangles equilateraux (te) fond de la triangulation +c letree(0,0) : no du 1-er te vide dans letree +c letree(0,1) : maximum du 1-er indice de letree (ici 8) +c letree(0,2) : maximum declare du 2-eme indice de letree (ici mxtree) +c letree(0:8,1) : racine de l'arbre (triangle sans sur triangle) +c si letree(0,.)>0 alors +c letree(0:3,j) : no (>0) letree des 4 sous-triangles du triangle j +c sinon +c letree(0:3,j) :-no pxyd des 1 a 4 points internes au triangle j +c 0 si pas de point +c ( j est alors une feuille de l'arbre ) +c letree(4,j) : no letree du sur-triangle du triangle j +c letree(5,j) : 0 1 2 3 no du sous-triangle j pour son sur-triangle +c letree(6:8,j) : no pxyd des 3 sommets du triangle j +c +c sorties : +c --------- +c ierr : 0 si pas d'erreur, 51 saturation letree, 52 saturation pxyd +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c auteur : alain perronnet analyse numerique paris upmc juillet 1994 +c2345x7..............................................................012 + common / unites / lecteu,imprim,nunite(30) + integer letree(0:8,0:*) + double precision pxyd(3,mxsomm) + integer np(0:3),milieu(3) +c +c debut par l'arete 2 du triangle ntrp + i1 = 2 + i2 = 3 + do 30 i=1,3 +c +c le milieu de l'arete i1 existe t il deja ? + call n1trva( ntrp, i1, letree, noteva, niveau ) + if( noteva .gt. 0 ) then +c il existe un te voisin +c s'il existe 4 sous-triangles le milieu existe deja + if( letree(0,noteva) .gt. 0 ) then +c le milieu existe + nsot = letree(0,noteva) + milieu(i) = letree( 5+nopre3(i1), nsot ) + goto 25 + endif + endif +c +c le milieu n'existe pas. il est cree + nbsomm = nbsomm + 1 + if( nbsomm .gt. mxsomm ) then +c plus assez de place dans pxyd + write(imprim,*) 'te4ste: saturation pxyd' + write(imprim,*) + ierr = 52 + return + endif +c le milieu de l'arete i + milieu(i) = nbsomm +c +c ntrp est le triangle de milieux d'arete ces 3 sommets + ns1 = letree( 5+i1, ntrp ) + ns2 = letree( 5+i2, ntrp ) + pxyd(1,nbsomm) = ( pxyd(1,ns1) + pxyd(1,ns2) ) * 0.5 + pxyd(2,nbsomm) = ( pxyd(2,ns1) + pxyd(2,ns2) ) * 0.5 +c +c l'arete et milieu suivant + 25 i1 = i2 + i2 = nosui3( i2 ) + 30 continue +c + do 50 i=0,3 +c +c le premier triangle vide + nsot = letree(0,0) + if( nsot .le. 0 ) then +c manque de place. saturation letree + ierr = 51 + write(imprim,*) 'te4ste: saturation letree' + write(imprim,*) + return + endif +c +c mise a jour du premier te libre + letree(0,0) = letree(0,nsot) +c +c nsot est le i-eme sous triangle + letree(0,nsot) = 0 + letree(1,nsot) = 0 + letree(2,nsot) = 0 + letree(3,nsot) = 0 +c +c le numero des points et sous triangles dans ntrp + np(i) = -letree(i,ntrp) + letree(i,ntrp) = nsot +c +c le sommet commun avec le triangle ntrp + letree(5+i,nsot) = letree(5+i,ntrp) +c +c le sur-triangle et numero de sous-triangle de nsot +c a laisser ici car incorrect sinon pour i=0 + letree(4,nsot) = ntrp + letree(5,nsot) = i +c +c le sous-triangle du triangle + letree(i,ntrp) = nsot + 50 continue +c +c le numero des nouveaux sommets milieux + nsot = letree(0,ntrp) + letree(6,nsot) = milieu(1) + letree(7,nsot) = milieu(2) + letree(8,nsot) = milieu(3) +c + nsot = letree(1,ntrp) + letree(7,nsot) = milieu(3) + letree(8,nsot) = milieu(2) +c + nsot = letree(2,ntrp) + letree(6,nsot) = milieu(3) + letree(8,nsot) = milieu(1) +c + nsot = letree(3,ntrp) + letree(6,nsot) = milieu(2) + letree(7,nsot) = milieu(1) +c +c repartition des eventuels 4 points np dans ces 4 sous-triangles +c il y a obligatoirement suffisamment de place + do 110 i=0,3 + if( np(i) .gt. 0 ) then + nsot = notrpt( pxyd(1,np(i)), pxyd, ntrp, letree ) +c ajout du point + do 100 i1=0,3 + if( letree(i1,nsot) .eq. 0 ) then +c place libre a occuper + letree(i1,nsot) = -np(i) + goto 110 + endif + 100 continue + endif + 110 continue + end diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 000000000..72cfcf925 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,22 @@ +#============================================================================== +# File : Makefile.in +# Created : ven déc 7 13:32:20 CET 2001 +# Author : Paul RASCLE, EDF +# Project : SALOME +# Copyright : EDF 2001 +# $Header$ +#============================================================================== + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +@COMMENCE@ + +SUBDIRS = OBJECT SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV MEFISTO2 \ + SMESH SMESH_I SMESHFiltersSelection SMESHGUI \ + SMESH_SWIG + +@MODULE@ diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in new file mode 100644 index 000000000..b6a2db810 --- /dev/null +++ b/src/OBJECT/Makefile.in @@ -0,0 +1,33 @@ +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + + +@COMMENCE@ + +EXPORT_HEADERS = SMESH_Actor.h \ + SMESH_Grid.h + + +# Libraries targets + +LIB = libSMESHObject.la +LIB_SRC = SMESH_Actor.cxx \ + SMESH_Grid.cxx + +LIB_CLIENT_IDL = + +# Executables targets +BIN = +BIN_SRC = + +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+=$(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome + +%_moc.cxx: %.h + $(MOC) $< -o $@ + + +@CONCLUDE@ diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx new file mode 100644 index 000000000..0a4390185 --- /dev/null +++ b/src/OBJECT/SMESH_Actor.cxx @@ -0,0 +1,598 @@ +using namespace std; +// File : SMESH_Actor.cxx +// Created : Mon May 13 22:31:18 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +/*! + \class SMESH_Actor SMESH_Actor.h + \brief ... +*/ + +#include "SMESH_Actor.h" +#include "SMESH_Grid.h" +#include "utilities.h" + +// VTK Includes +#include +#include +#include +#include +#include + +//------------------------------------------------------------- +// Main methods +//------------------------------------------------------------- + +SMESH_Actor* SMESH_Actor::New() +{ + // First try to create the object from the vtkObjectFactory + vtkObject* ret = vtkObjectFactory::CreateInstance("SMESH_Actor"); + if(ret) + { + return (SMESH_Actor*)ret; + } + // If the factory was unable to create the object, then create it here. + return new SMESH_Actor; +} + + +SMESH_Actor::SMESH_Actor() +{ + this->Device = vtkActor::New(); + + this->EdgeDevice = vtkActor::New(); + EdgeDevice->VisibilityOff(); + EdgeDevice->PickableOff(); + + this->EdgeShrinkDevice = vtkActor::New(); + EdgeShrinkDevice->VisibilityOff(); + EdgeShrinkDevice->PickableOff(); + + myIO = NULL; + myName = ""; + myDisplayMode = 0; + + ishighlighted = false; + ispreselected = false; + + edgeColor.r = 0.; + edgeColor.g = 0.; + edgeColor.b = 0.; + + edgeHighlightColor.r = 1.; + edgeHighlightColor.g = 1.; + edgeHighlightColor.b = 1.; + + edgePreselectedColor.r = 0.; + edgePreselectedColor.g = 1.; + edgePreselectedColor.b = 1.; + + actorColor.r = 1.; + actorColor.g = 1.; + actorColor.b = 0.; + + actorHighlightColor.r = 1.; + actorHighlightColor.g = 1.; + actorHighlightColor.b = 1.; + + actorPreselectedColor.r = 0.; + actorPreselectedColor.g = 1.; + actorPreselectedColor.b = 1.; + + actorNodeColor.r = 1.; + actorNodeColor.g = 1.; + actorNodeColor.b = 0.; + + actorNodeSize = 2 ; + +} + +SMESH_Actor::~SMESH_Actor() +{ + this->EdgeDevice->Delete(); + this->EdgeShrinkDevice->Delete(); +} + +void SMESH_Actor::setReader(vtkUnstructuredGridReader* r) { + myReader=r; +} + +vtkUnstructuredGridReader* SMESH_Actor::getReader() { + return (myReader); +} + +vtkMapper* SMESH_Actor::getMapper() { + return (this->Mapper); +} + +void SMESH_Actor::ShallowCopy(vtkProp *prop) +{ + SMESH_Actor *f = SMESH_Actor::SafeDownCast(prop); + if ( f != NULL ) + { + this->setName( f->getName() ); + if ( f->hasIO() ) + this->setIO( f->getIO() ); + this->setDisplayMode( f->getDisplayMode() ); + + // Copy devices + vtkActor* tempDev = vtkActor::New(); + tempDev->ShallowCopy(f->Device); + vtkProperty* prp = vtkProperty::New(); + prp->DeepCopy(f->Device->GetProperty()); + tempDev->SetProperty(prp); + prp = vtkProperty::New(); + prp->DeepCopy(f->Device->GetBackfaceProperty()); + tempDev->SetBackfaceProperty(prp); + this->Device = tempDev; + + tempDev = vtkActor::New(); + tempDev->ShallowCopy(f->EdgeDevice); + prp = vtkProperty::New(); + prp->DeepCopy(f->EdgeDevice->GetProperty()); + tempDev->SetProperty(prp); + prp = vtkProperty::New(); + prp->DeepCopy(f->EdgeDevice->GetBackfaceProperty()); + tempDev->SetBackfaceProperty(prp); + this->EdgeDevice = tempDev; + + tempDev = vtkActor::New(); + tempDev->ShallowCopy(f->EdgeShrinkDevice); + prp = vtkProperty::New(); + prp->DeepCopy(f->EdgeShrinkDevice->GetProperty()); + tempDev->SetProperty(prp); + prp = vtkProperty::New(); + prp->DeepCopy(f->EdgeShrinkDevice->GetBackfaceProperty()); + tempDev->SetBackfaceProperty(prp); + this->EdgeShrinkDevice = tempDev; + + // Copy data source + this->DataSource = f->DataSource; + + this->myReader = f->myReader; + } + + // Now do superclass + this->SALOME_Actor::ShallowCopy(prop); + + // Here we need to modify default ShallowCopy() results + // Create copies of properties + if ( f != NULL ) { + vtkProperty* prp = vtkProperty::New(); + prp->DeepCopy(f->GetProperty()); + this->SetProperty(prp); + + prp = vtkProperty::New(); + prp->DeepCopy(f->GetBackfaceProperty()); + this->SetBackfaceProperty(prp); + + // Copy the mapper + vtkDataSetMapper* mpr = vtkDataSetMapper::New(); + mpr->ShallowCopy(f->GetMapper()); + mpr->SetInput(f->DataSource); + this->SetMapper(mpr); + } +} + +void SMESH_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper ) +{ + if (this->Mapper == NULL) { + MESSAGE ("No mapper for actor.") + return; + } + + if ( myDisplayMode == 1 ) { + EdgeDevice->VisibilityOn(); + EdgeShrinkDevice->VisibilityOff(); + } else if ( myDisplayMode == 2 ) { + EdgeShrinkDevice->VisibilityOn(); + EdgeDevice->VisibilityOff(); + } else { + EdgeShrinkDevice->VisibilityOff(); + EdgeDevice->VisibilityOff(); + } + + + vtkMapper *bestMapper; + bestMapper = this->Mapper; + + /* render the property */ + if (!this->Property) { + // force creation of a property + this->GetProperty(); + } + + if ( ishighlighted ) { + if ( myDisplayMode == 1 ) { + EdgeDevice->GetProperty()->SetColor(edgeHighlightColor.r,edgeHighlightColor.g,edgeHighlightColor.b); + this->GetProperty()->SetColor(actorColor.r,actorColor.g,actorColor.b); + } else if ( myDisplayMode == 2 ) { + EdgeShrinkDevice->GetProperty()->SetColor(edgeHighlightColor.r,edgeHighlightColor.g,edgeHighlightColor.b); + } else { + this->GetProperty()->SetColor(actorHighlightColor.r,actorHighlightColor.g,actorHighlightColor.b); + } + } else if (! ispreselected ) { + if ( myDisplayMode == 1 ) { + EdgeDevice->GetProperty()->SetColor(edgeColor.r,edgeColor.g,edgeColor.b); + this->GetProperty()->SetColor(actorColor.r,actorColor.g,actorColor.b); + } + else if ( myDisplayMode == 2 ) + EdgeShrinkDevice->GetProperty()->SetColor(edgeColor.r,edgeColor.g,edgeColor.b); + else + this->GetProperty()->SetColor(actorColor.r,actorColor.g,actorColor.b); + } + else { + if ( myDisplayMode == 1 ) + EdgeDevice->GetProperty()->SetColor(edgePreselectedColor.r,edgePreselectedColor.g,edgePreselectedColor.b); + else if ( myDisplayMode == 2 ) + EdgeShrinkDevice->GetProperty()->SetColor(edgePreselectedColor.r,edgePreselectedColor.g,edgePreselectedColor.b); + else + this->GetProperty()->SetColor(actorPreselectedColor.r,actorPreselectedColor.g,actorPreselectedColor.b); + } + + this->Property->Render(this, ren); + if (this->BackfaceProperty) { + this->BackfaceProperty->BackfaceRender(this, ren); + this->Device->SetBackfaceProperty(this->BackfaceProperty); + } + this->Device->SetProperty(this->Property); + + /* render the texture */ + if (this->Texture) { + this->Texture->Render(ren); + } + + + // Store information on time it takes to render. + // We might want to estimate time from the number of polygons in mapper. + this->Device->Render(ren,bestMapper); + this->EstimatedRenderTime = bestMapper->GetTimeToDraw(); +} + +int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp) +{ + int renderedSomething = 0; + vtkRenderer *ren = (vtkRenderer *)vp; + + if ( ! this->Mapper ) { + return 0; + } + + // make sure we have a property + if (!this->Property) { + // force creation of a property + this->GetProperty(); + } + + if ( ishighlighted ) { + if ( myDisplayMode == 1 ) { + EdgeDevice->GetProperty()->SetColor(edgeHighlightColor.r,edgeHighlightColor.g,edgeHighlightColor.b); + } else if ( myDisplayMode == 2 ) { + EdgeShrinkDevice->GetProperty()->SetColor(edgeHighlightColor.r,edgeHighlightColor.g,edgeHighlightColor.b); + } else { + this->GetProperty()->SetColor(actorHighlightColor.r,actorHighlightColor.g,actorHighlightColor.b); + } + } else if (! ispreselected ) { + if ( myDisplayMode == 1 ) + EdgeDevice->GetProperty()->SetColor(edgeColor.r,edgeColor.g,edgeColor.b); + else if ( myDisplayMode == 2 ) + EdgeShrinkDevice->GetProperty()->SetColor(edgeColor.r,edgeColor.g,edgeColor.b); + else + this->GetProperty()->SetColor(actorColor.r,actorColor.g,actorColor.b); + } + else { + if ( myDisplayMode == 1 ) + EdgeDevice->GetProperty()->SetColor(edgePreselectedColor.r,edgePreselectedColor.g,edgePreselectedColor.b); + else if ( myDisplayMode == 2 ) + EdgeShrinkDevice->GetProperty()->SetColor(edgePreselectedColor.r,edgePreselectedColor.g,edgePreselectedColor.b); + else + this->GetProperty()->SetColor(actorPreselectedColor.r,actorPreselectedColor.g,actorPreselectedColor.b); + } + + // is this actor opaque ? + if (this->GetIsOpaque()) { + this->Property->Render(this, ren); + + // render the backface property + if (this->BackfaceProperty) { + this->BackfaceProperty->BackfaceRender(this, ren); + } + + // render the texture + if (this->Texture) { + this->Texture->Render(ren); + } + this->Render(ren,this->Mapper); + + renderedSomething = 1; + } + + return renderedSomething; +} + + +void SMESH_Actor::SetColor(float r,float g,float b) +{ + actorColor.r = r; + actorColor.g = g; + actorColor.b = b; +} + +void SMESH_Actor::GetColor(float& r,float& g,float& b) +{ + r = actorColor.r; + g = actorColor.g; + b = actorColor.b; +} + +void SMESH_Actor::SetPreselectedColor(float r,float g,float b) +{ + actorPreselectedColor.r = r; + actorPreselectedColor.g = g; + actorPreselectedColor.b = b; +} + +void SMESH_Actor::GetPreselectedColor(float& r,float& g,float& b) +{ + r = actorPreselectedColor.r; + g = actorPreselectedColor.g; + b = actorPreselectedColor.b; +} + +void SMESH_Actor::SetHighlightColor(float r,float g,float b) +{ + actorHighlightColor.r = r; + actorHighlightColor.g = g; + actorHighlightColor.b = b; +} + +void SMESH_Actor::GetHighlightColor(float& r,float& g,float& b) +{ + r = actorHighlightColor.r; + g = actorHighlightColor.g; + b = actorHighlightColor.b; +} + +void SMESH_Actor::SetEdgeColor(float r,float g,float b) +{ + edgeColor.r = r; + edgeColor.g = g; + edgeColor.b = b; +} + +void SMESH_Actor::GetEdgeColor(float& r,float& g,float& b) +{ + r = edgeColor.r; + g = edgeColor.g; + b = edgeColor.b; +} + +void SMESH_Actor::SetEdgeHighlightColor(float r,float g,float b) +{ + edgeHighlightColor.r = r; + edgeHighlightColor.g = g; + edgeHighlightColor.b = b; +} + +void SMESH_Actor::GetEdgeHighlightColor(float& r,float& g,float& b) +{ + r = edgeHighlightColor.r; + g = edgeHighlightColor.g; + b = edgeHighlightColor.b; +} + +void SMESH_Actor::SetEdgePreselectedColor(float r,float g,float b) +{ + edgePreselectedColor.r = r; + edgePreselectedColor.g = g; + edgePreselectedColor.b = b; +} + +void SMESH_Actor::GetEdgePreselectedColor(float& r,float& g,float& b) +{ + r = edgePreselectedColor.r; + g = edgePreselectedColor.g; + b = edgePreselectedColor.b; +} + + +void SMESH_Actor::SetNodeColor(float r,float g,float b) +{ + actorNodeColor.r = r ; + actorNodeColor.g = g ; + actorNodeColor.b = b ; +} + +void SMESH_Actor::GetNodeColor(float& r,float& g,float& b) +{ + r = actorNodeColor.r ; + g = actorNodeColor.g ; + b = actorNodeColor.b ; +} + +void SMESH_Actor::SetNodeSize(int size) +{ + actorNodeSize = size ; +} + +int SMESH_Actor::GetNodeSize() +{ + return actorNodeSize ; +} + + +void SMESH_Actor::AddNode(int idSMESHDSnode,int idVTKnode) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->AddNode(idSMESHDSnode, idVTKnode); + } else + MESSAGE("AddNode() method has been moved to SMESH_Grid class"); +} +void SMESH_Actor::AddElement(int idSMESHDSelement, int idVTKelement) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->AddElement(idSMESHDSelement, idVTKelement); + } else + MESSAGE("AddElement() method has been moved to SMESH_Grid class"); +} + +void SMESH_Actor::SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->SetIdsVTKNode(mapVTK); + } else + MESSAGE("SetIdsVTKNode() method has been moved to SMESH_Grid class"); +} +void SMESH_Actor::SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->SetIdsSMESHDSNode(mapSMESHDS); + } else + MESSAGE("SetIdsSMESHDSNode() method has been moved to SMESH_Grid class"); +} + +void SMESH_Actor::SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->SetIdsVTKElement(mapVTK); + } else + MESSAGE("SetIdsVTKElement() method has been moved to SMESH_Grid class"); +} +void SMESH_Actor::SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->SetIdsSMESHDSElement(mapSMESHDS); + } else + MESSAGE("SetIdsSMESHDSElement() method has been moved to SMESH_Grid class"); +} + +int SMESH_Actor::GetIdVTKNode(int idSMESHDSnode) +{ + if (DataSource->IsA("SMESH_Grid")) { + return ((SMESH_Grid*)DataSource)->GetIdVTKNode(idSMESHDSnode); + } else { + MESSAGE("GetIdVTKNode() method has been moved to SMESH_Grid class"); + return -1; + } +} +int SMESH_Actor::GetIdVTKElement(int idSMESHDSelement) +{ + if (DataSource->IsA("SMESH_Grid")) { + return ((SMESH_Grid*)DataSource)->GetIdVTKElement(idSMESHDSelement); + } else { + MESSAGE("GetIdVTKElement() method has been moved to SMESH_Grid class"); + return -1; + } + +} + +int SMESH_Actor::GetIdSMESHDSNode(int idVTKnode) +{ + if (DataSource->IsA("SMESH_Grid")) { + return ((SMESH_Grid*)DataSource)->GetIdSMESHDSNode(idVTKnode); + } else { + MESSAGE("GetIdSMESHDSNode() method has been moved to SMESH_Grid class"); + return -1; + } +} + +int SMESH_Actor::GetIdSMESHDSElement(int idVTKelement) +{ + if (DataSource->IsA("SMESH_Grid")) { + return ((SMESH_Grid*)DataSource)->GetIdSMESHDSElement(idVTKelement); + } else { + MESSAGE("AddNode() method has been moved to SMESH_Grid class"); + return -1; + } +} + +void SMESH_Actor::ClearNode() +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->ClearNode(); + } else + MESSAGE("ClearNode() method has been moved to SMESH_Grid class"); +} + +void SMESH_Actor::ClearElement() +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->ClearElement(); + } else + MESSAGE("ClearElement() method has been moved to SMESH_Grid class"); +} + +void SMESH_Actor::RemoveNode(int id) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->RemoveNode(id); + } else + MESSAGE("RemoveNode() method has been moved to SMESH_Grid class"); +} +void SMESH_Actor::RemoveElement(int id) +{ + if (DataSource->IsA("SMESH_Grid")) { + ((SMESH_Grid*)DataSource)->RemoveElement(id); + } else + MESSAGE("RemoveElement() method has been moved to SMESH_Grid class"); +} + +void SMESH_Actor::setDisplayMode(int thenewmode) { + myDisplayMode = thenewmode; + if ( myDisplayMode == 1 ) { + EdgeDevice->VisibilityOn(); + EdgeShrinkDevice->VisibilityOff(); + } else if ( myDisplayMode == 2 ) { + EdgeDevice->VisibilityOff(); + EdgeShrinkDevice->VisibilityOn(); + } else { + EdgeDevice->VisibilityOff(); + EdgeShrinkDevice->VisibilityOff(); + } +} + +float SMESH_Actor::GetShrinkFactor() +{ + return myShrinkFactor; +} + +void SMESH_Actor::SetShrinkFactor(float value ) +{ + if ( value <= 0.1 ) + value = 0.8; + + myShrinkFactor = value; +} + +void SMESH_Actor::GetChildActors(vtkActorCollection* actors) +{ + actors->AddItem(EdgeDevice); + actors->AddItem(EdgeShrinkDevice); +} + +void SMESH_Actor::SetVisibility(bool visibility) +{ + if ( visibility ) { + this->VisibilityOn(); + if ( myDisplayMode == 1 ) { + EdgeDevice->VisibilityOn(); + EdgeShrinkDevice->VisibilityOff(); + } else if ( myDisplayMode == 2 ) { + EdgeDevice->VisibilityOff(); + EdgeShrinkDevice->VisibilityOn(); + } else { + EdgeDevice->VisibilityOff(); + EdgeShrinkDevice->VisibilityOff(); + } + } else { + this->VisibilityOff(); + EdgeDevice->VisibilityOff(); + EdgeShrinkDevice->VisibilityOff(); + } +} + diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h new file mode 100644 index 000000000..c58c309c5 --- /dev/null +++ b/src/OBJECT/SMESH_Actor.h @@ -0,0 +1,137 @@ +// File : SMESH_Actor.h +// Created : Mon May 13 22:30:51 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef SMESH_ACTOR_H +#define SMESH_ACTOR_H + +#include "SALOME_Actor.h" + +// VTK Includes +#include +#include +#include + +// Open CASCADE Includes +#include +#include + +typedef struct rgbStruct +{ + float r; + float g; + float b; +} RGBStruct; + +class SMESH_Actor : public SALOME_Actor { + + public: + vtkTypeMacro(SMESH_Actor,SALOME_Actor); + + static SMESH_Actor* New(); + + // Description: + // This causes the actor to be rendered. It, in turn, will render the actor`s + // property and then mapper. + virtual void Render(vtkRenderer *, vtkMapper *); + + // Description: + // This method is used internally by the rendering process. + // We overide the superclass method to properly set the estimated render time. + int RenderOpaqueGeometry(vtkViewport *viewport); + + void ShallowCopy(vtkProp *prop); + + void setReader(vtkUnstructuredGridReader* r) ; + vtkUnstructuredGridReader* getReader(); + + // Highlight + virtual bool hasHighlight() { return true; } + + vtkMapper* getMapper(); + + void setDisplayMode(int); + + void SetColor(float r,float g,float b); + void GetColor(float& r,float& g,float& b); + void SetHighlightColor(float r,float g,float b); + void GetHighlightColor(float& r,float& g,float& b); + void SetPreselectedColor(float r,float g,float b); + void GetPreselectedColor(float& r,float& g,float& b); + + void SetEdgeColor(float r,float g,float b); + void GetEdgeColor(float& r,float& g,float& b); + void SetEdgeHighlightColor(float r,float g,float b); + void GetEdgeHighlightColor(float& r,float& g,float& b); + void SetEdgePreselectedColor(float r,float g,float b); + void GetEdgePreselectedColor(float& r,float& g,float& b); + + void SetNodeColor(float r,float g,float b); + void GetNodeColor(float& r,float& g,float& b); + + void SetNodeSize(int size) ; + int GetNodeSize() ; + + + void ClearNode(); + void ClearElement(); + + void RemoveNode(int idSMESHDSnode); + void RemoveElement(int idSMESHDSelement); + + void AddNode(int idSMESHDSnode, int idVTKnode); + void AddElement(int idSMESHDSelement, int idVTKelement); + + int GetIdVTKNode(int idSMESHDSnode); + int GetIdVTKElement(int idSMESHDSelement); + + int GetIdSMESHDSNode(int idVTKnode); + int GetIdSMESHDSElement(int idVTKelement); + + void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK); + void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); + + void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK); + void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); + + vtkDataSet* DataSource; + vtkActor* EdgeDevice; + vtkActor* EdgeShrinkDevice; + + float GetShrinkFactor(); + void SetShrinkFactor(float value ); + + void GetChildActors(vtkActorCollection*); + + void SetVisibility(bool visibility); + + protected: + + SMESH_Actor(); + ~SMESH_Actor(); + SMESH_Actor(const SMESH_Actor&) {}; + void operator=(const SMESH_Actor&) {}; + + vtkUnstructuredGridReader* myReader; + + float myShrinkFactor; + + RGBStruct edgeColor; + RGBStruct edgeHighlightColor; + RGBStruct edgePreselectedColor; + + RGBStruct actorColor; + RGBStruct actorHighlightColor; + RGBStruct actorPreselectedColor; + + RGBStruct actorNodeColor; // LPN + int actorNodeSize; // LPN + +}; +#endif //SMESH_ACTOR_H diff --git a/src/OBJECT/SMESH_Grid.cxx b/src/OBJECT/SMESH_Grid.cxx new file mode 100644 index 000000000..de8c49e34 --- /dev/null +++ b/src/OBJECT/SMESH_Grid.cxx @@ -0,0 +1,141 @@ +using namespace std; +// File: SMESH_Grid.cxx +// Created: Fri Sep 27 15:47:42 2002 +// Author: Nicolas REJNERI + +#include "SMESH_Grid.h" + +#include "utilities.h" + +// VTK Includes +#include + +SMESH_Grid* SMESH_Grid::New() +{ + // First try to create the object from the vtkObjectFactory + vtkObject* ret = vtkObjectFactory::CreateInstance("SMESH_Grid"); + if(ret) + { + return (SMESH_Grid*)ret; + } + // If the factory was unable to create the object, then create it here. + return new SMESH_Grid; +} + +void SMESH_Grid::AddNode(int idSMESHDSnode,int idVTKnode) +{ + myMapNodeSMDStoVTK.Bind(idSMESHDSnode, idVTKnode); + myMapNodeVTKtoSMDS.Bind(idVTKnode, idSMESHDSnode); +} +void SMESH_Grid::AddElement(int idSMESHDSelement, int idVTKelement) +{ + myMapElementSMDStoVTK.Bind(idSMESHDSelement, idVTKelement); + myMapElementVTKtoSMDS.Bind(idVTKelement, idSMESHDSelement); +} + +void SMESH_Grid::SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK) +{ + myMapNodeVTKtoSMDS = mapVTK; +} +void SMESH_Grid::SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS) +{ + myMapNodeSMDStoVTK = mapSMESHDS; +} + +void SMESH_Grid::SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK) +{ + myMapElementVTKtoSMDS = mapVTK; +} +void SMESH_Grid::SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS) +{ + myMapElementSMDStoVTK = mapSMESHDS; +} + +int SMESH_Grid::GetIdVTKNode(int idSMESHDSnode) +{ + if ( myMapNodeSMDStoVTK.IsBound( idSMESHDSnode ) ) + return myMapNodeSMDStoVTK.Find(idSMESHDSnode); + else { + MESSAGE("GetIdVTKNode(): SMDS node not found: " << idSMESHDSnode); + return -1; + } +} +int SMESH_Grid::GetIdVTKElement(int idSMESHDSelement) +{ + if ( myMapElementSMDStoVTK.IsBound( idSMESHDSelement ) ) + return myMapElementSMDStoVTK.Find(idSMESHDSelement); + else { + MESSAGE("GetIdVTKElement(): SMDS element not found: " << idSMESHDSelement); + return -1; + } +} + +int SMESH_Grid::GetIdSMESHDSNode(int idVTKnode) +{ + if ( myMapNodeVTKtoSMDS.IsBound( idVTKnode ) ) + return myMapNodeVTKtoSMDS.Find(idVTKnode); + else { + MESSAGE("GetIdSMESHDSNode(): VTK node not found: " << idVTKnode); + return -1; + } +} +int SMESH_Grid::GetIdSMESHDSElement(int idVTKelement) +{ + if ( myMapElementVTKtoSMDS.IsBound( idVTKelement ) ) + return myMapElementVTKtoSMDS.Find(idVTKelement); + else { + MESSAGE("GetIdSMESHDSElement(): VTK element not found: " << idVTKelement); + return -1; + } +} + +void SMESH_Grid::ClearNode() +{ + myMapNodeVTKtoSMDS.Clear(); + myMapNodeSMDStoVTK.Clear(); +} +void SMESH_Grid::ClearElement() +{ + myMapElementVTKtoSMDS.Clear(); + myMapElementSMDStoVTK.Clear(); +} + +void SMESH_Grid::RemoveNode(int id) +{ + if ( myMapNodeSMDStoVTK.IsBound( id ) ) { + int idVTK = myMapNodeSMDStoVTK.Find(id); + myMapNodeSMDStoVTK.UnBind(id); + if ( myMapNodeVTKtoSMDS.IsBound( idVTK ) ) { + myMapNodeVTKtoSMDS.UnBind(idVTK); + } + } +} +void SMESH_Grid::RemoveElement(int id) +{ + if ( myMapElementSMDStoVTK.IsBound( id ) ) { + int idVTK = myMapElementSMDStoVTK.Find(id); + myMapElementSMDStoVTK.UnBind(id); + if ( myMapElementVTKtoSMDS.IsBound( idVTK ) ) { + myMapElementVTKtoSMDS.UnBind(idVTK); + } + } +} + +void SMESH_Grid::DeepCopy(vtkDataObject *src) +{ + SMESH_Grid* srcGrid = SMESH_Grid::SafeDownCast(src); + + if (srcGrid != NULL) { + CopyMaps(srcGrid); + } + + vtkUnstructuredGrid::DeepCopy(src); +} + +void SMESH_Grid::CopyMaps(SMESH_Grid *srcGrid) +{ + this->myMapNodeVTKtoSMDS = srcGrid->myMapNodeVTKtoSMDS; + this->myMapNodeSMDStoVTK = srcGrid->myMapNodeSMDStoVTK; + this->myMapElementVTKtoSMDS = srcGrid->myMapElementVTKtoSMDS; + this->myMapElementSMDStoVTK = srcGrid->myMapElementSMDStoVTK; +} diff --git a/src/OBJECT/SMESH_Grid.h b/src/OBJECT/SMESH_Grid.h new file mode 100644 index 000000000..2d5a6338d --- /dev/null +++ b/src/OBJECT/SMESH_Grid.h @@ -0,0 +1,61 @@ +// File : SMESH_Grid.h +// Created : Fri Sep 27 15:30:51 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef SMESH_GRID_H +#define SMESH_GRID_H + +// VTK Includes +#include + +// Open CASCADE Includes +#include + +class SMESH_Grid : public vtkUnstructuredGrid { + + public: + vtkTypeMacro(SMESH_Grid, vtkUnstructuredGrid); + + static SMESH_Grid* New(); + + void ClearNode(); + void ClearElement(); + + void RemoveNode(int idSMESHDSnode); + void RemoveElement(int idSMESHDSelement); + + void AddNode(int idSMESHDSnode, int idVTKnode); + void AddElement(int idSMESHDSelement, int idVTKelement); + + int GetIdVTKNode(int idSMESHDSnode); + int GetIdVTKElement(int idSMESHDSelement); + + int GetIdSMESHDSNode(int idVTKnode); + int GetIdSMESHDSElement(int idVTKelement); + + void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK); + void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); + + void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK); + void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); + + virtual void DeepCopy (vtkDataObject *src); + void CopyMaps(SMESH_Grid *src); + + protected: + SMESH_Grid() : vtkUnstructuredGrid() {}; + + TColStd_DataMapOfIntegerInteger myMapNodeVTKtoSMDS; + TColStd_DataMapOfIntegerInteger myMapNodeSMDStoVTK; + + TColStd_DataMapOfIntegerInteger myMapElementVTKtoSMDS; + TColStd_DataMapOfIntegerInteger myMapElementSMDStoVTK; +}; + +#endif diff --git a/src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx b/src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx new file mode 100644 index 000000000..25ec73d96 --- /dev/null +++ b/src/SMDS/Handle_SMDSControl_BoundaryEdges.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDSControl_BoundaryEdges_HeaderFile +#define _Handle_SMDSControl_BoundaryEdges_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDSControl_MeshBoundary_HeaderFile +#include "Handle_SMDSControl_MeshBoundary.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDSControl_MeshBoundary); +class SMDSControl_BoundaryEdges; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDSControl_BoundaryEdges); + +class Handle(SMDSControl_BoundaryEdges) : public Handle(SMDSControl_MeshBoundary) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDSControl_BoundaryEdges)():Handle(SMDSControl_MeshBoundary)() {} + Handle(SMDSControl_BoundaryEdges)(const Handle(SMDSControl_BoundaryEdges)& aHandle) : Handle(SMDSControl_MeshBoundary)(aHandle) + { + } + + Handle(SMDSControl_BoundaryEdges)(const SMDSControl_BoundaryEdges* anItem) : Handle(SMDSControl_MeshBoundary)((SMDSControl_MeshBoundary *)anItem) + { + } + + Handle(SMDSControl_BoundaryEdges)& operator=(const Handle(SMDSControl_BoundaryEdges)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDSControl_BoundaryEdges)& operator=(const SMDSControl_BoundaryEdges* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDSControl_BoundaryEdges* operator->() + { + return (SMDSControl_BoundaryEdges *)ControlAccess(); + } + + SMDSControl_BoundaryEdges* operator->() const + { + return (SMDSControl_BoundaryEdges *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDSControl_BoundaryEdges)(); + + Standard_EXPORT static const Handle(SMDSControl_BoundaryEdges) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx b/src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx new file mode 100644 index 000000000..77d757fb4 --- /dev/null +++ b/src/SMDS/Handle_SMDSControl_BoundaryFaces.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDSControl_BoundaryFaces_HeaderFile +#define _Handle_SMDSControl_BoundaryFaces_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDSControl_MeshBoundary_HeaderFile +#include "Handle_SMDSControl_MeshBoundary.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDSControl_MeshBoundary); +class SMDSControl_BoundaryFaces; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDSControl_BoundaryFaces); + +class Handle(SMDSControl_BoundaryFaces) : public Handle(SMDSControl_MeshBoundary) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDSControl_BoundaryFaces)():Handle(SMDSControl_MeshBoundary)() {} + Handle(SMDSControl_BoundaryFaces)(const Handle(SMDSControl_BoundaryFaces)& aHandle) : Handle(SMDSControl_MeshBoundary)(aHandle) + { + } + + Handle(SMDSControl_BoundaryFaces)(const SMDSControl_BoundaryFaces* anItem) : Handle(SMDSControl_MeshBoundary)((SMDSControl_MeshBoundary *)anItem) + { + } + + Handle(SMDSControl_BoundaryFaces)& operator=(const Handle(SMDSControl_BoundaryFaces)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDSControl_BoundaryFaces)& operator=(const SMDSControl_BoundaryFaces* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDSControl_BoundaryFaces* operator->() + { + return (SMDSControl_BoundaryFaces *)ControlAccess(); + } + + SMDSControl_BoundaryFaces* operator->() const + { + return (SMDSControl_BoundaryFaces *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDSControl_BoundaryFaces)(); + + Standard_EXPORT static const Handle(SMDSControl_BoundaryFaces) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDSControl_MeshBoundary.hxx b/src/SMDS/Handle_SMDSControl_MeshBoundary.hxx new file mode 100644 index 000000000..ecff553bc --- /dev/null +++ b/src/SMDS/Handle_SMDSControl_MeshBoundary.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDSControl_MeshBoundary_HeaderFile +#define _Handle_SMDSControl_MeshBoundary_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMDSControl_MeshBoundary; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDSControl_MeshBoundary); + +class Handle(SMDSControl_MeshBoundary) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDSControl_MeshBoundary)():Handle(MMgt_TShared)() {} + Handle(SMDSControl_MeshBoundary)(const Handle(SMDSControl_MeshBoundary)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMDSControl_MeshBoundary)(const SMDSControl_MeshBoundary* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMDSControl_MeshBoundary)& operator=(const Handle(SMDSControl_MeshBoundary)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDSControl_MeshBoundary)& operator=(const SMDSControl_MeshBoundary* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDSControl_MeshBoundary* operator->() + { + return (SMDSControl_MeshBoundary *)ControlAccess(); + } + + SMDSControl_MeshBoundary* operator->() const + { + return (SMDSControl_MeshBoundary *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDSControl_MeshBoundary)(); + + Standard_EXPORT static const Handle(SMDSControl_MeshBoundary) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx b/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx new file mode 100644 index 000000000..473059607 --- /dev/null +++ b/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#define _Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_DataMapNodeOfDataMapOfIntegerMeshElement; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement); + +class Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)():Handle(TCollection_MapNode)() {} + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)(const Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)(const SMDS_DataMapNodeOfDataMapOfIntegerMeshElement* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)& operator=(const Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)& operator=(const SMDS_DataMapNodeOfDataMapOfIntegerMeshElement* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement* operator->() + { + return (SMDS_DataMapNodeOfDataMapOfIntegerMeshElement *)ControlAccess(); + } + + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement* operator->() const + { + return (SMDS_DataMapNodeOfDataMapOfIntegerMeshElement *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)(); + + Standard_EXPORT static const Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx b/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx new file mode 100644 index 000000000..3a622987a --- /dev/null +++ b/src/SMDS/Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#define _Handle_SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_DataMapNodeOfDataMapOfPntInteger; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfPntInteger); + +class Handle(SMDS_DataMapNodeOfDataMapOfPntInteger) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)():Handle(TCollection_MapNode)() {} + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)(const Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)(const SMDS_DataMapNodeOfDataMapOfPntInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)& operator=(const Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)& operator=(const SMDS_DataMapNodeOfDataMapOfPntInteger* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_DataMapNodeOfDataMapOfPntInteger* operator->() + { + return (SMDS_DataMapNodeOfDataMapOfPntInteger *)ControlAccess(); + } + + SMDS_DataMapNodeOfDataMapOfPntInteger* operator->() const + { + return (SMDS_DataMapNodeOfDataMapOfPntInteger *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)(); + + Standard_EXPORT static const Handle(SMDS_DataMapNodeOfDataMapOfPntInteger) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_EdgePosition.hxx b/src/SMDS/Handle_SMDS_EdgePosition.hxx new file mode 100644 index 000000000..684be8bd9 --- /dev/null +++ b/src/SMDS/Handle_SMDS_EdgePosition.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_EdgePosition_HeaderFile +#define _Handle_SMDS_EdgePosition_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_Position); +class SMDS_EdgePosition; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_EdgePosition); + +class Handle(SMDS_EdgePosition) : public Handle(SMDS_Position) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_EdgePosition)():Handle(SMDS_Position)() {} + Handle(SMDS_EdgePosition)(const Handle(SMDS_EdgePosition)& aHandle) : Handle(SMDS_Position)(aHandle) + { + } + + Handle(SMDS_EdgePosition)(const SMDS_EdgePosition* anItem) : Handle(SMDS_Position)((SMDS_Position *)anItem) + { + } + + Handle(SMDS_EdgePosition)& operator=(const Handle(SMDS_EdgePosition)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_EdgePosition)& operator=(const SMDS_EdgePosition* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_EdgePosition* operator->() + { + return (SMDS_EdgePosition *)ControlAccess(); + } + + SMDS_EdgePosition* operator->() const + { + return (SMDS_EdgePosition *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_EdgePosition)(); + + Standard_EXPORT static const Handle(SMDS_EdgePosition) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_FacePosition.hxx b/src/SMDS/Handle_SMDS_FacePosition.hxx new file mode 100644 index 000000000..7c30be2a6 --- /dev/null +++ b/src/SMDS/Handle_SMDS_FacePosition.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_FacePosition_HeaderFile +#define _Handle_SMDS_FacePosition_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_Position); +class SMDS_FacePosition; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_FacePosition); + +class Handle(SMDS_FacePosition) : public Handle(SMDS_Position) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_FacePosition)():Handle(SMDS_Position)() {} + Handle(SMDS_FacePosition)(const Handle(SMDS_FacePosition)& aHandle) : Handle(SMDS_Position)(aHandle) + { + } + + Handle(SMDS_FacePosition)(const SMDS_FacePosition* anItem) : Handle(SMDS_Position)((SMDS_Position *)anItem) + { + } + + Handle(SMDS_FacePosition)& operator=(const Handle(SMDS_FacePosition)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_FacePosition)& operator=(const SMDS_FacePosition* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_FacePosition* operator->() + { + return (SMDS_FacePosition *)ControlAccess(); + } + + SMDS_FacePosition* operator->() const + { + return (SMDS_FacePosition *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_FacePosition)(); + + Standard_EXPORT static const Handle(SMDS_FacePosition) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx b/src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx new file mode 100644 index 000000000..39ce54f19 --- /dev/null +++ b/src/SMDS/Handle_SMDS_HSequenceOfMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_HSequenceOfMesh_HeaderFile +#define _Handle_SMDS_HSequenceOfMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMDS_HSequenceOfMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_HSequenceOfMesh); + +class Handle(SMDS_HSequenceOfMesh) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_HSequenceOfMesh)():Handle(MMgt_TShared)() {} + Handle(SMDS_HSequenceOfMesh)(const Handle(SMDS_HSequenceOfMesh)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMDS_HSequenceOfMesh)(const SMDS_HSequenceOfMesh* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMDS_HSequenceOfMesh)& operator=(const Handle(SMDS_HSequenceOfMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_HSequenceOfMesh)& operator=(const SMDS_HSequenceOfMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_HSequenceOfMesh* operator->() + { + return (SMDS_HSequenceOfMesh *)ControlAccess(); + } + + SMDS_HSequenceOfMesh* operator->() const + { + return (SMDS_HSequenceOfMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_HSequenceOfMesh)(); + + Standard_EXPORT static const Handle(SMDS_HSequenceOfMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx b/src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx new file mode 100644 index 000000000..a92eb7230 --- /dev/null +++ b/src/SMDS/Handle_SMDS_ListNodeOfListOfMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_ListNodeOfListOfMesh_HeaderFile +#define _Handle_SMDS_ListNodeOfListOfMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include "Handle_TCollection_MapNode.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_ListNodeOfListOfMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_ListNodeOfListOfMesh); + +class Handle(SMDS_ListNodeOfListOfMesh) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_ListNodeOfListOfMesh)():Handle(TCollection_MapNode)() {} + Handle(SMDS_ListNodeOfListOfMesh)(const Handle(SMDS_ListNodeOfListOfMesh)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_ListNodeOfListOfMesh)(const SMDS_ListNodeOfListOfMesh* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_ListNodeOfListOfMesh)& operator=(const Handle(SMDS_ListNodeOfListOfMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_ListNodeOfListOfMesh)& operator=(const SMDS_ListNodeOfListOfMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_ListNodeOfListOfMesh* operator->() + { + return (SMDS_ListNodeOfListOfMesh *)ControlAccess(); + } + + SMDS_ListNodeOfListOfMesh* operator->() const + { + return (SMDS_ListNodeOfListOfMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_ListNodeOfListOfMesh)(); + + Standard_EXPORT static const Handle(SMDS_ListNodeOfListOfMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshElement.hxx b/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshElement.hxx new file mode 100644 index 000000000..2420cfabc --- /dev/null +++ b/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshElement.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_ListNodeOfListOfMeshElement_HeaderFile +#define _Handle_SMDS_ListNodeOfListOfMeshElement_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_ListNodeOfListOfMeshElement; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_ListNodeOfListOfMeshElement); + +class Handle(SMDS_ListNodeOfListOfMeshElement) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_ListNodeOfListOfMeshElement)():Handle(TCollection_MapNode)() {} + Handle(SMDS_ListNodeOfListOfMeshElement)(const Handle(SMDS_ListNodeOfListOfMeshElement)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_ListNodeOfListOfMeshElement)(const SMDS_ListNodeOfListOfMeshElement* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_ListNodeOfListOfMeshElement)& operator=(const Handle(SMDS_ListNodeOfListOfMeshElement)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_ListNodeOfListOfMeshElement)& operator=(const SMDS_ListNodeOfListOfMeshElement* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_ListNodeOfListOfMeshElement* operator->() + { + return (SMDS_ListNodeOfListOfMeshElement *)ControlAccess(); + } + + SMDS_ListNodeOfListOfMeshElement* operator->() const + { + return (SMDS_ListNodeOfListOfMeshElement *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_ListNodeOfListOfMeshElement)(); + + Standard_EXPORT static const Handle(SMDS_ListNodeOfListOfMeshElement) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshGroup.hxx b/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshGroup.hxx new file mode 100644 index 000000000..8419da0ff --- /dev/null +++ b/src/SMDS/Handle_SMDS_ListNodeOfListOfMeshGroup.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#define _Handle_SMDS_ListNodeOfListOfMeshGroup_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_ListNodeOfListOfMeshGroup; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_ListNodeOfListOfMeshGroup); + +class Handle(SMDS_ListNodeOfListOfMeshGroup) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_ListNodeOfListOfMeshGroup)():Handle(TCollection_MapNode)() {} + Handle(SMDS_ListNodeOfListOfMeshGroup)(const Handle(SMDS_ListNodeOfListOfMeshGroup)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_ListNodeOfListOfMeshGroup)(const SMDS_ListNodeOfListOfMeshGroup* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_ListNodeOfListOfMeshGroup)& operator=(const Handle(SMDS_ListNodeOfListOfMeshGroup)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_ListNodeOfListOfMeshGroup)& operator=(const SMDS_ListNodeOfListOfMeshGroup* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_ListNodeOfListOfMeshGroup* operator->() + { + return (SMDS_ListNodeOfListOfMeshGroup *)ControlAccess(); + } + + SMDS_ListNodeOfListOfMeshGroup* operator->() const + { + return (SMDS_ListNodeOfListOfMeshGroup *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_ListNodeOfListOfMeshGroup)(); + + Standard_EXPORT static const Handle(SMDS_ListNodeOfListOfMeshGroup) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_Mesh.hxx b/src/SMDS/Handle_SMDS_Mesh.hxx new file mode 100644 index 000000000..cb78cd2a3 --- /dev/null +++ b/src/SMDS/Handle_SMDS_Mesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#define _Handle_SMDS_Mesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#include "Handle_SMDS_MeshObject.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshObject); +class SMDS_Mesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_Mesh); + +class Handle(SMDS_Mesh) : public Handle(SMDS_MeshObject) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_Mesh)():Handle(SMDS_MeshObject)() {} + Handle(SMDS_Mesh)(const Handle(SMDS_Mesh)& aHandle) : Handle(SMDS_MeshObject)(aHandle) + { + } + + Handle(SMDS_Mesh)(const SMDS_Mesh* anItem) : Handle(SMDS_MeshObject)((SMDS_MeshObject *)anItem) + { + } + + Handle(SMDS_Mesh)& operator=(const Handle(SMDS_Mesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_Mesh)& operator=(const SMDS_Mesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_Mesh* operator->() + { + return (SMDS_Mesh *)ControlAccess(); + } + + SMDS_Mesh* operator->() const + { + return (SMDS_Mesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_Mesh)(); + + Standard_EXPORT static const Handle(SMDS_Mesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshEdge.hxx b/src/SMDS/Handle_SMDS_MeshEdge.hxx new file mode 100644 index 000000000..860568447 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshEdge.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshEdge_HeaderFile +#define _Handle_SMDS_MeshEdge_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshElement); +class SMDS_MeshEdge; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshEdge); + +class Handle(SMDS_MeshEdge) : public Handle(SMDS_MeshElement) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshEdge)():Handle(SMDS_MeshElement)() {} + Handle(SMDS_MeshEdge)(const Handle(SMDS_MeshEdge)& aHandle) : Handle(SMDS_MeshElement)(aHandle) + { + } + + Handle(SMDS_MeshEdge)(const SMDS_MeshEdge* anItem) : Handle(SMDS_MeshElement)((SMDS_MeshElement *)anItem) + { + } + + Handle(SMDS_MeshEdge)& operator=(const Handle(SMDS_MeshEdge)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshEdge)& operator=(const SMDS_MeshEdge* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshEdge* operator->() + { + return (SMDS_MeshEdge *)ControlAccess(); + } + + SMDS_MeshEdge* operator->() const + { + return (SMDS_MeshEdge *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshEdge)(); + + Standard_EXPORT static const Handle(SMDS_MeshEdge) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshElement.hxx b/src/SMDS/Handle_SMDS_MeshElement.hxx new file mode 100644 index 000000000..f5108cf06 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshElement.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#define _Handle_SMDS_MeshElement_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#include "Handle_SMDS_MeshObject.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshObject); +class SMDS_MeshElement; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshElement); + +class Handle(SMDS_MeshElement) : public Handle(SMDS_MeshObject) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshElement)():Handle(SMDS_MeshObject)() {} + Handle(SMDS_MeshElement)(const Handle(SMDS_MeshElement)& aHandle) : Handle(SMDS_MeshObject)(aHandle) + { + } + + Handle(SMDS_MeshElement)(const SMDS_MeshElement* anItem) : Handle(SMDS_MeshObject)((SMDS_MeshObject *)anItem) + { + } + + Handle(SMDS_MeshElement)& operator=(const Handle(SMDS_MeshElement)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshElement)& operator=(const SMDS_MeshElement* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshElement* operator->() + { + return (SMDS_MeshElement *)ControlAccess(); + } + + SMDS_MeshElement* operator->() const + { + return (SMDS_MeshElement *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshElement)(); + + Standard_EXPORT static const Handle(SMDS_MeshElement) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx b/src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx new file mode 100644 index 000000000..d82a7bbdf --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshElementIDFactory.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshElementIDFactory_HeaderFile +#define _Handle_SMDS_MeshElementIDFactory_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile +#include "Handle_SMDS_MeshIDFactory.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshIDFactory); +class SMDS_MeshElementIDFactory; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshElementIDFactory); + +class Handle(SMDS_MeshElementIDFactory) : public Handle(SMDS_MeshIDFactory) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshElementIDFactory)():Handle(SMDS_MeshIDFactory)() {} + Handle(SMDS_MeshElementIDFactory)(const Handle(SMDS_MeshElementIDFactory)& aHandle) : Handle(SMDS_MeshIDFactory)(aHandle) + { + } + + Handle(SMDS_MeshElementIDFactory)(const SMDS_MeshElementIDFactory* anItem) : Handle(SMDS_MeshIDFactory)((SMDS_MeshIDFactory *)anItem) + { + } + + Handle(SMDS_MeshElementIDFactory)& operator=(const Handle(SMDS_MeshElementIDFactory)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshElementIDFactory)& operator=(const SMDS_MeshElementIDFactory* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshElementIDFactory* operator->() + { + return (SMDS_MeshElementIDFactory *)ControlAccess(); + } + + SMDS_MeshElementIDFactory* operator->() const + { + return (SMDS_MeshElementIDFactory *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshElementIDFactory)(); + + Standard_EXPORT static const Handle(SMDS_MeshElementIDFactory) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshFace.hxx b/src/SMDS/Handle_SMDS_MeshFace.hxx new file mode 100644 index 000000000..5e5a19002 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshFace.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshFace_HeaderFile +#define _Handle_SMDS_MeshFace_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshElement); +class SMDS_MeshFace; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshFace); + +class Handle(SMDS_MeshFace) : public Handle(SMDS_MeshElement) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshFace)():Handle(SMDS_MeshElement)() {} + Handle(SMDS_MeshFace)(const Handle(SMDS_MeshFace)& aHandle) : Handle(SMDS_MeshElement)(aHandle) + { + } + + Handle(SMDS_MeshFace)(const SMDS_MeshFace* anItem) : Handle(SMDS_MeshElement)((SMDS_MeshElement *)anItem) + { + } + + Handle(SMDS_MeshFace)& operator=(const Handle(SMDS_MeshFace)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshFace)& operator=(const SMDS_MeshFace* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshFace* operator->() + { + return (SMDS_MeshFace *)ControlAccess(); + } + + SMDS_MeshFace* operator->() const + { + return (SMDS_MeshFace *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshFace)(); + + Standard_EXPORT static const Handle(SMDS_MeshFace) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshGroup.hxx b/src/SMDS/Handle_SMDS_MeshGroup.hxx new file mode 100644 index 000000000..46b9d1de3 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshGroup.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#define _Handle_SMDS_MeshGroup_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#include "Handle_SMDS_MeshObject.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshObject); +class SMDS_MeshGroup; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshGroup); + +class Handle(SMDS_MeshGroup) : public Handle(SMDS_MeshObject) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshGroup)():Handle(SMDS_MeshObject)() {} + Handle(SMDS_MeshGroup)(const Handle(SMDS_MeshGroup)& aHandle) : Handle(SMDS_MeshObject)(aHandle) + { + } + + Handle(SMDS_MeshGroup)(const SMDS_MeshGroup* anItem) : Handle(SMDS_MeshObject)((SMDS_MeshObject *)anItem) + { + } + + Handle(SMDS_MeshGroup)& operator=(const Handle(SMDS_MeshGroup)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshGroup)& operator=(const SMDS_MeshGroup* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshGroup* operator->() + { + return (SMDS_MeshGroup *)ControlAccess(); + } + + SMDS_MeshGroup* operator->() const + { + return (SMDS_MeshGroup *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshGroup)(); + + Standard_EXPORT static const Handle(SMDS_MeshGroup) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshHexahedron.hxx b/src/SMDS/Handle_SMDS_MeshHexahedron.hxx new file mode 100644 index 000000000..3ce4ddb31 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshHexahedron.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshHexahedron_HeaderFile +#define _Handle_SMDS_MeshHexahedron_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#include "Handle_SMDS_MeshVolume.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshVolume); +class SMDS_MeshHexahedron; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshHexahedron); + +class Handle(SMDS_MeshHexahedron) : public Handle(SMDS_MeshVolume) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshHexahedron)():Handle(SMDS_MeshVolume)() {} + Handle(SMDS_MeshHexahedron)(const Handle(SMDS_MeshHexahedron)& aHandle) : Handle(SMDS_MeshVolume)(aHandle) + { + } + + Handle(SMDS_MeshHexahedron)(const SMDS_MeshHexahedron* anItem) : Handle(SMDS_MeshVolume)((SMDS_MeshVolume *)anItem) + { + } + + Handle(SMDS_MeshHexahedron)& operator=(const Handle(SMDS_MeshHexahedron)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshHexahedron)& operator=(const SMDS_MeshHexahedron* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshHexahedron* operator->() + { + return (SMDS_MeshHexahedron *)ControlAccess(); + } + + SMDS_MeshHexahedron* operator->() const + { + return (SMDS_MeshHexahedron *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshHexahedron)(); + + Standard_EXPORT static const Handle(SMDS_MeshHexahedron) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshIDFactory.hxx b/src/SMDS/Handle_SMDS_MeshIDFactory.hxx new file mode 100644 index 000000000..9773a37d5 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshIDFactory.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile +#define _Handle_SMDS_MeshIDFactory_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#include "Handle_SMDS_MeshObject.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshObject); +class SMDS_MeshIDFactory; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshIDFactory); + +class Handle(SMDS_MeshIDFactory) : public Handle(SMDS_MeshObject) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshIDFactory)():Handle(SMDS_MeshObject)() {} + Handle(SMDS_MeshIDFactory)(const Handle(SMDS_MeshIDFactory)& aHandle) : Handle(SMDS_MeshObject)(aHandle) + { + } + + Handle(SMDS_MeshIDFactory)(const SMDS_MeshIDFactory* anItem) : Handle(SMDS_MeshObject)((SMDS_MeshObject *)anItem) + { + } + + Handle(SMDS_MeshIDFactory)& operator=(const Handle(SMDS_MeshIDFactory)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshIDFactory)& operator=(const SMDS_MeshIDFactory* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshIDFactory* operator->() + { + return (SMDS_MeshIDFactory *)ControlAccess(); + } + + SMDS_MeshIDFactory* operator->() const + { + return (SMDS_MeshIDFactory *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshIDFactory)(); + + Standard_EXPORT static const Handle(SMDS_MeshIDFactory) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshNode.hxx b/src/SMDS/Handle_SMDS_MeshNode.hxx new file mode 100644 index 000000000..0533398d1 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshNode.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshNode_HeaderFile +#define _Handle_SMDS_MeshNode_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshElement); +class SMDS_MeshNode; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshNode); + +class Handle(SMDS_MeshNode) : public Handle(SMDS_MeshElement) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshNode)():Handle(SMDS_MeshElement)() {} + Handle(SMDS_MeshNode)(const Handle(SMDS_MeshNode)& aHandle) : Handle(SMDS_MeshElement)(aHandle) + { + } + + Handle(SMDS_MeshNode)(const SMDS_MeshNode* anItem) : Handle(SMDS_MeshElement)((SMDS_MeshElement *)anItem) + { + } + + Handle(SMDS_MeshNode)& operator=(const Handle(SMDS_MeshNode)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshNode)& operator=(const SMDS_MeshNode* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshNode* operator->() + { + return (SMDS_MeshNode *)ControlAccess(); + } + + SMDS_MeshNode* operator->() const + { + return (SMDS_MeshNode *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshNode)(); + + Standard_EXPORT static const Handle(SMDS_MeshNode) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx b/src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx new file mode 100644 index 000000000..268ae5eb0 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshNodeIDFactory.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshNodeIDFactory_HeaderFile +#define _Handle_SMDS_MeshNodeIDFactory_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile +#include "Handle_SMDS_MeshIDFactory.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshIDFactory); +class SMDS_MeshNodeIDFactory; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshNodeIDFactory); + +class Handle(SMDS_MeshNodeIDFactory) : public Handle(SMDS_MeshIDFactory) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshNodeIDFactory)():Handle(SMDS_MeshIDFactory)() {} + Handle(SMDS_MeshNodeIDFactory)(const Handle(SMDS_MeshNodeIDFactory)& aHandle) : Handle(SMDS_MeshIDFactory)(aHandle) + { + } + + Handle(SMDS_MeshNodeIDFactory)(const SMDS_MeshNodeIDFactory* anItem) : Handle(SMDS_MeshIDFactory)((SMDS_MeshIDFactory *)anItem) + { + } + + Handle(SMDS_MeshNodeIDFactory)& operator=(const Handle(SMDS_MeshNodeIDFactory)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshNodeIDFactory)& operator=(const SMDS_MeshNodeIDFactory* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshNodeIDFactory* operator->() + { + return (SMDS_MeshNodeIDFactory *)ControlAccess(); + } + + SMDS_MeshNodeIDFactory* operator->() const + { + return (SMDS_MeshNodeIDFactory *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshNodeIDFactory)(); + + Standard_EXPORT static const Handle(SMDS_MeshNodeIDFactory) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshObject.hxx b/src/SMDS/Handle_SMDS_MeshObject.hxx new file mode 100644 index 000000000..84589e839 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshObject.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#define _Handle_SMDS_MeshObject_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMDS_MeshObject; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshObject); + +class Handle(SMDS_MeshObject) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshObject)():Handle(MMgt_TShared)() {} + Handle(SMDS_MeshObject)(const Handle(SMDS_MeshObject)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMDS_MeshObject)(const SMDS_MeshObject* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMDS_MeshObject)& operator=(const Handle(SMDS_MeshObject)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshObject)& operator=(const SMDS_MeshObject* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshObject* operator->() + { + return (SMDS_MeshObject *)ControlAccess(); + } + + SMDS_MeshObject* operator->() const + { + return (SMDS_MeshObject *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshObject)(); + + Standard_EXPORT static const Handle(SMDS_MeshObject) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshPrism.hxx b/src/SMDS/Handle_SMDS_MeshPrism.hxx new file mode 100644 index 000000000..9725c8db6 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshPrism.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshPrism_HeaderFile +#define _Handle_SMDS_MeshPrism_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#include "Handle_SMDS_MeshVolume.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshVolume); +class SMDS_MeshPrism; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshPrism); + +class Handle(SMDS_MeshPrism) : public Handle(SMDS_MeshVolume) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshPrism)():Handle(SMDS_MeshVolume)() {} + Handle(SMDS_MeshPrism)(const Handle(SMDS_MeshPrism)& aHandle) : Handle(SMDS_MeshVolume)(aHandle) + { + } + + Handle(SMDS_MeshPrism)(const SMDS_MeshPrism* anItem) : Handle(SMDS_MeshVolume)((SMDS_MeshVolume *)anItem) + { + } + + Handle(SMDS_MeshPrism)& operator=(const Handle(SMDS_MeshPrism)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshPrism)& operator=(const SMDS_MeshPrism* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshPrism* operator->() + { + return (SMDS_MeshPrism *)ControlAccess(); + } + + SMDS_MeshPrism* operator->() const + { + return (SMDS_MeshPrism *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshPrism)(); + + Standard_EXPORT static const Handle(SMDS_MeshPrism) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshPyramid.hxx b/src/SMDS/Handle_SMDS_MeshPyramid.hxx new file mode 100644 index 000000000..16b6bad9c --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshPyramid.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshPyramid_HeaderFile +#define _Handle_SMDS_MeshPyramid_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#include "Handle_SMDS_MeshVolume.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshVolume); +class SMDS_MeshPyramid; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshPyramid); + +class Handle(SMDS_MeshPyramid) : public Handle(SMDS_MeshVolume) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshPyramid)():Handle(SMDS_MeshVolume)() {} + Handle(SMDS_MeshPyramid)(const Handle(SMDS_MeshPyramid)& aHandle) : Handle(SMDS_MeshVolume)(aHandle) + { + } + + Handle(SMDS_MeshPyramid)(const SMDS_MeshPyramid* anItem) : Handle(SMDS_MeshVolume)((SMDS_MeshVolume *)anItem) + { + } + + Handle(SMDS_MeshPyramid)& operator=(const Handle(SMDS_MeshPyramid)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshPyramid)& operator=(const SMDS_MeshPyramid* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshPyramid* operator->() + { + return (SMDS_MeshPyramid *)ControlAccess(); + } + + SMDS_MeshPyramid* operator->() const + { + return (SMDS_MeshPyramid *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshPyramid)(); + + Standard_EXPORT static const Handle(SMDS_MeshPyramid) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshQuadrangle.hxx b/src/SMDS/Handle_SMDS_MeshQuadrangle.hxx new file mode 100644 index 000000000..9a79fff3e --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshQuadrangle.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshQuadrangle_HeaderFile +#define _Handle_SMDS_MeshQuadrangle_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshFace_HeaderFile +#include "Handle_SMDS_MeshFace.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshFace); +class SMDS_MeshQuadrangle; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshQuadrangle); + +class Handle(SMDS_MeshQuadrangle) : public Handle(SMDS_MeshFace) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshQuadrangle)():Handle(SMDS_MeshFace)() {} + Handle(SMDS_MeshQuadrangle)(const Handle(SMDS_MeshQuadrangle)& aHandle) : Handle(SMDS_MeshFace)(aHandle) + { + } + + Handle(SMDS_MeshQuadrangle)(const SMDS_MeshQuadrangle* anItem) : Handle(SMDS_MeshFace)((SMDS_MeshFace *)anItem) + { + } + + Handle(SMDS_MeshQuadrangle)& operator=(const Handle(SMDS_MeshQuadrangle)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshQuadrangle)& operator=(const SMDS_MeshQuadrangle* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshQuadrangle* operator->() + { + return (SMDS_MeshQuadrangle *)ControlAccess(); + } + + SMDS_MeshQuadrangle* operator->() const + { + return (SMDS_MeshQuadrangle *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshQuadrangle)(); + + Standard_EXPORT static const Handle(SMDS_MeshQuadrangle) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshTetrahedron.hxx b/src/SMDS/Handle_SMDS_MeshTetrahedron.hxx new file mode 100644 index 000000000..d615d020c --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshTetrahedron.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshTetrahedron_HeaderFile +#define _Handle_SMDS_MeshTetrahedron_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#include "Handle_SMDS_MeshVolume.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshVolume); +class SMDS_MeshTetrahedron; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshTetrahedron); + +class Handle(SMDS_MeshTetrahedron) : public Handle(SMDS_MeshVolume) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshTetrahedron)():Handle(SMDS_MeshVolume)() {} + Handle(SMDS_MeshTetrahedron)(const Handle(SMDS_MeshTetrahedron)& aHandle) : Handle(SMDS_MeshVolume)(aHandle) + { + } + + Handle(SMDS_MeshTetrahedron)(const SMDS_MeshTetrahedron* anItem) : Handle(SMDS_MeshVolume)((SMDS_MeshVolume *)anItem) + { + } + + Handle(SMDS_MeshTetrahedron)& operator=(const Handle(SMDS_MeshTetrahedron)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshTetrahedron)& operator=(const SMDS_MeshTetrahedron* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshTetrahedron* operator->() + { + return (SMDS_MeshTetrahedron *)ControlAccess(); + } + + SMDS_MeshTetrahedron* operator->() const + { + return (SMDS_MeshTetrahedron *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshTetrahedron)(); + + Standard_EXPORT static const Handle(SMDS_MeshTetrahedron) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshTriangle.hxx b/src/SMDS/Handle_SMDS_MeshTriangle.hxx new file mode 100644 index 000000000..6f7465b0a --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshTriangle.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshTriangle_HeaderFile +#define _Handle_SMDS_MeshTriangle_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshFace_HeaderFile +#include "Handle_SMDS_MeshFace.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshFace); +class SMDS_MeshTriangle; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshTriangle); + +class Handle(SMDS_MeshTriangle) : public Handle(SMDS_MeshFace) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshTriangle)():Handle(SMDS_MeshFace)() {} + Handle(SMDS_MeshTriangle)(const Handle(SMDS_MeshTriangle)& aHandle) : Handle(SMDS_MeshFace)(aHandle) + { + } + + Handle(SMDS_MeshTriangle)(const SMDS_MeshTriangle* anItem) : Handle(SMDS_MeshFace)((SMDS_MeshFace *)anItem) + { + } + + Handle(SMDS_MeshTriangle)& operator=(const Handle(SMDS_MeshTriangle)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshTriangle)& operator=(const SMDS_MeshTriangle* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshTriangle* operator->() + { + return (SMDS_MeshTriangle *)ControlAccess(); + } + + SMDS_MeshTriangle* operator->() const + { + return (SMDS_MeshTriangle *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshTriangle)(); + + Standard_EXPORT static const Handle(SMDS_MeshTriangle) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_MeshVolume.hxx b/src/SMDS/Handle_SMDS_MeshVolume.hxx new file mode 100644 index 000000000..629f52ea7 --- /dev/null +++ b/src/SMDS/Handle_SMDS_MeshVolume.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#define _Handle_SMDS_MeshVolume_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_MeshElement); +class SMDS_MeshVolume; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_MeshVolume); + +class Handle(SMDS_MeshVolume) : public Handle(SMDS_MeshElement) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_MeshVolume)():Handle(SMDS_MeshElement)() {} + Handle(SMDS_MeshVolume)(const Handle(SMDS_MeshVolume)& aHandle) : Handle(SMDS_MeshElement)(aHandle) + { + } + + Handle(SMDS_MeshVolume)(const SMDS_MeshVolume* anItem) : Handle(SMDS_MeshElement)((SMDS_MeshElement *)anItem) + { + } + + Handle(SMDS_MeshVolume)& operator=(const Handle(SMDS_MeshVolume)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_MeshVolume)& operator=(const SMDS_MeshVolume* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_MeshVolume* operator->() + { + return (SMDS_MeshVolume *)ControlAccess(); + } + + SMDS_MeshVolume* operator->() const + { + return (SMDS_MeshVolume *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_MeshVolume)(); + + Standard_EXPORT static const Handle(SMDS_MeshVolume) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_Position.hxx b/src/SMDS/Handle_SMDS_Position.hxx new file mode 100644 index 000000000..3d32a83cd --- /dev/null +++ b/src/SMDS/Handle_SMDS_Position.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_Position_HeaderFile +#define _Handle_SMDS_Position_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMDS_Position; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_Position); + +class Handle(SMDS_Position) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_Position)():Handle(MMgt_TShared)() {} + Handle(SMDS_Position)(const Handle(SMDS_Position)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMDS_Position)(const SMDS_Position* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMDS_Position)& operator=(const Handle(SMDS_Position)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_Position)& operator=(const SMDS_Position* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_Position* operator->() + { + return (SMDS_Position *)ControlAccess(); + } + + SMDS_Position* operator->() const + { + return (SMDS_Position *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_Position)(); + + Standard_EXPORT static const Handle(SMDS_Position) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx b/src/SMDS/Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx new file mode 100644 index 000000000..406b5327a --- /dev/null +++ b/src/SMDS/Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile +#define _Handle_SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_SeqNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_SeqNode); +class SMDS_SequenceNodeOfSequenceOfMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_SequenceNodeOfSequenceOfMesh); + +class Handle(SMDS_SequenceNodeOfSequenceOfMesh) : public Handle(TCollection_SeqNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_SequenceNodeOfSequenceOfMesh)():Handle(TCollection_SeqNode)() {} + Handle(SMDS_SequenceNodeOfSequenceOfMesh)(const Handle(SMDS_SequenceNodeOfSequenceOfMesh)& aHandle) : Handle(TCollection_SeqNode)(aHandle) + { + } + + Handle(SMDS_SequenceNodeOfSequenceOfMesh)(const SMDS_SequenceNodeOfSequenceOfMesh* anItem) : Handle(TCollection_SeqNode)((TCollection_SeqNode *)anItem) + { + } + + Handle(SMDS_SequenceNodeOfSequenceOfMesh)& operator=(const Handle(SMDS_SequenceNodeOfSequenceOfMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_SequenceNodeOfSequenceOfMesh)& operator=(const SMDS_SequenceNodeOfSequenceOfMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_SequenceNodeOfSequenceOfMesh* operator->() + { + return (SMDS_SequenceNodeOfSequenceOfMesh *)ControlAccess(); + } + + SMDS_SequenceNodeOfSequenceOfMesh* operator->() const + { + return (SMDS_SequenceNodeOfSequenceOfMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_SequenceNodeOfSequenceOfMesh)(); + + Standard_EXPORT static const Handle(SMDS_SequenceNodeOfSequenceOfMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_SpacePosition.hxx b/src/SMDS/Handle_SMDS_SpacePosition.hxx new file mode 100644 index 000000000..33402f423 --- /dev/null +++ b/src/SMDS/Handle_SMDS_SpacePosition.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_SpacePosition_HeaderFile +#define _Handle_SMDS_SpacePosition_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_Position); +class SMDS_SpacePosition; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_SpacePosition); + +class Handle(SMDS_SpacePosition) : public Handle(SMDS_Position) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_SpacePosition)():Handle(SMDS_Position)() {} + Handle(SMDS_SpacePosition)(const Handle(SMDS_SpacePosition)& aHandle) : Handle(SMDS_Position)(aHandle) + { + } + + Handle(SMDS_SpacePosition)(const SMDS_SpacePosition* anItem) : Handle(SMDS_Position)((SMDS_Position *)anItem) + { + } + + Handle(SMDS_SpacePosition)& operator=(const Handle(SMDS_SpacePosition)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_SpacePosition)& operator=(const SMDS_SpacePosition* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_SpacePosition* operator->() + { + return (SMDS_SpacePosition *)ControlAccess(); + } + + SMDS_SpacePosition* operator->() const + { + return (SMDS_SpacePosition *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_SpacePosition)(); + + Standard_EXPORT static const Handle(SMDS_SpacePosition) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedMap.hxx b/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedMap.hxx new file mode 100644 index 000000000..1be9999d2 --- /dev/null +++ b/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedMap.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_StdMapNodeOfExtendedMap_HeaderFile +#define _Handle_SMDS_StdMapNodeOfExtendedMap_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include "Handle_TCollection_MapNode.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_StdMapNodeOfExtendedMap; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_StdMapNodeOfExtendedMap); + +class Handle(SMDS_StdMapNodeOfExtendedMap) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_StdMapNodeOfExtendedMap)():Handle(TCollection_MapNode)() {} + Handle(SMDS_StdMapNodeOfExtendedMap)(const Handle(SMDS_StdMapNodeOfExtendedMap)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_StdMapNodeOfExtendedMap)(const SMDS_StdMapNodeOfExtendedMap* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_StdMapNodeOfExtendedMap)& operator=(const Handle(SMDS_StdMapNodeOfExtendedMap)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_StdMapNodeOfExtendedMap)& operator=(const SMDS_StdMapNodeOfExtendedMap* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_StdMapNodeOfExtendedMap* operator->() + { + return (SMDS_StdMapNodeOfExtendedMap *)ControlAccess(); + } + + SMDS_StdMapNodeOfExtendedMap* operator->() const + { + return (SMDS_StdMapNodeOfExtendedMap *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_StdMapNodeOfExtendedMap)(); + + Standard_EXPORT static const Handle(SMDS_StdMapNodeOfExtendedMap) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx b/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx new file mode 100644 index 000000000..647478a51 --- /dev/null +++ b/src/SMDS/Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#define _Handle_SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include "Handle_TCollection_MapNode.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMDS_StdMapNodeOfExtendedOrientedMap; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_StdMapNodeOfExtendedOrientedMap); + +class Handle(SMDS_StdMapNodeOfExtendedOrientedMap) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_StdMapNodeOfExtendedOrientedMap)():Handle(TCollection_MapNode)() {} + Handle(SMDS_StdMapNodeOfExtendedOrientedMap)(const Handle(SMDS_StdMapNodeOfExtendedOrientedMap)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMDS_StdMapNodeOfExtendedOrientedMap)(const SMDS_StdMapNodeOfExtendedOrientedMap* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMDS_StdMapNodeOfExtendedOrientedMap)& operator=(const Handle(SMDS_StdMapNodeOfExtendedOrientedMap)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_StdMapNodeOfExtendedOrientedMap)& operator=(const SMDS_StdMapNodeOfExtendedOrientedMap* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_StdMapNodeOfExtendedOrientedMap* operator->() + { + return (SMDS_StdMapNodeOfExtendedOrientedMap *)ControlAccess(); + } + + SMDS_StdMapNodeOfExtendedOrientedMap* operator->() const + { + return (SMDS_StdMapNodeOfExtendedOrientedMap *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_StdMapNodeOfExtendedOrientedMap)(); + + Standard_EXPORT static const Handle(SMDS_StdMapNodeOfExtendedOrientedMap) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Handle_SMDS_VertexPosition.hxx b/src/SMDS/Handle_SMDS_VertexPosition.hxx new file mode 100644 index 000000000..514193605 --- /dev/null +++ b/src/SMDS/Handle_SMDS_VertexPosition.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMDS_VertexPosition_HeaderFile +#define _Handle_SMDS_VertexPosition_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_Position); +class SMDS_VertexPosition; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMDS_VertexPosition); + +class Handle(SMDS_VertexPosition) : public Handle(SMDS_Position) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMDS_VertexPosition)():Handle(SMDS_Position)() {} + Handle(SMDS_VertexPosition)(const Handle(SMDS_VertexPosition)& aHandle) : Handle(SMDS_Position)(aHandle) + { + } + + Handle(SMDS_VertexPosition)(const SMDS_VertexPosition* anItem) : Handle(SMDS_Position)((SMDS_Position *)anItem) + { + } + + Handle(SMDS_VertexPosition)& operator=(const Handle(SMDS_VertexPosition)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMDS_VertexPosition)& operator=(const SMDS_VertexPosition* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMDS_VertexPosition* operator->() + { + return (SMDS_VertexPosition *)ControlAccess(); + } + + SMDS_VertexPosition* operator->() const + { + return (SMDS_VertexPosition *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMDS_VertexPosition)(); + + Standard_EXPORT static const Handle(SMDS_VertexPosition) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMDS/Makefile.in b/src/SMDS/Makefile.in new file mode 100644 index 000000000..0ef49c55f --- /dev/null +++ b/src/SMDS/Makefile.in @@ -0,0 +1,263 @@ +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 29/06/2001 +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets + +LIB = libSMDS.la +LIB_SRC = SMDS_BasicMap.lxx \ + SMDS_BasicMapIterator.lxx \ + SMDS_EdgePosition.cxx \ + SMDS_EdgePosition.lxx \ + SMDS_FacePosition.cxx \ + SMDS_FacePosition.lxx \ + SMDS_Map.gxx \ + SMDS_MapHasher.gxx \ + SMDS_MapIterator.gxx \ + SMDS_MapOfMeshElement.cxx \ + SMDS_MapOfMeshElement.lxx \ + SMDS_MapOfMeshOrientedElement.cxx \ + SMDS_MapOfMeshOrientedElement.lxx \ + SMDS_Mesh.cxx \ + SMDS_Mesh.lxx \ + SMDS_MeshEdge.cxx \ + SMDS_MeshEdge.lxx \ + SMDS_MeshEdgesIterator.cxx \ + SMDS_MeshElement.cxx \ + SMDS_MeshElement.lxx \ + SMDS_MeshElementIDFactory.cxx \ + SMDS_MeshElementIDFactory.lxx \ + SMDS_MeshElementMapHasher.cxx \ + SMDS_MeshElementMapHasher.lxx \ + SMDS_MeshElementsIterator.cxx \ + SMDS_MeshElementsIterator.lxx \ + SMDS_MeshFace.cxx \ + SMDS_MeshFace.lxx \ + SMDS_MeshFacesIterator.cxx \ + SMDS_MeshHexahedron.cxx \ + SMDS_MeshHexahedron.lxx \ + SMDS_MeshIDFactory.cxx \ + SMDS_MeshIDFactory.lxx \ + SMDS_MeshNode.cxx \ + SMDS_MeshNode.lxx \ + SMDS_MeshNodeIDFactory.cxx \ + SMDS_MeshNodeIDFactory.lxx \ + SMDS_MeshNodesIterator.cxx \ + SMDS_MeshObject.cxx \ + SMDS_MeshOrientedElementMapHasher.cxx \ + SMDS_MeshOrientedElementMapHasher.lxx \ + SMDS_MeshPrism.cxx \ + SMDS_MeshPrism.lxx \ + SMDS_MeshPyramid.cxx \ + SMDS_MeshPyramid.lxx \ + SMDS_MeshQuadrangle.cxx \ + SMDS_MeshQuadrangle.lxx \ + SMDS_MeshTetrahedron.cxx \ + SMDS_MeshTetrahedron.lxx \ + SMDS_MeshTriangle.cxx \ + SMDS_MeshTriangle.lxx \ + SMDS_MeshVolume.cxx \ + SMDS_MeshVolume.lxx \ + SMDS_MeshVolumesIterator.cxx \ + SMDS_PntHasher.cxx \ + SMDS_PntHasher.lxx \ + SMDS_Position.cxx \ + SMDS_Position.lxx \ + SMDS_SpacePosition.cxx \ + SMDS_SpacePosition.lxx \ + SMDS_StdMapNode.gxx \ + SMDS_StdMapNode.lxx \ + SMDS_VertexPosition.cxx \ + SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx \ + SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx \ + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx \ + SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx \ + SMDS_DataMapOfIntegerMeshElement_0.cxx \ + SMDS_DataMapOfPntInteger_0.cxx \ + SMDS_ExtendedMap_0.cxx \ + SMDS_ExtendedOrientedMap_0.cxx \ + SMDS_ListIteratorOfListOfMeshElement_0.cxx \ + SMDS_ListIteratorOfListOfMesh_0.cxx \ + SMDS_ListNodeOfListOfMeshElement_0.cxx \ + SMDS_ListNodeOfListOfMesh_0.cxx \ + SMDS_ListOfMeshElement_0.cxx \ + SMDS_ListOfMesh_0.cxx \ + SMDS_MapIteratorOfExtendedMap_0.cxx \ + SMDS_MapIteratorOfExtendedOrientedMap_0.cxx \ + SMDS_StdMapNodeOfExtendedMap_0.cxx \ + SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx \ + SMDSControl.cxx \ + SMDSControl_BoundaryFaces.cxx \ + SMDSControl_BoundaryEdges.cxx \ + SMDSControl_MeshBoundary.cxx \ + SMDS_ListIteratorOfListOfMeshGroup_0.cxx \ + SMDS_ListOfMeshGroup_0.cxx \ + SMDS_ListNodeOfListOfMeshGroup_0.cxx \ + SMDS_MeshGroup.cxx \ + SMDSEdit_Transform.cxx \ + SMDS_HSequenceOfMesh_0.cxx \ + SMDS_SequenceNodeOfSequenceOfMesh_0.cxx \ + SMDS_SequenceOfMesh_0.cxx + + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +# header files +EXPORT_HEADERS= Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx \ + Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx \ + Handle_SMDS_EdgePosition.hxx \ + Handle_SMDS_FacePosition.hxx \ + Handle_SMDS_ListNodeOfListOfMesh.hxx \ + Handle_SMDS_ListNodeOfListOfMeshElement.hxx \ + Handle_SMDS_Mesh.hxx \ + Handle_SMDS_MeshEdge.hxx \ + Handle_SMDS_MeshElement.hxx \ + Handle_SMDS_MeshElementIDFactory.hxx \ + Handle_SMDS_MeshFace.hxx \ + Handle_SMDS_MeshHexahedron.hxx \ + Handle_SMDS_MeshIDFactory.hxx \ + Handle_SMDS_MeshNode.hxx \ + Handle_SMDS_MeshNodeIDFactory.hxx \ + Handle_SMDS_MeshObject.hxx \ + Handle_SMDS_MeshPrism.hxx \ + Handle_SMDS_MeshPyramid.hxx \ + Handle_SMDS_MeshQuadrangle.hxx \ + Handle_SMDS_MeshTetrahedron.hxx \ + Handle_SMDS_MeshTriangle.hxx \ + Handle_SMDS_MeshVolume.hxx \ + Handle_SMDS_Position.hxx \ + Handle_SMDS_SpacePosition.hxx \ + Handle_SMDS_StdMapNodeOfExtendedMap.hxx \ + Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx \ + Handle_SMDS_VertexPosition.hxx \ + SMDS_BasicMap.lxx \ + SMDS_BasicMapIterator.lxx \ + SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx \ + SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx \ + SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx \ + SMDS_DataMapNodeOfDataMapOfPntInteger.hxx \ + SMDS_DataMapOfIntegerMeshElement.hxx \ + SMDS_DataMapOfPntInteger.hxx \ + SMDS_EdgePosition.hxx \ + SMDS_EdgePosition.lxx \ + SMDS_ExtendedMap.hxx \ + SMDS_ExtendedOrientedMap.hxx \ + SMDS_FacePosition.hxx \ + SMDS_FacePosition.lxx \ + SMDS_ListIteratorOfListOfMesh.hxx \ + SMDS_ListIteratorOfListOfMeshElement.hxx \ + SMDS_ListNodeOfListOfMesh.hxx \ + SMDS_ListNodeOfListOfMeshElement.hxx \ + SMDS_ListOfMesh.hxx \ + SMDS_ListOfMeshElement.hxx \ + SMDS_MapIteratorOfExtendedMap.hxx \ + SMDS_MapIteratorOfExtendedOrientedMap.hxx \ + SMDS_MapNode.lxx \ + SMDS_MapOfMeshElement.hxx \ + SMDS_MapOfMeshElement.lxx \ + SMDS_MapOfMeshOrientedElement.hxx \ + SMDS_MapOfMeshOrientedElement.lxx \ + SMDS_Mesh.hxx \ + SMDS_Mesh.lxx \ + SMDS_MeshEdge.hxx \ + SMDS_MeshEdge.lxx \ + SMDS_MeshEdgesIterator.hxx \ + SMDS_MeshElement.hxx \ + SMDS_MeshElement.lxx \ + SMDS_MeshElementIDFactory.hxx \ + SMDS_MeshElementIDFactory.lxx \ + SMDS_MeshElementMapHasher.hxx \ + SMDS_MeshElementMapHasher.lxx \ + SMDS_MeshElementsIterator.hxx \ + SMDS_MeshElementsIterator.lxx \ + SMDS_MeshFace.hxx \ + SMDS_MeshFace.lxx \ + SMDS_MeshFacesIterator.hxx \ + SMDS_MeshHexahedron.hxx \ + SMDS_MeshHexahedron.lxx \ + SMDS_MeshIDFactory.hxx \ + SMDS_MeshIDFactory.lxx \ + SMDS_MeshNode.hxx \ + SMDS_MeshNode.lxx \ + SMDS_MeshNodeIDFactory.hxx \ + SMDS_MeshNodeIDFactory.lxx \ + SMDS_MeshNodesIterator.hxx \ + SMDS_MeshObject.hxx \ + SMDS_MeshOrientedElementMapHasher.hxx \ + SMDS_MeshOrientedElementMapHasher.lxx \ + SMDS_MeshPrism.hxx \ + SMDS_MeshPrism.lxx \ + SMDS_MeshPyramid.hxx \ + SMDS_MeshPyramid.lxx \ + SMDS_MeshQuadrangle.hxx \ + SMDS_MeshQuadrangle.lxx \ + SMDS_MeshTetrahedron.hxx \ + SMDS_MeshTetrahedron.lxx \ + SMDS_MeshTriangle.hxx \ + SMDS_MeshTriangle.lxx \ + SMDS_MeshVolume.hxx \ + SMDS_MeshVolume.lxx \ + SMDS_MeshVolumesIterator.hxx \ + SMDS_PntHasher.hxx \ + SMDS_PntHasher.lxx \ + SMDS_Position.hxx \ + SMDS_Position.lxx \ + SMDS_SpacePosition.hxx \ + SMDS_SpacePosition.lxx \ + SMDS_StdMapNode.lxx \ + SMDS_StdMapNodeOfExtendedMap.hxx \ + SMDS_StdMapNodeOfExtendedOrientedMap.hxx \ + SMDS_TypeOfPosition.hxx \ + SMDS_VertexPosition.hxx \ + Handle_SMDSControl_BoundaryEdges.hxx \ + SMDSEdit_Transform.hxx \ + Handle_SMDSControl_BoundaryFaces.hxx \ + SMDS_HSequenceOfMesh.hxx \ + Handle_SMDSControl_MeshBoundary.hxx \ + SMDS_ListIteratorOfListOfMeshGroup.hxx \ + Handle_SMDS_HSequenceOfMesh.hxx \ + SMDS_ListNodeOfListOfMeshGroup.hxx \ + Handle_SMDS_ListNodeOfListOfMeshGroup.hxx \ + SMDS_ListOfMeshGroup.hxx \ + Handle_SMDS_MeshGroup.hxx \ + SMDSAbs_ElementType.hxx \ + SMDSControl.hxx \ + SMDS_MeshGroup.hxx \ + SMDSControl_BoundaryEdges.hxx \ + SMDS_MeshGroup.lxx \ + SMDSControl_BoundaryFaces.hxx \ + SMDS_SequenceNodeOfSequenceOfMesh.hxx \ + SMDSControl_MeshBoundary.hxx \ + SMDS_SequenceOfMesh.hxx + + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(OCC_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ + diff --git a/src/SMDS/SMDS.cdl b/src/SMDS/SMDS.cdl new file mode 100755 index 000000000..17b2407ae --- /dev/null +++ b/src/SMDS/SMDS.cdl @@ -0,0 +1,148 @@ +-- File: SMDS.cdl +-- Created: Wed Jan 23 11:53:00 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +package SMDS + + ---Purpose: This package provides the classes Mesh and MeshElement + -- + -- class Mesh: + -- - contains the main definition of the + -- mesh and have access to the MeshElement objects + -- + -- class MeshElement: + -- - defines the topological constituants of the Mesh (i.e + -- the Node, Edge, Face and Volume entities. + -- + -- These two last classes inherits from an abstract + -- class MeshObject. + +uses + SMDSAbs, + MMgt, + TCollection, + TColStd, + TColgp, + gp + + +is + + ---================================= + ---Category: enumerations + -- + ---================================= + + enumeration TypeOfPosition is + TOP_UNSPEC, + TOP_3DSPACE, + TOP_VERTEX, + TOP_EDGE, + TOP_FACE + end TypeOfPosition; + ---Purpose: defines the type of position of a node (see SMDS_Position) + -- TOP_UNSPEC : node position not specfied + -- TOP_3DSPACE : just a 3d point in space not related + -- to a CAD geometry + -- TOP_VERTEX : to characterize a node with a CAD vertex + -- TOP_EDGE : to characterize a node with a CAD edge + -- TOP_FACE : to characterize a node with a CAD face + + ---===================================== + ---Category: public classes + -- Mesh object related classes + ---===================================== + + class MeshOrientedElementMapHasher; + + class MeshElementMapHasher; + + class PntHasher; + + deferred class MeshObject; + + class Mesh; + + deferred class MeshElement; + class MeshNode; + class MeshEdge; + deferred class MeshFace; + class MeshTriangle; + class MeshQuadrangle; + deferred class MeshVolume; + class MeshTetrahedron; + class MeshPyramid; + class MeshPrism; + class MeshHexahedron; + + private deferred class MeshIDFactory; + private class MeshNodeIDFactory; + private class MeshElementIDFactory; + + deferred class MeshElementsIterator; + class MeshVolumesIterator; + class MeshFacesIterator; + class MeshEdgesIterator; + class MeshNodesIterator; + + + deferred class Position; + class SpacePosition; + class VertexPosition; + class EdgePosition; + class FacePosition; + + ---================================= + ---Category: public classes + -- Mesh group + ---================================= + + class MeshGroup; + + ---================================= + ---Category: public classes + -- Mesh collection classes + ---================================= + + class ExtendedMap + instantiates Map from TCollection (MeshElement from SMDS, + MeshElementMapHasher from SMDS); + + class ExtendedOrientedMap + instantiates Map from TCollection (MeshElement from SMDS, + MeshOrientedElementMapHasher from SMDS); + + class DataMapOfPntInteger + instantiates DataMap from TCollection (Pnt from gp, + Integer, + PntHasher from SMDS); + class DataMapOfIntegerMeshElement instantiates + DataMap from TCollection(Integer,MeshElement from SMDS, + MapIntegerHasher from TColStd); + + class ListOfMeshElement + instantiates List from TCollection (MeshElement from SMDS); + + class ListOfMesh + instantiates List from TCollection (Mesh from SMDS); + + class MapOfMeshElement; + + class MapOfMeshOrientedElement; + + class SequenceOfMesh + instantiates Sequence from TCollection (Mesh from SMDS); + + class HSequenceOfMesh + instantiates HSequence from TCollection (Mesh from SMDS, + SequenceOfMesh from SMDS); + + + class ListOfMeshGroup + instantiates List from TCollection(MeshGroup from SMDS); + +end SMDS; + diff --git a/src/SMDS/SMDSAbs.cdl b/src/SMDS/SMDSAbs.cdl new file mode 100644 index 000000000..49e3e11bb --- /dev/null +++ b/src/SMDS/SMDSAbs.cdl @@ -0,0 +1,24 @@ +-- File: SMDSAbs.cdl +-- Created: Mon Jun 3 11:57:33 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +package SMDSAbs + + ---Purpose: This package provides enumeration and resources + -- for SMDS mesh +is + + enumeration ElementType is + All, + Node, + Edge, + Face, + Volume + end ElementType; + ---Purpose: type of mesh elements + + +end SMDSAbs; diff --git a/src/SMDS/SMDSAbs_ElementType.hxx b/src/SMDS/SMDSAbs_ElementType.hxx new file mode 100644 index 000000000..4eb8161f0 --- /dev/null +++ b/src/SMDS/SMDSAbs_ElementType.hxx @@ -0,0 +1,31 @@ +// File generated by CPPExt (Enum) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDSAbs_ElementType_HeaderFile +#define _SMDSAbs_ElementType_HeaderFile + +enum SMDSAbs_ElementType { + SMDSAbs_All, +SMDSAbs_Node, +SMDSAbs_Edge, +SMDSAbs_Face, +SMDSAbs_Volume +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/SMDS/SMDSControl.cdl b/src/SMDS/SMDSControl.cdl new file mode 100644 index 000000000..0ae8fc6db --- /dev/null +++ b/src/SMDS/SMDSControl.cdl @@ -0,0 +1,39 @@ +-- File: SMDSControl.cdl +-- Created: Fri Mar 15 11:05:03 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +package SMDSControl + + ---Purpose: provides classes for controlling the mesh + -- according to several criteria + +uses + + SMDS + +is + + ---Category: Classes + -- + + deferred class MeshBoundary; + class BoundaryEdges; + + class BoundaryFaces; + + ---Category: Package methods + -- + + ComputeNeighborFaces(M:Mesh from SMDS; ME: MeshElement from SMDS; idnode1,idnode2: Integer) + returns Integer; + + ComputeNeighborVolumes(M:Mesh from SMDS; ME: MeshElement from SMDS; idnode1,idnode2,idnode3: Integer) + returns Integer; + + ComputeNeighborVolumes(M:Mesh from SMDS; ME: MeshElement from SMDS; idnode1,idnode2,idnode3,idnode4: Integer) + returns Integer; + +end SMDSControl; diff --git a/src/SMDS/SMDSControl.cxx b/src/SMDS/SMDSControl.cxx new file mode 100644 index 000000000..c115264f0 --- /dev/null +++ b/src/SMDS/SMDSControl.cxx @@ -0,0 +1,214 @@ +using namespace std; +// File: SMDSControl.cxx +// Created: Wed Feb 20 18:33:06 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDSControl.ixx" +#include "SMDS_Mesh.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_ListOfMeshElement.hxx" +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" + +//======================================================================= +//function : ComputeNeighborFaces +//purpose : +//======================================================================= + +Standard_Integer SMDSControl::ComputeNeighborFaces(const Handle(SMDS_Mesh)& M, + const Handle(SMDS_MeshElement)& ME, + const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1); + const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2); + const SMDS_ListOfMeshElement& lstInvFaces1 = node1->InverseElements(); + const SMDS_ListOfMeshElement& lstInvFaces2 = node2->InverseElements(); + Standard_Integer neighbor=0; + + SMDS_ListIteratorOfListOfMeshElement it1(lstInvFaces1); + for (;it1.More();it1.Next()) { + const Handle(SMDS_MeshElement)& face = it1.Value(); + if (M->Contains(face) && !face->IsSame(ME)) { + if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) { + neighbor++; + } + } + } + + if (neighbor > 0) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it2(lstInvFaces2); + for (;it2.More();it2.Next()) { + const Handle(SMDS_MeshElement)& face = it2.Value(); + if (M->Contains(face) && !face->IsSame(ME)) { + if (face->IsNodeInElement(idnode1) && face->IsNodeInElement(idnode2)) { + neighbor++; + } + } + } + + return neighbor; +} + +//======================================================================= +//function : ComputeNeighborVolumes +//purpose : +//======================================================================= + +Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M, + const Handle(SMDS_MeshElement)& ME, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + + const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1); + const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2); + const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3); + const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements(); + const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements(); + const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements(); + + Standard_Integer neighbor=0; + + SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1); + for (;it1.More() && neighbor == 0;it1.Next()) { + const Handle(SMDS_MeshElement)& vol = it1.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if (vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3)) { + neighbor++; + } + } + } + + if (neighbor > 0) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2); + for (;it2.More() && neighbor == 0;it2.Next()) { + const Handle(SMDS_MeshElement)& vol = it2.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if (vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3)) { + neighbor++; + } + } + } + + if (neighbor > 0) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3); + for (;it3.More() && neighbor == 0;it3.Next()) { + const Handle(SMDS_MeshElement)& vol = it3.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if (vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3)) { + neighbor++; + } + } + } + + return neighbor; + +} + +//======================================================================= +//function : ComputeNeighborVolumes +//purpose : +//======================================================================= + +Standard_Integer SMDSControl::ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M, + const Handle(SMDS_MeshElement)& ME, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + + const Handle(SMDS_MeshElement)& node1 = M->FindNode(idnode1); + const Handle(SMDS_MeshElement)& node2 = M->FindNode(idnode2); + const Handle(SMDS_MeshElement)& node3 = M->FindNode(idnode3); + const Handle(SMDS_MeshElement)& node4 = M->FindNode(idnode4); + const SMDS_ListOfMeshElement& lstInvVol1 = node1->InverseElements(); + const SMDS_ListOfMeshElement& lstInvVol2 = node2->InverseElements(); + const SMDS_ListOfMeshElement& lstInvVol3 = node3->InverseElements(); + const SMDS_ListOfMeshElement& lstInvVol4 = node4->InverseElements(); + Standard_Integer neighbor=0; + + SMDS_ListIteratorOfListOfMeshElement it1(lstInvVol1); + for (;it1.More();it1.Next()) { + const Handle(SMDS_MeshElement)& vol = it1.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if ( vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3) + && vol->IsNodeInElement(idnode4)) { + neighbor++; + } + } + } + + if (neighbor >= 2) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it2(lstInvVol2); + for (;it2.More();it2.Next()) { + const Handle(SMDS_MeshElement)& vol = it2.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if ( vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3) + && vol->IsNodeInElement(idnode4)) { + neighbor++; + } + } + } + + if (neighbor >= 2) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it3(lstInvVol3); + for (;it3.More();it3.Next()) { + const Handle(SMDS_MeshElement)& vol = it3.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if ( vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3) + && vol->IsNodeInElement(idnode4)) { + neighbor++; + } + } + } + + if (neighbor >= 2) { + return neighbor; + } + + SMDS_ListIteratorOfListOfMeshElement it4(lstInvVol4); + for (;it4.More();it4.Next()) { + const Handle(SMDS_MeshElement)& vol = it4.Value(); + if (M->Contains(vol) && !vol->IsSame(ME)) { + if ( vol->IsNodeInElement(idnode1) + && vol->IsNodeInElement(idnode2) + && vol->IsNodeInElement(idnode3) + && vol->IsNodeInElement(idnode4)) { + neighbor++; + } + } + } + + return neighbor; +} diff --git a/src/SMDS/SMDSControl.hxx b/src/SMDS/SMDSControl.hxx new file mode 100644 index 000000000..0ad0d408d --- /dev/null +++ b/src/SMDS/SMDSControl.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDSControl_HeaderFile +#define _SMDSControl_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +class SMDS_Mesh; +class SMDS_MeshElement; +class SMDSControl_MeshBoundary; +class SMDSControl_BoundaryEdges; +class SMDSControl_BoundaryFaces; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDSControl { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT static Standard_Integer ComputeNeighborFaces(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT static Standard_Integer ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT static Standard_Integer ComputeNeighborVolumes(const Handle(SMDS_Mesh)& M,const Handle(SMDS_MeshElement)& ME,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + +friend class SMDSControl_MeshBoundary; +friend class SMDSControl_BoundaryEdges; +friend class SMDSControl_BoundaryFaces; + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDSControl.ixx b/src/SMDS/SMDSControl.ixx new file mode 100644 index 000000000..fb49a669e --- /dev/null +++ b/src/SMDS/SMDSControl.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDSControl.jxx" + + + + diff --git a/src/SMDS/SMDSControl.jxx b/src/SMDS/SMDSControl.jxx new file mode 100644 index 000000000..e5f64bd1d --- /dev/null +++ b/src/SMDS/SMDSControl.jxx @@ -0,0 +1,9 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDSControl_HeaderFile +#include "SMDSControl.hxx" +#endif diff --git a/src/SMDS/SMDSControl_BoundaryEdges.cdl b/src/SMDS/SMDSControl_BoundaryEdges.cdl new file mode 100644 index 000000000..e20e8a7d0 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryEdges.cdl @@ -0,0 +1,29 @@ +-- File: SMDSControl_BoundaryEdges.cdl +-- Created: Wed Feb 20 19:17:20 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class BoundaryEdges from SMDSControl inherits MeshBoundary from SMDSControl + + ---Purpose: compute the boudary edges of a mesh that is the + -- edges that are shared by only one face the result + -- is a new mesh created in the same factory as the + -- original mesh that contains only edges + +uses + + Mesh from SMDS, + MapOfMeshElement from SMDS +is + + Create(M: Mesh from SMDS) returns BoundaryEdges from SMDSControl; + + Compute(me: mutable) is redefined virtual; + +fields + + myBoundaryEdges : MapOfMeshElement from SMDS; + +end BoundaryEdges; diff --git a/src/SMDS/SMDSControl_BoundaryEdges.cxx b/src/SMDS/SMDSControl_BoundaryEdges.cxx new file mode 100644 index 000000000..4215c0d8c --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryEdges.cxx @@ -0,0 +1,59 @@ +using namespace std; +// File: SMDSControl_BoundaryEdges.cxx +// Created: Wed Feb 20 19:28:42 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDSControl_BoundaryEdges.ixx" +#include "SMDSControl.hxx" + +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshEdge.hxx" +#include "SMDS_MapIteratorOfExtendedMap.hxx" + +//======================================================================= +//function : SMDSControl_BoundaryEdges +//purpose : +//======================================================================= + +SMDSControl_BoundaryEdges::SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M) + :SMDSControl_MeshBoundary(M) +{ +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + +void SMDSControl_BoundaryEdges::Compute() +{ + Standard_Integer idnode1; + Standard_Integer idnode2; + Standard_Integer nbedg; + + myBoundaryMesh = myMesh->AddSubMesh(); + SMDS_MeshFacesIterator itface(myMesh); + + for (;itface.More();itface.Next()) { + Handle(SMDS_MeshElement) ME = itface.Value(); + + nbedg = ME->NbEdges(); + + for (Standard_Integer iedge=1; iedge<=nbedg; ++iedge) { + ME->GetEdgeDefinedByNodes(iedge,idnode1,idnode2); + Handle(SMDS_MeshElement) edge = new SMDS_MeshEdge(0,idnode1,idnode2); + if (!myBoundaryEdges.Add(edge)) + myBoundaryEdges.Remove(edge); + } + } + + SMDS_MapIteratorOfExtendedMap itbound(myBoundaryEdges); + + for (;itbound.More();itbound.Next()) { + const Handle(SMDS_MeshElement)& edge = itbound.Key(); + myBoundaryMesh->AddEdge(edge->GetConnection(1),edge->GetConnection(2)); + } +} diff --git a/src/SMDS/SMDSControl_BoundaryEdges.hxx b/src/SMDS/SMDSControl_BoundaryEdges.hxx new file mode 100644 index 000000000..415ebbfe9 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryEdges.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDSControl_BoundaryEdges_HeaderFile +#define _SMDSControl_BoundaryEdges_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDSControl_BoundaryEdges_HeaderFile +#include "Handle_SMDSControl_BoundaryEdges.hxx" +#endif + +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _SMDSControl_MeshBoundary_HeaderFile +#include "SMDSControl_MeshBoundary.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class SMDS_Mesh; + + +class SMDSControl_BoundaryEdges : public SMDSControl_MeshBoundary { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDSControl_BoundaryEdges(const Handle(SMDS_Mesh)& M); +Standard_EXPORT virtual void Compute() ; +Standard_EXPORT ~SMDSControl_BoundaryEdges(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDSControl_BoundaryEdges_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMDS_MapOfMeshElement myBoundaryEdges; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDSControl_BoundaryEdges.ixx b/src/SMDS/SMDSControl_BoundaryEdges.ixx new file mode 100644 index 000000000..3cfa7ae95 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryEdges.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDSControl_BoundaryEdges::~SMDSControl_BoundaryEdges() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDSControl_BoundaryEdges_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDSControl_MeshBoundary); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDSControl_MeshBoundary); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDSControl_BoundaryEdges", + sizeof(SMDSControl_BoundaryEdges), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDSControl_BoundaryEdges) Handle(SMDSControl_BoundaryEdges)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDSControl_BoundaryEdges) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDSControl_BoundaryEdges))) { + _anOtherObject = Handle(SMDSControl_BoundaryEdges)((Handle(SMDSControl_BoundaryEdges)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDSControl_BoundaryEdges::DynamicType() const +{ + return STANDARD_TYPE(SMDSControl_BoundaryEdges) ; +} +Standard_Boolean SMDSControl_BoundaryEdges::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDSControl_BoundaryEdges) == AType || SMDSControl_MeshBoundary::IsKind(AType)); +} +Handle_SMDSControl_BoundaryEdges::~Handle_SMDSControl_BoundaryEdges() {} + diff --git a/src/SMDS/SMDSControl_BoundaryEdges.jxx b/src/SMDS/SMDSControl_BoundaryEdges.jxx new file mode 100644 index 000000000..70afd8b2c --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryEdges.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDSControl_BoundaryEdges_HeaderFile +#include "SMDSControl_BoundaryEdges.hxx" +#endif diff --git a/src/SMDS/SMDSControl_BoundaryFaces.cdl b/src/SMDS/SMDSControl_BoundaryFaces.cdl new file mode 100644 index 000000000..04546dd92 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryFaces.cdl @@ -0,0 +1,31 @@ +-- File: SMDSControl_BoundaryFaces.cdl +-- Created: Tue Mar 12 23:31:59 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class BoundaryFaces from SMDSControl inherits MeshBoundary from SMDSControl + + ---Purpose: compute the boudary faces of a mesh that is the + -- faces that are shared by only one volume the result + -- is a new mesh created in the same factory as the + -- original mesh that contains only faces + +uses + + Mesh from SMDS, + MapOfMeshElement from SMDS + +is + + Create(M: Mesh from SMDS) returns BoundaryFaces from SMDSControl; + + Compute(me: mutable) is redefined virtual; + + +fields + + myBoundaryFaces : MapOfMeshElement from SMDS; + +end BoundaryFaces; diff --git a/src/SMDS/SMDSControl_BoundaryFaces.cxx b/src/SMDS/SMDSControl_BoundaryFaces.cxx new file mode 100644 index 000000000..398025bc3 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryFaces.cxx @@ -0,0 +1,82 @@ +using namespace std; +// File: SMDSControl_BoundaryFaces.cxx +// Created: Tue Mar 12 23:46:24 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDSControl_BoundaryFaces.ixx" +#include "SMDSControl.hxx" + +#include "SMDS_MeshVolumesIterator.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshFace.hxx" +#include "SMDS_MeshTriangle.hxx" +#include "SMDS_MeshQuadrangle.hxx" +#include "SMDS_MapIteratorOfExtendedMap.hxx" + +//======================================================================= +//function : SMDSControl_BoundaryFaces +//purpose : +//======================================================================= + +SMDSControl_BoundaryFaces::SMDSControl_BoundaryFaces(const Handle(SMDS_Mesh)& M) + :SMDSControl_MeshBoundary(M) +{ +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + +void SMDSControl_BoundaryFaces::Compute() +{ + myBoundaryMesh = myMesh->AddSubMesh(); + SMDS_MeshVolumesIterator itvol(myMesh); + + Standard_Integer idnode[4]; // max number of nodes for a face + Standard_Integer nbnode; + + for (;itvol.More();itvol.Next()) { + Handle(SMDS_MeshElement) ME = itvol.Value(); + + + Standard_Integer nbfaces = ME->NbFaces(); + + for (Standard_Integer iface=1; iface<=nbfaces; ++iface) { + + ME->GetFaceDefinedByNodes(iface,idnode,nbnode); + // Triangle + if (nbnode == 3) { + Handle(SMDS_MeshElement) face = new SMDS_MeshTriangle(0,idnode[0],idnode[1],idnode[2]); + if (!myBoundaryFaces.Add(face)) + myBoundaryFaces.Remove(face); + + + } else { + // Quadrangle + + Handle(SMDS_MeshElement) face = new SMDS_MeshQuadrangle(0,idnode[0],idnode[1],idnode[2],idnode[3]); + if (!myBoundaryFaces.Add(face)) + myBoundaryFaces.Remove(face); + + } + } // end iface + + } // end itvol + + SMDS_MapIteratorOfExtendedMap itbound(myBoundaryFaces); + + for (;itbound.More();itbound.Next()) { + const Handle(SMDS_MeshElement)& face = itbound.Key(); + if (face->NbNodes() == 3) + myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3)); + else + myBoundaryMesh->AddFace(face->GetConnection(1),face->GetConnection(2),face->GetConnection(3), + face->GetConnection(4)); + } + +} + + diff --git a/src/SMDS/SMDSControl_BoundaryFaces.hxx b/src/SMDS/SMDSControl_BoundaryFaces.hxx new file mode 100644 index 000000000..dac6b7f47 --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryFaces.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDSControl_BoundaryFaces_HeaderFile +#define _SMDSControl_BoundaryFaces_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDSControl_BoundaryFaces_HeaderFile +#include +#endif + +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _SMDSControl_MeshBoundary_HeaderFile +#include "SMDSControl_MeshBoundary.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class SMDS_Mesh; + + +class SMDSControl_BoundaryFaces : public SMDSControl_MeshBoundary { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDSControl_BoundaryFaces(const Handle(SMDS_Mesh)& M); +Standard_EXPORT virtual void Compute() ; +Standard_EXPORT ~SMDSControl_BoundaryFaces(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDSControl_BoundaryFaces_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMDS_MapOfMeshElement myBoundaryFaces; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDSControl_BoundaryFaces.ixx b/src/SMDS/SMDSControl_BoundaryFaces.ixx new file mode 100644 index 000000000..7f529568a --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryFaces.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDSControl_BoundaryFaces.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDSControl_BoundaryFaces::~SMDSControl_BoundaryFaces() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDSControl_BoundaryFaces_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDSControl_MeshBoundary); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDSControl_MeshBoundary); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDSControl_BoundaryFaces", + sizeof(SMDSControl_BoundaryFaces), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDSControl_BoundaryFaces) Handle(SMDSControl_BoundaryFaces)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDSControl_BoundaryFaces) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDSControl_BoundaryFaces))) { + _anOtherObject = Handle(SMDSControl_BoundaryFaces)((Handle(SMDSControl_BoundaryFaces)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDSControl_BoundaryFaces::DynamicType() const +{ + return STANDARD_TYPE(SMDSControl_BoundaryFaces) ; +} +Standard_Boolean SMDSControl_BoundaryFaces::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDSControl_BoundaryFaces) == AType || SMDSControl_MeshBoundary::IsKind(AType)); +} +Handle_SMDSControl_BoundaryFaces::~Handle_SMDSControl_BoundaryFaces() {} + diff --git a/src/SMDS/SMDSControl_BoundaryFaces.jxx b/src/SMDS/SMDSControl_BoundaryFaces.jxx new file mode 100644 index 000000000..6053a8fef --- /dev/null +++ b/src/SMDS/SMDSControl_BoundaryFaces.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDSControl_BoundaryFaces_HeaderFile +#include "SMDSControl_BoundaryFaces.hxx" +#endif diff --git a/src/SMDS/SMDSControl_MeshBoundary.cdl b/src/SMDS/SMDSControl_MeshBoundary.cdl new file mode 100644 index 000000000..17d83bf6d --- /dev/null +++ b/src/SMDS/SMDSControl_MeshBoundary.cdl @@ -0,0 +1,35 @@ +-- File: SMDSControl_MeshBoundary.cdl +-- Created: Tue Mar 12 23:36:11 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshBoundary from SMDSControl inherits TShared from MMgt + + ---Purpose: common interface for classes which extract + -- boundaries from a mesh + +uses + + Mesh from SMDS + +is + Initialize; + ---Purpose: Initialize an empty MeshBoundary + + + Initialize (M : Mesh from SMDS); + ---Purpose: Initialize a MeshBoundary. + + + Compute(me: mutable) is deferred; + + ResultMesh(me: mutable) returns Mesh from SMDS; + + +fields + myMesh : Mesh from SMDS is protected; + myBoundaryMesh : Mesh from SMDS is protected; + +end MeshBoundary; diff --git a/src/SMDS/SMDSControl_MeshBoundary.cxx b/src/SMDS/SMDSControl_MeshBoundary.cxx new file mode 100644 index 000000000..b18b00edc --- /dev/null +++ b/src/SMDS/SMDSControl_MeshBoundary.cxx @@ -0,0 +1,40 @@ +using namespace std; +// File: SMDSControl_MeshBoundary.cxx +// Created: Tue Mar 12 23:42:53 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDSControl_MeshBoundary.ixx" + +//======================================================================= +//function : SMDSControl_MeshBoundary +//purpose : +//======================================================================= + +SMDSControl_MeshBoundary::SMDSControl_MeshBoundary() +{ +} + +//======================================================================= +//function : SMDSControl_MeshBoundary +//purpose : +//======================================================================= + +SMDSControl_MeshBoundary::SMDSControl_MeshBoundary(const Handle(SMDS_Mesh)& M) + :myMesh(M) +{ +} + +//======================================================================= +//function : ResultMesh +//purpose : +//======================================================================= + +Handle(SMDS_Mesh) SMDSControl_MeshBoundary::ResultMesh() +{ + if (myBoundaryMesh.IsNull()) + Compute(); + return myBoundaryMesh; +} + diff --git a/src/SMDS/SMDSControl_MeshBoundary.hxx b/src/SMDS/SMDSControl_MeshBoundary.hxx new file mode 100644 index 000000000..ff1d222de --- /dev/null +++ b/src/SMDS/SMDSControl_MeshBoundary.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDSControl_MeshBoundary_HeaderFile +#define _SMDSControl_MeshBoundary_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDSControl_MeshBoundary_HeaderFile +#include "Handle_SMDSControl_MeshBoundary.hxx" +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +class SMDS_Mesh; + + +class SMDSControl_MeshBoundary : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual void Compute() = 0; +Standard_EXPORT Handle_SMDS_Mesh ResultMesh() ; +Standard_EXPORT ~SMDSControl_MeshBoundary(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDSControl_MeshBoundary_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDSControl_MeshBoundary(); +Standard_EXPORT SMDSControl_MeshBoundary(const Handle(SMDS_Mesh)& M); + + + // Fields PROTECTED + // +Handle_SMDS_Mesh myMesh; +Handle_SMDS_Mesh myBoundaryMesh; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDSControl_MeshBoundary.ixx b/src/SMDS/SMDSControl_MeshBoundary.ixx new file mode 100644 index 000000000..eae31f949 --- /dev/null +++ b/src/SMDS/SMDSControl_MeshBoundary.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDSControl_MeshBoundary.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include "Standard_TypeMismatch.hxx" +#endif + +SMDSControl_MeshBoundary::~SMDSControl_MeshBoundary() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDSControl_MeshBoundary_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDSControl_MeshBoundary", + sizeof(SMDSControl_MeshBoundary), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDSControl_MeshBoundary) Handle(SMDSControl_MeshBoundary)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDSControl_MeshBoundary) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDSControl_MeshBoundary))) { + _anOtherObject = Handle(SMDSControl_MeshBoundary)((Handle(SMDSControl_MeshBoundary)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDSControl_MeshBoundary::DynamicType() const +{ + return STANDARD_TYPE(SMDSControl_MeshBoundary) ; +} +Standard_Boolean SMDSControl_MeshBoundary::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDSControl_MeshBoundary) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMDSControl_MeshBoundary::~Handle_SMDSControl_MeshBoundary() {} + diff --git a/src/SMDS/SMDSControl_MeshBoundary.jxx b/src/SMDS/SMDSControl_MeshBoundary.jxx new file mode 100644 index 000000000..1b0b42271 --- /dev/null +++ b/src/SMDS/SMDSControl_MeshBoundary.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDSControl_MeshBoundary_HeaderFile +#include "SMDSControl_MeshBoundary.hxx" +#endif diff --git a/src/SMDS/SMDSEdit.cdl b/src/SMDS/SMDSEdit.cdl new file mode 100644 index 000000000..6dae7d6cc --- /dev/null +++ b/src/SMDS/SMDSEdit.cdl @@ -0,0 +1,24 @@ +-- File: SMDSEdit.cdl +-- Created: Wed May 15 21:35:28 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +package SMDSEdit + + ---Level : Public. + -- All methods of all classes will be public. + + ---Purpose: This package provides tool classes to edit or modify + -- Meshes or MeshElements + -- + +uses + SMDS, + gp +is + class Transform; + ---Purpose: tool class to modify a Mesh or MeshElements by a Transformation + +end SMDSEdit; diff --git a/src/SMDS/SMDSEdit_Transform.cdl b/src/SMDS/SMDSEdit_Transform.cdl new file mode 100644 index 000000000..aaace08c0 --- /dev/null +++ b/src/SMDS/SMDSEdit_Transform.cdl @@ -0,0 +1,47 @@ +-- File: SMDSEdit_Transform.cdl +-- Created: Wed May 15 21:45:47 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class Transform from SMDSEdit + + ---Purpose: tool to modify a Mesh or MeshElements by applying + -- a transformation + +uses + Mesh from SMDS, + ListOfMeshElement from SMDS, + Trsf from gp + +is + Create (aMesh : Mesh from SMDS; aTrsf: Trsf from gp) + returns Transform from SMDSEdit; + ---Purpose: create a transform tool on a whole mesh + + Create (aMesh : Mesh from SMDS; aListOfME : ListOfMeshElement from SMDS; + aTrsf : Trsf from gp) + returns Transform from SMDSEdit; + ---Purpose: create a transform tool to be applied on a list of + -- meshelements from the mesh aMesh. MeshElements from the + -- list that do not belong to the mesh will not be treated + + Perform (me: in out); + ---Purpose: Perform the current transformation on the Mesh or on + -- the list of meshelements if it is not empty + + SetTrsf(me: in out; aTrsf: Trsf from gp); + ---Purpose: replace the field myTrsf by the one given in argument + -- This can be used to apply another transformation on a mesh + -- without creating another instance of SMDSEdit_Transform + + GetTrsf(me) returns Trsf from gp; + ---Purpose: returns the stored Trsf + + +fields + myMesh : Mesh from SMDS; + myTrsf : Trsf from gp; + myListOfME : ListOfMeshElement from SMDS; +end Transform; diff --git a/src/SMDS/SMDSEdit_Transform.cxx b/src/SMDS/SMDSEdit_Transform.cxx new file mode 100644 index 000000000..ca0f70f19 --- /dev/null +++ b/src/SMDS/SMDSEdit_Transform.cxx @@ -0,0 +1,100 @@ +using namespace std; +// File: SMDSEdit_Transform.cxx +// Created: Wed May 15 21:57:17 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDSEdit_Transform.ixx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" +#include "TColStd_MapOfInteger.hxx" + + +//======================================================================= +//function : SMDSEdit_Transform +//purpose : +//======================================================================= + +SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const gp_Trsf& aTrsf) + :myMesh(aMesh),myTrsf(aTrsf) +{ +} + +//======================================================================= +//function : SMDSEdit_Transform +//purpose : +//======================================================================= + +SMDSEdit_Transform::SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh, + const SMDS_ListOfMeshElement& aListOfME, + const gp_Trsf& aTrsf) + :myMesh(aMesh),myTrsf(aTrsf) +{ + myListOfME = aListOfME; +} + +//======================================================================= +//function : SetTrsf +//purpose : +//======================================================================= + +void SMDSEdit_Transform::SetTrsf(const gp_Trsf& aTrsf) +{ + myTrsf = aTrsf; +} + +//======================================================================= +//function : GetTrsf +//purpose : +//======================================================================= + +gp_Trsf SMDSEdit_Transform::GetTrsf() const +{ + return myTrsf; +} + +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + +void SMDSEdit_Transform::Perform() +{ + if (myListOfME.IsEmpty()) { + // transform the whole mesh + SMDS_MeshNodesIterator itNodes(myMesh); + + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + Handle(SMDS_MeshNode) node = *((Handle(SMDS_MeshNode)*)&elem); + + gp_Pnt P = node->Pnt(); + P.Transform(myTrsf); + node->SetPnt(P); + } + + } else { + TColStd_MapOfInteger mapnode; + Standard_Integer nbnodes,inode; + + SMDS_ListIteratorOfListOfMeshElement itME(myListOfME); + for (;itME.More();itME.Next()) { + const Handle(SMDS_MeshElement)& elem = itME.Value(); + nbnodes = elem->NbNodes(); + + for (inode = 1; inode <= nbnodes; ++inode) { + const Handle(SMDS_MeshNode)& node = myMesh->GetNode(inode,elem); + if (mapnode.Add(node->GetID())) { + gp_Pnt P = node->Pnt(); + P.Transform(myTrsf); + node->SetPnt(P); + } + } + + } + } +} + diff --git a/src/SMDS/SMDSEdit_Transform.hxx b/src/SMDS/SMDSEdit_Transform.hxx new file mode 100644 index 000000000..5c8663647 --- /dev/null +++ b/src/SMDS/SMDSEdit_Transform.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDSEdit_Transform_HeaderFile +#define _SMDSEdit_Transform_HeaderFile + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _gp_Trsf_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +class SMDS_Mesh; +class gp_Trsf; +class SMDS_ListOfMeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDSEdit_Transform { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const gp_Trsf& aTrsf); +Standard_EXPORT SMDSEdit_Transform(const Handle(SMDS_Mesh)& aMesh,const SMDS_ListOfMeshElement& aListOfME,const gp_Trsf& aTrsf); +Standard_EXPORT void Perform() ; +Standard_EXPORT void SetTrsf(const gp_Trsf& aTrsf) ; +Standard_EXPORT gp_Trsf GetTrsf() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_Mesh myMesh; +gp_Trsf myTrsf; +SMDS_ListOfMeshElement myListOfME; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDSEdit_Transform.ixx b/src/SMDS/SMDSEdit_Transform.ixx new file mode 100644 index 000000000..b355c3c3b --- /dev/null +++ b/src/SMDS/SMDSEdit_Transform.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDSEdit_Transform.jxx" + + + + diff --git a/src/SMDS/SMDSEdit_Transform.jxx b/src/SMDS/SMDSEdit_Transform.jxx new file mode 100644 index 000000000..ae63c6df7 --- /dev/null +++ b/src/SMDS/SMDSEdit_Transform.jxx @@ -0,0 +1,12 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _gp_Trsf_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _SMDSEdit_Transform_HeaderFile +#include "SMDSEdit_Transform.hxx" +#endif diff --git a/src/SMDS/SMDS_BasicMap.lxx b/src/SMDS/SMDS_BasicMap.lxx new file mode 100644 index 000000000..3122adb0a --- /dev/null +++ b/src/SMDS/SMDS_BasicMap.lxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_BasicMap.lxx has disappeared diff --git a/src/SMDS/SMDS_BasicMapIterator.lxx b/src/SMDS/SMDS_BasicMapIterator.lxx new file mode 100644 index 000000000..167f4e428 --- /dev/null +++ b/src/SMDS/SMDS_BasicMapIterator.lxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_BasicMapIterator.lxx has disappeared diff --git a/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx new file mode 100644 index 000000000..f06cc435c --- /dev/null +++ b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx @@ -0,0 +1,106 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_HeaderFile +#define _SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" +#endif +class Standard_NoSuchObject; +class SMDS_MeshElement; +class TColStd_MapIntegerHasher; +class SMDS_DataMapOfIntegerMeshElement; +class SMDS_DataMapNodeOfDataMapOfIntegerMeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement(); +Standard_EXPORT SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement(const SMDS_DataMapOfIntegerMeshElement& aMap); +Standard_EXPORT void Initialize(const SMDS_DataMapOfIntegerMeshElement& aMap) ; +Standard_EXPORT const Standard_Integer& Key() const; +Standard_EXPORT const Handle_SMDS_MeshElement& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx new file mode 100644 index 000000000..a7f2b991b --- /dev/null +++ b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_0.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMDS_DataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapOfIntegerMeshElement.hxx" +#endif +#ifndef _SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMDS_MeshElement +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_() +#define TCollection_DataMap SMDS_DataMapOfIntegerMeshElement +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx new file mode 100644 index 000000000..4ecb233e0 --- /dev/null +++ b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx @@ -0,0 +1,103 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_DataMapIteratorOfDataMapOfPntInteger_HeaderFile +#define _SMDS_DataMapIteratorOfDataMapOfPntInteger_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" +#endif +class Standard_NoSuchObject; +class gp_Pnt; +class SMDS_PntHasher; +class SMDS_DataMapOfPntInteger; +class SMDS_DataMapNodeOfDataMapOfPntInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_DataMapIteratorOfDataMapOfPntInteger : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_DataMapIteratorOfDataMapOfPntInteger(); +Standard_EXPORT SMDS_DataMapIteratorOfDataMapOfPntInteger(const SMDS_DataMapOfPntInteger& aMap); +Standard_EXPORT void Initialize(const SMDS_DataMapOfPntInteger& aMap) ; +Standard_EXPORT const gp_Pnt& Key() const; +Standard_EXPORT const Standard_Integer& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx new file mode 100644 index 000000000..e191fda91 --- /dev/null +++ b/src/SMDS/SMDS_DataMapIteratorOfDataMapOfPntInteger_0.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_PntHasher_HeaderFile +#include "SMDS_PntHasher.hxx" +#endif +#ifndef _SMDS_DataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapOfPntInteger.hxx" +#endif +#ifndef _SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" +#endif + + +#define TheKey gp_Pnt +#define TheKey_hxx +#define TheItem Standard_Integer +#define TheItem_hxx +#define Hasher SMDS_PntHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfPntInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfPntInteger_Type_() +#define TCollection_DataMap SMDS_DataMapOfPntInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx b/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx new file mode 100644 index 000000000..00000616c --- /dev/null +++ b/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#define _SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_MeshElement; +class TColStd_MapIntegerHasher; +class SMDS_DataMapOfIntegerMeshElement; +class SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement; + + +class SMDS_DataMapNodeOfDataMapOfIntegerMeshElement : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_DataMapNodeOfDataMapOfIntegerMeshElement(const Standard_Integer& K,const Handle(SMDS_MeshElement)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Standard_Integer& Key() const; +Standard_EXPORT inline Handle_SMDS_MeshElement& Value() const; +Standard_EXPORT ~SMDS_DataMapNodeOfDataMapOfIntegerMeshElement(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +Handle_SMDS_MeshElement myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMDS_MeshElement +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_() +#define TCollection_DataMap SMDS_DataMapOfIntegerMeshElement +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx b/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx new file mode 100644 index 000000000..6efc11da5 --- /dev/null +++ b/src/SMDS/SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_0.cxx @@ -0,0 +1,99 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMDS_DataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapOfIntegerMeshElement.hxx" +#endif +#ifndef _SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx" +#endif +SMDS_DataMapNodeOfDataMapOfIntegerMeshElement::~SMDS_DataMapNodeOfDataMapOfIntegerMeshElement() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_DataMapNodeOfDataMapOfIntegerMeshElement", + sizeof(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement))) { + _anOtherObject = Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)((Handle(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_DataMapNodeOfDataMapOfIntegerMeshElement::DynamicType() const +{ + return STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) ; +} +Standard_Boolean SMDS_DataMapNodeOfDataMapOfIntegerMeshElement::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfIntegerMeshElement) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement::~Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMDS_MeshElement +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_() +#define TCollection_DataMap SMDS_DataMapOfIntegerMeshElement +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger.hxx b/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger.hxx new file mode 100644 index 000000000..1c824f2a2 --- /dev/null +++ b/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#define _SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" +#endif + +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class gp_Pnt; +class SMDS_PntHasher; +class SMDS_DataMapOfPntInteger; +class SMDS_DataMapIteratorOfDataMapOfPntInteger; + + +class SMDS_DataMapNodeOfDataMapOfPntInteger : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_DataMapNodeOfDataMapOfPntInteger(const gp_Pnt& K,const Standard_Integer& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline gp_Pnt& Key() const; +Standard_EXPORT inline Standard_Integer& Value() const; +Standard_EXPORT ~SMDS_DataMapNodeOfDataMapOfPntInteger(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_DataMapNodeOfDataMapOfPntInteger_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +gp_Pnt myKey; +Standard_Integer myValue; + + +}; + +#define TheKey gp_Pnt +#define TheKey_hxx +#define TheItem Standard_Integer +#define TheItem_hxx +#define Hasher SMDS_PntHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfPntInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfPntInteger_Type_() +#define TCollection_DataMap SMDS_DataMapOfPntInteger +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx b/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx new file mode 100644 index 000000000..4205ef2c6 --- /dev/null +++ b/src/SMDS/SMDS_DataMapNodeOfDataMapOfPntInteger_0.cxx @@ -0,0 +1,99 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_PntHasher_HeaderFile +#include "SMDS_PntHasher.hxx" +#endif +#ifndef _SMDS_DataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapOfPntInteger.hxx" +#endif +#ifndef _SMDS_DataMapIteratorOfDataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx" +#endif +SMDS_DataMapNodeOfDataMapOfPntInteger::~SMDS_DataMapNodeOfDataMapOfPntInteger() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_DataMapNodeOfDataMapOfPntInteger_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_DataMapNodeOfDataMapOfPntInteger", + sizeof(SMDS_DataMapNodeOfDataMapOfPntInteger), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_DataMapNodeOfDataMapOfPntInteger) Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_DataMapNodeOfDataMapOfPntInteger) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfPntInteger))) { + _anOtherObject = Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)((Handle(SMDS_DataMapNodeOfDataMapOfPntInteger)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_DataMapNodeOfDataMapOfPntInteger::DynamicType() const +{ + return STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfPntInteger) ; +} +Standard_Boolean SMDS_DataMapNodeOfDataMapOfPntInteger::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_DataMapNodeOfDataMapOfPntInteger) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_DataMapNodeOfDataMapOfPntInteger::~Handle_SMDS_DataMapNodeOfDataMapOfPntInteger() {} +#define TheKey gp_Pnt +#define TheKey_hxx +#define TheItem Standard_Integer +#define TheItem_hxx +#define Hasher SMDS_PntHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfPntInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfPntInteger_Type_() +#define TCollection_DataMap SMDS_DataMapOfPntInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx b/src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx new file mode 100644 index 000000000..764f973ae --- /dev/null +++ b/src/SMDS/SMDS_DataMapOfIntegerMeshElement.hxx @@ -0,0 +1,135 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_DataMapOfIntegerMeshElement_HeaderFile +#define _SMDS_DataMapOfIntegerMeshElement_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class SMDS_MeshElement; +class TColStd_MapIntegerHasher; +class SMDS_DataMapNodeOfDataMapOfIntegerMeshElement; +class SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_DataMapOfIntegerMeshElement : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_DataMapOfIntegerMeshElement(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMDS_DataMapOfIntegerMeshElement& Assign(const SMDS_DataMapOfIntegerMeshElement& Other) ; + SMDS_DataMapOfIntegerMeshElement& operator =(const SMDS_DataMapOfIntegerMeshElement& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMDS_DataMapOfIntegerMeshElement() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const Handle(SMDS_MeshElement)& I) ; +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +Standard_EXPORT const Handle_SMDS_MeshElement& Find(const Standard_Integer& K) const; + const Handle_SMDS_MeshElement& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMDS_MeshElement& ChangeFind(const Standard_Integer& K) ; + Handle_SMDS_MeshElement& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_DataMapOfIntegerMeshElement(const SMDS_DataMapOfIntegerMeshElement& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapOfIntegerMeshElement_0.cxx b/src/SMDS/SMDS_DataMapOfIntegerMeshElement_0.cxx new file mode 100644 index 000000000..629172da1 --- /dev/null +++ b/src/SMDS/SMDS_DataMapOfIntegerMeshElement_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapOfIntegerMeshElement.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapNodeOfDataMapOfIntegerMeshElement.hxx" +#endif +#ifndef _SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMDS_MeshElement +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfIntegerMeshElement +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfIntegerMeshElement +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfIntegerMeshElement_Type_() +#define TCollection_DataMap SMDS_DataMapOfIntegerMeshElement +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_DataMapOfPntInteger.hxx b/src/SMDS/SMDS_DataMapOfPntInteger.hxx new file mode 100644 index 000000000..4f67f6404 --- /dev/null +++ b/src/SMDS/SMDS_DataMapOfPntInteger.hxx @@ -0,0 +1,132 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_DataMapOfPntInteger_HeaderFile +#define _SMDS_DataMapOfPntInteger_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#include "Handle_SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class gp_Pnt; +class SMDS_PntHasher; +class SMDS_DataMapNodeOfDataMapOfPntInteger; +class SMDS_DataMapIteratorOfDataMapOfPntInteger; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_DataMapOfPntInteger : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_DataMapOfPntInteger(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMDS_DataMapOfPntInteger& Assign(const SMDS_DataMapOfPntInteger& Other) ; + SMDS_DataMapOfPntInteger& operator =(const SMDS_DataMapOfPntInteger& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMDS_DataMapOfPntInteger() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const gp_Pnt& K,const Standard_Integer& I) ; +Standard_EXPORT Standard_Boolean IsBound(const gp_Pnt& K) const; +Standard_EXPORT Standard_Boolean UnBind(const gp_Pnt& K) ; +Standard_EXPORT const Standard_Integer& Find(const gp_Pnt& K) const; + const Standard_Integer& operator()(const gp_Pnt& K) const +{ + return Find(K); +} + +Standard_EXPORT Standard_Integer& ChangeFind(const gp_Pnt& K) ; + Standard_Integer& operator()(const gp_Pnt& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_DataMapOfPntInteger(const SMDS_DataMapOfPntInteger& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_DataMapOfPntInteger_0.cxx b/src/SMDS/SMDS_DataMapOfPntInteger_0.cxx new file mode 100644 index 000000000..e281408cd --- /dev/null +++ b/src/SMDS/SMDS_DataMapOfPntInteger_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_DataMapOfPntInteger.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_PntHasher_HeaderFile +#include "SMDS_PntHasher.hxx" +#endif +#ifndef _SMDS_DataMapNodeOfDataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapNodeOfDataMapOfPntInteger.hxx" +#endif +#ifndef _SMDS_DataMapIteratorOfDataMapOfPntInteger_HeaderFile +#include "SMDS_DataMapIteratorOfDataMapOfPntInteger.hxx" +#endif + + +#define TheKey gp_Pnt +#define TheKey_hxx +#define TheItem Standard_Integer +#define TheItem_hxx +#define Hasher SMDS_PntHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMDS_DataMapIteratorOfDataMapOfPntInteger +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMDS_DataMapNodeOfDataMapOfPntInteger +#define TCollection_DataMapNode_Type_() SMDS_DataMapNodeOfDataMapOfPntInteger_Type_() +#define TCollection_DataMap SMDS_DataMapOfPntInteger +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMDS/SMDS_EdgePosition.cdl b/src/SMDS/SMDS_EdgePosition.cdl new file mode 100644 index 000000000..d606c6c1d --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.cdl @@ -0,0 +1,36 @@ +-- File: SMDS_EdgePosition.cdl +-- Created: Mon May 13 14:44:40 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class EdgePosition from SMDS inherits Position from SMDS + + ---Purpose: used to characterize a MeshNode with a CAD edge + +uses + Pnt from gp + +is + + Create returns mutable EdgePosition; + ---Purpose: empty constructor. the edge is not set + + Create(aEdgeId : Integer; aUParam : Real) returns mutable EdgePosition; + + Coords(me) returns Pnt from gp is redefined virtual; + ---Purpose: returns the resulting 3d point to be set + -- in the MeshNode instance + + SetUParameter(me: mutable; aUparam : Real); + ---C++: inline + + GetUParameter(me) returns Real; + ---C++: inline + +fields + + myUParameter : Real; + +end EdgePosition; diff --git a/src/SMDS/SMDS_EdgePosition.cxx b/src/SMDS/SMDS_EdgePosition.cxx new file mode 100644 index 000000000..7b3751dfd --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.cxx @@ -0,0 +1,41 @@ +using namespace std; +// File: SMDS_EdgePosition.cxx +// Created: Mon May 13 14:49:28 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_EdgePosition.ixx" +#include "utilities.h" + +//======================================================================= +//function : SMDS_EdgePosition +//purpose : +//======================================================================= + +SMDS_EdgePosition::SMDS_EdgePosition() + :SMDS_Position(0,SMDS_TOP_EDGE),myUParameter(0.) +{ +} + +//======================================================================= +//function : SMDS_EdgePosition +//purpose : +//======================================================================= + +SMDS_EdgePosition::SMDS_EdgePosition(const Standard_Integer aEdgeId, + const Standard_Real aUParam) + :SMDS_Position(aEdgeId,SMDS_TOP_EDGE),myUParameter(aUParam) +{ +} + +//======================================================================= +//function : Coords +//purpose : +//======================================================================= + +gp_Pnt SMDS_EdgePosition::Coords() const +{ + MESSAGE( "SMDS_EdgePosition::Coords not implemented" ); + return gp_Pnt(0,0,0); +} diff --git a/src/SMDS/SMDS_EdgePosition.hxx b/src/SMDS/SMDS_EdgePosition.hxx new file mode 100644 index 000000000..25d5a6447 --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.hxx @@ -0,0 +1,108 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_EdgePosition_HeaderFile +#define _SMDS_EdgePosition_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_EdgePosition_HeaderFile +#include "Handle_SMDS_EdgePosition.hxx" +#endif + +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class gp_Pnt; + + +class SMDS_EdgePosition : public SMDS_Position { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_EdgePosition(); +Standard_EXPORT SMDS_EdgePosition(const Standard_Integer aEdgeId,const Standard_Real aUParam); +Standard_EXPORT virtual gp_Pnt Coords() const; +Standard_EXPORT inline void SetUParameter(const Standard_Real aUparam) ; +Standard_EXPORT inline Standard_Real GetUParameter() const; +Standard_EXPORT ~SMDS_EdgePosition(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_EdgePosition_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Real myUParameter; + + +}; + + +#include "SMDS_EdgePosition.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_EdgePosition.ixx b/src/SMDS/SMDS_EdgePosition.ixx new file mode 100644 index 000000000..ecdb4365e --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_EdgePosition.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_EdgePosition::~SMDS_EdgePosition() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_EdgePosition_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_Position); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_Position); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_EdgePosition", + sizeof(SMDS_EdgePosition), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_EdgePosition) Handle(SMDS_EdgePosition)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_EdgePosition) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_EdgePosition))) { + _anOtherObject = Handle(SMDS_EdgePosition)((Handle(SMDS_EdgePosition)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_EdgePosition::DynamicType() const +{ + return STANDARD_TYPE(SMDS_EdgePosition) ; +} +Standard_Boolean SMDS_EdgePosition::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_EdgePosition) == AType || SMDS_Position::IsKind(AType)); +} +Handle_SMDS_EdgePosition::~Handle_SMDS_EdgePosition() {} + diff --git a/src/SMDS/SMDS_EdgePosition.jxx b/src/SMDS/SMDS_EdgePosition.jxx new file mode 100644 index 000000000..ec7254d7b --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_EdgePosition_HeaderFile +#include "SMDS_EdgePosition.hxx" +#endif diff --git a/src/SMDS/SMDS_EdgePosition.lxx b/src/SMDS/SMDS_EdgePosition.lxx new file mode 100644 index 000000000..0e606540e --- /dev/null +++ b/src/SMDS/SMDS_EdgePosition.lxx @@ -0,0 +1,24 @@ +// File: SMDS_EdgePosition.lxx +// Created: Mon May 13 14:47:40 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : SetUParameter +//purpose : +//======================================================================= + +inline void SMDS_EdgePosition::SetUParameter(const Standard_Real aUparam) +{ + myUParameter = aUparam; +} + +//======================================================================= +//function : GetUParameter +//purpose : +//======================================================================= + +inline Standard_Real SMDS_EdgePosition::GetUParameter() const +{ + return myUParameter; +} diff --git a/src/SMDS/SMDS_ExtendedMap.hxx b/src/SMDS/SMDS_ExtendedMap.hxx new file mode 100644 index 000000000..0e7d8dcb4 --- /dev/null +++ b/src/SMDS/SMDS_ExtendedMap.hxx @@ -0,0 +1,122 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ExtendedMap_HeaderFile +#define _SMDS_ExtendedMap_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedMap.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class SMDS_MeshElement; +class SMDS_MeshElementMapHasher; +class SMDS_StdMapNodeOfExtendedMap; +class SMDS_MapIteratorOfExtendedMap; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ExtendedMap : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ExtendedMap(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMDS_ExtendedMap& Assign(const SMDS_ExtendedMap& Other) ; + SMDS_ExtendedMap& operator =(const SMDS_ExtendedMap& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMDS_ExtendedMap() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Add(const Handle(SMDS_MeshElement)& aKey) ; +Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& aKey) const; +Standard_EXPORT Standard_Boolean Remove(const Handle(SMDS_MeshElement)& aKey) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_ExtendedMap(const SMDS_ExtendedMap& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ExtendedMap_0.cxx b/src/SMDS/SMDS_ExtendedMap_0.cxx new file mode 100644 index 000000000..1666b02f7 --- /dev/null +++ b/src/SMDS/SMDS_ExtendedMap_0.cxx @@ -0,0 +1,48 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ExtendedMap.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_() +#define TCollection_Map SMDS_ExtendedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_ExtendedOrientedMap.hxx b/src/SMDS/SMDS_ExtendedOrientedMap.hxx new file mode 100644 index 000000000..528a0026b --- /dev/null +++ b/src/SMDS/SMDS_ExtendedOrientedMap.hxx @@ -0,0 +1,122 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ExtendedOrientedMap_HeaderFile +#define _SMDS_ExtendedOrientedMap_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class SMDS_MeshElement; +class SMDS_MeshOrientedElementMapHasher; +class SMDS_StdMapNodeOfExtendedOrientedMap; +class SMDS_MapIteratorOfExtendedOrientedMap; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ExtendedOrientedMap : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ExtendedOrientedMap(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMDS_ExtendedOrientedMap& Assign(const SMDS_ExtendedOrientedMap& Other) ; + SMDS_ExtendedOrientedMap& operator =(const SMDS_ExtendedOrientedMap& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMDS_ExtendedOrientedMap() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Add(const Handle(SMDS_MeshElement)& aKey) ; +Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& aKey) const; +Standard_EXPORT Standard_Boolean Remove(const Handle(SMDS_MeshElement)& aKey) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_ExtendedOrientedMap(const SMDS_ExtendedOrientedMap& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ExtendedOrientedMap_0.cxx b/src/SMDS/SMDS_ExtendedOrientedMap_0.cxx new file mode 100644 index 000000000..d730d6b38 --- /dev/null +++ b/src/SMDS/SMDS_ExtendedOrientedMap_0.cxx @@ -0,0 +1,48 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ExtendedOrientedMap.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshOrientedElementMapHasher_HeaderFile +#include "SMDS_MeshOrientedElementMapHasher.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshOrientedElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +#define TCollection_Map SMDS_ExtendedOrientedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_FacePosition.cdl b/src/SMDS/SMDS_FacePosition.cdl new file mode 100644 index 000000000..a629866a3 --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.cdl @@ -0,0 +1,44 @@ +-- File: SMDS_FacePosition.cdl +-- Created: Mon May 13 14:53:10 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class FacePosition from SMDS inherits Position from SMDS + + ---Purpose: used to characterize a MeshNode with a CAD face + +uses + Pnt from gp + +is + + Create returns mutable FacePosition; + ---Purpose: empty constructor. the face is not set + + Create(aFaceId : Integer; aUParam,aVParam : Real) + returns mutable FacePosition; + + Coords(me) returns Pnt from gp is redefined virtual; + ---Purpose: returns the resulting 3d point to be set + -- in the MeshNode instance + + SetUParameter(me: mutable; aUparam : Real); + ---C++: inline + + SetVParameter(me: mutable; aVparam : Real); + ---C++: inline + + GetUParameter(me) returns Real; + ---C++: inline + + GetVParameter(me) returns Real; + ---C++: inline + +fields + + myUParameter : Real; + myVParameter : Real; + +end FacePosition; diff --git a/src/SMDS/SMDS_FacePosition.cxx b/src/SMDS/SMDS_FacePosition.cxx new file mode 100644 index 000000000..f0c9d24fe --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File: SMDS_FacePosition.cxx +// Created: Mon May 13 14:56:28 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_FacePosition.ixx" +#include "utilities.h" + +//======================================================================= +//function : SMDS_FacePosition +//purpose : +//======================================================================= + +SMDS_FacePosition::SMDS_FacePosition() + :SMDS_Position(0,SMDS_TOP_FACE),myUParameter(0.),myVParameter(0.) +{ +} + +//======================================================================= +//function : SMDS_FacePosition +//purpose : +//======================================================================= + +SMDS_FacePosition::SMDS_FacePosition(const Standard_Integer aEdgeId, + const Standard_Real aUParam, + const Standard_Real aVParam) + :SMDS_Position(aEdgeId,SMDS_TOP_FACE), + myUParameter(aUParam),myVParameter(aVParam) +{ +} + +//======================================================================= +//function : Coords +//purpose : +//======================================================================= + +gp_Pnt SMDS_FacePosition::Coords() const +{ + MESSAGE( "SMDS_FacePosition::Coords not implemented" ); + return gp_Pnt(0,0,0); +} diff --git a/src/SMDS/SMDS_FacePosition.hxx b/src/SMDS/SMDS_FacePosition.hxx new file mode 100644 index 000000000..015694e9e --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.hxx @@ -0,0 +1,111 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_FacePosition_HeaderFile +#define _SMDS_FacePosition_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_FacePosition_HeaderFile +#include "Handle_SMDS_FacePosition.hxx" +#endif + +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class gp_Pnt; + + +class SMDS_FacePosition : public SMDS_Position { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_FacePosition(); +Standard_EXPORT SMDS_FacePosition(const Standard_Integer aFaceId,const Standard_Real aUParam,const Standard_Real aVParam); +Standard_EXPORT virtual gp_Pnt Coords() const; +Standard_EXPORT inline void SetUParameter(const Standard_Real aUparam) ; +Standard_EXPORT inline void SetVParameter(const Standard_Real aVparam) ; +Standard_EXPORT inline Standard_Real GetUParameter() const; +Standard_EXPORT inline Standard_Real GetVParameter() const; +Standard_EXPORT ~SMDS_FacePosition(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_FacePosition_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Real myUParameter; +Standard_Real myVParameter; + + +}; + + +#include "SMDS_FacePosition.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_FacePosition.ixx b/src/SMDS/SMDS_FacePosition.ixx new file mode 100644 index 000000000..088665748 --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_FacePosition.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_FacePosition::~SMDS_FacePosition() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_FacePosition_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_Position); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_Position); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_FacePosition", + sizeof(SMDS_FacePosition), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_FacePosition) Handle(SMDS_FacePosition)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_FacePosition) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_FacePosition))) { + _anOtherObject = Handle(SMDS_FacePosition)((Handle(SMDS_FacePosition)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_FacePosition::DynamicType() const +{ + return STANDARD_TYPE(SMDS_FacePosition) ; +} +Standard_Boolean SMDS_FacePosition::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_FacePosition) == AType || SMDS_Position::IsKind(AType)); +} +Handle_SMDS_FacePosition::~Handle_SMDS_FacePosition() {} + diff --git a/src/SMDS/SMDS_FacePosition.jxx b/src/SMDS/SMDS_FacePosition.jxx new file mode 100644 index 000000000..f92d19aa4 --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_FacePosition_HeaderFile +#include "SMDS_FacePosition.hxx" +#endif diff --git a/src/SMDS/SMDS_FacePosition.lxx b/src/SMDS/SMDS_FacePosition.lxx new file mode 100644 index 000000000..d64974588 --- /dev/null +++ b/src/SMDS/SMDS_FacePosition.lxx @@ -0,0 +1,44 @@ +// File: SMDS_FacePosition.lxx +// Created: Mon May 13 14:55:03 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : SetUParameter +//purpose : +//======================================================================= + +inline void SMDS_FacePosition::SetUParameter(const Standard_Real aUparam) +{ + myUParameter = aUparam; +} + +//======================================================================= +//function : SetVParameter +//purpose : +//======================================================================= + +inline void SMDS_FacePosition::SetVParameter(const Standard_Real aVparam) +{ + myVParameter = aVparam; +} + +//======================================================================= +//function : GetUParameter +//purpose : +//======================================================================= + +inline Standard_Real SMDS_FacePosition::GetUParameter() const +{ + return myUParameter; +} + +//======================================================================= +//function : GetVParameter +//purpose : +//======================================================================= + +inline Standard_Real SMDS_FacePosition::GetVParameter() const +{ + return myVParameter; +} diff --git a/src/SMDS/SMDS_HSequenceOfMesh.hxx b/src/SMDS/SMDS_HSequenceOfMesh.hxx new file mode 100644 index 000000000..cbfb0b9c6 --- /dev/null +++ b/src/SMDS/SMDS_HSequenceOfMesh.hxx @@ -0,0 +1,155 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_HSequenceOfMesh_HeaderFile +#define _SMDS_HSequenceOfMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_HSequenceOfMesh_HeaderFile +#include "Handle_SMDS_HSequenceOfMesh.hxx" +#endif + +#ifndef _SMDS_SequenceOfMesh_HeaderFile +#include "SMDS_SequenceOfMesh.hxx" +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class Standard_OutOfRange; +class SMDS_Mesh; +class SMDS_SequenceOfMesh; + + +class SMDS_HSequenceOfMesh : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_HSequenceOfMesh(); +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT inline Standard_Integer Length() const; +Standard_EXPORT void Clear() ; +Standard_EXPORT void Append(const Handle(SMDS_Mesh)& anItem) ; +Standard_EXPORT void Append(const Handle(SMDS_HSequenceOfMesh)& aSequence) ; +Standard_EXPORT void Prepend(const Handle(SMDS_Mesh)& anItem) ; +Standard_EXPORT void Prepend(const Handle(SMDS_HSequenceOfMesh)& aSequence) ; +Standard_EXPORT void Reverse() ; +Standard_EXPORT void InsertBefore(const Standard_Integer anIndex,const Handle(SMDS_Mesh)& anItem) ; +Standard_EXPORT void InsertBefore(const Standard_Integer anIndex,const Handle(SMDS_HSequenceOfMesh)& aSequence) ; +Standard_EXPORT void InsertAfter(const Standard_Integer anIndex,const Handle(SMDS_Mesh)& anItem) ; +Standard_EXPORT void InsertAfter(const Standard_Integer anIndex,const Handle(SMDS_HSequenceOfMesh)& aSequence) ; +Standard_EXPORT void Exchange(const Standard_Integer anIndex,const Standard_Integer anOtherIndex) ; +Standard_EXPORT Handle_SMDS_HSequenceOfMesh Split(const Standard_Integer anIndex) ; +Standard_EXPORT void SetValue(const Standard_Integer anIndex,const Handle(SMDS_Mesh)& anItem) ; +Standard_EXPORT const Handle_SMDS_Mesh& Value(const Standard_Integer anIndex) const; +Standard_EXPORT Handle_SMDS_Mesh& ChangeValue(const Standard_Integer anIndex) ; +Standard_EXPORT void Remove(const Standard_Integer anIndex) ; +Standard_EXPORT void Remove(const Standard_Integer fromIndex,const Standard_Integer toIndex) ; +Standard_EXPORT inline const SMDS_SequenceOfMesh& Sequence() const; +Standard_EXPORT inline SMDS_SequenceOfMesh& ChangeSequence() ; +Standard_EXPORT Handle_SMDS_HSequenceOfMesh ShallowCopy() const; +Standard_EXPORT ~SMDS_HSequenceOfMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_HSequenceOfMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMDS_SequenceOfMesh mySequence; + + +}; + +#define Item Handle_SMDS_Mesh +#define Item_hxx "SMDS_Mesh.hxx" +#define TheSequence SMDS_SequenceOfMesh +#define TheSequence_hxx "SMDS_SequenceOfMesh.hxx" +#define TCollection_HSequence SMDS_HSequenceOfMesh +#define TCollection_HSequence_hxx "SMDS_HSequenceOfMesh.hxx" +#define Handle_TCollection_HSequence Handle_SMDS_HSequenceOfMesh +#define TCollection_HSequence_Type_() SMDS_HSequenceOfMesh_Type_() + +#include + +#undef Item +#undef Item_hxx +#undef TheSequence +#undef TheSequence_hxx +#undef TCollection_HSequence +#undef TCollection_HSequence_hxx +#undef Handle_TCollection_HSequence +#undef TCollection_HSequence_Type_ + + +// other inline functions and methods (like "C++: function call" methods) +// +inline Handle_SMDS_HSequenceOfMesh ShallowCopy(const Handle_SMDS_HSequenceOfMesh& me) { + return me->ShallowCopy(); +} + + + +#endif diff --git a/src/SMDS/SMDS_HSequenceOfMesh_0.cxx b/src/SMDS/SMDS_HSequenceOfMesh_0.cxx new file mode 100644 index 000000000..3d323bd26 --- /dev/null +++ b/src/SMDS/SMDS_HSequenceOfMesh_0.cxx @@ -0,0 +1,91 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_HSequenceOfMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_SequenceOfMesh_HeaderFile +#include "SMDS_SequenceOfMesh.hxx" +#endif +SMDS_HSequenceOfMesh::~SMDS_HSequenceOfMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_HSequenceOfMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_HSequenceOfMesh", + sizeof(SMDS_HSequenceOfMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_HSequenceOfMesh) Handle(SMDS_HSequenceOfMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_HSequenceOfMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_HSequenceOfMesh))) { + _anOtherObject = Handle(SMDS_HSequenceOfMesh)((Handle(SMDS_HSequenceOfMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_HSequenceOfMesh::DynamicType() const +{ + return STANDARD_TYPE(SMDS_HSequenceOfMesh) ; +} +Standard_Boolean SMDS_HSequenceOfMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_HSequenceOfMesh) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMDS_HSequenceOfMesh::~Handle_SMDS_HSequenceOfMesh() {} +#define Item Handle_SMDS_Mesh +#define Item_hxx "SMDS_Mesh.hxx" +#define TheSequence SMDS_SequenceOfMesh +#define TheSequence_hxx "SMDS_SequenceOfMesh.hxx" +#define TCollection_HSequence SMDS_HSequenceOfMesh +#define TCollection_HSequence_hxx "SMDS_HSequenceOfMesh.hxx" +#define Handle_TCollection_HSequence Handle_SMDS_HSequenceOfMesh +#define TCollection_HSequence_Type_() SMDS_HSequenceOfMesh_Type_() +#include + diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx b/src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx new file mode 100644 index 000000000..3a40dd315 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMesh.hxx @@ -0,0 +1,131 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListIteratorOfListOfMesh_HeaderFile +#define _SMDS_ListIteratorOfListOfMesh_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMesh_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_ListOfMesh; +class SMDS_Mesh; +class SMDS_ListNodeOfListOfMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListIteratorOfListOfMesh { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListIteratorOfListOfMesh(); +Standard_EXPORT SMDS_ListIteratorOfListOfMesh(const SMDS_ListOfMesh& L); +Standard_EXPORT void Initialize(const SMDS_ListOfMesh& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT Handle_SMDS_Mesh& Value() const; + + +friend class SMDS_ListOfMesh; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMeshElement.hxx b/src/SMDS/SMDS_ListIteratorOfListOfMeshElement.hxx new file mode 100644 index 000000000..68b2a4f04 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMeshElement.hxx @@ -0,0 +1,131 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListIteratorOfListOfMeshElement_HeaderFile +#define _SMDS_ListIteratorOfListOfMeshElement_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshElement_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_ListOfMeshElement; +class SMDS_MeshElement; +class SMDS_ListNodeOfListOfMeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListIteratorOfListOfMeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListIteratorOfListOfMeshElement(); +Standard_EXPORT SMDS_ListIteratorOfListOfMeshElement(const SMDS_ListOfMeshElement& L); +Standard_EXPORT void Initialize(const SMDS_ListOfMeshElement& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT Handle_SMDS_MeshElement& Value() const; + + +friend class SMDS_ListOfMeshElement; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMeshElement_0.cxx b/src/SMDS/SMDS_ListIteratorOfListOfMeshElement_0.cxx new file mode 100644 index 000000000..c6b926bd5 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMeshElement_0.cxx @@ -0,0 +1,46 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMeshElement_HeaderFile +#include "SMDS_ListNodeOfListOfMeshElement.hxx" +#endif + + +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup.hxx b/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup.hxx new file mode 100644 index 000000000..230cef572 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup.hxx @@ -0,0 +1,131 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListIteratorOfListOfMeshGroup_HeaderFile +#define _SMDS_ListIteratorOfListOfMeshGroup_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#include "Handle_SMDS_MeshGroup.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshGroup.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_ListOfMeshGroup; +class SMDS_MeshGroup; +class SMDS_ListNodeOfListOfMeshGroup; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListIteratorOfListOfMeshGroup { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListIteratorOfListOfMeshGroup(); +Standard_EXPORT SMDS_ListIteratorOfListOfMeshGroup(const SMDS_ListOfMeshGroup& L); +Standard_EXPORT void Initialize(const SMDS_ListOfMeshGroup& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT Handle_SMDS_MeshGroup& Value() const; + + +friend class SMDS_ListOfMeshGroup; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup_0.cxx b/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup_0.cxx new file mode 100644 index 000000000..cbcde7f61 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMeshGroup_0.cxx @@ -0,0 +1,46 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListIteratorOfListOfMeshGroup.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshGroup_HeaderFile +#include "SMDS_ListOfMeshGroup.hxx" +#endif +#ifndef _SMDS_MeshGroup_HeaderFile +#include "SMDS_MeshGroup.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#include "SMDS_ListNodeOfListOfMeshGroup.hxx" +#endif + + +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" +#include + diff --git a/src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx b/src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx new file mode 100644 index 000000000..69b30f131 --- /dev/null +++ b/src/SMDS/SMDS_ListIteratorOfListOfMesh_0.cxx @@ -0,0 +1,46 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListIteratorOfListOfMesh.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMesh_HeaderFile +#include "SMDS_ListOfMesh.hxx" +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMesh_HeaderFile +#include "SMDS_ListNodeOfListOfMesh.hxx" +#endif + + +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_ListNodeOfListOfMesh.hxx b/src/SMDS/SMDS_ListNodeOfListOfMesh.hxx new file mode 100644 index 000000000..3dcf31735 --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMesh.hxx @@ -0,0 +1,127 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_ListNodeOfListOfMesh_HeaderFile +#define _SMDS_ListNodeOfListOfMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMesh_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMesh.hxx" +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_Mesh; +class SMDS_ListOfMesh; +class SMDS_ListIteratorOfListOfMesh; + + +class SMDS_ListNodeOfListOfMesh : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_ListNodeOfListOfMesh(const Handle(SMDS_Mesh)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMDS_Mesh& Value() const; +Standard_EXPORT ~SMDS_ListNodeOfListOfMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_ListNodeOfListOfMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_Mesh myValue; + + +}; + +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx b/src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx new file mode 100644 index 000000000..3328b0b0a --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMeshElement.hxx @@ -0,0 +1,127 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_ListNodeOfListOfMeshElement_HeaderFile +#define _SMDS_ListNodeOfListOfMeshElement_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshElement_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshElement.hxx" +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_MeshElement; +class SMDS_ListOfMeshElement; +class SMDS_ListIteratorOfListOfMeshElement; + + +class SMDS_ListNodeOfListOfMeshElement : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_ListNodeOfListOfMeshElement(const Handle(SMDS_MeshElement)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMDS_MeshElement& Value() const; +Standard_EXPORT ~SMDS_ListNodeOfListOfMeshElement(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_ListNodeOfListOfMeshElement_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_MeshElement myValue; + + +}; + +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListNodeOfListOfMeshElement_0.cxx b/src/SMDS/SMDS_ListNodeOfListOfMeshElement_0.cxx new file mode 100644 index 000000000..8ec414feb --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMeshElement_0.cxx @@ -0,0 +1,92 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListNodeOfListOfMeshElement.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _SMDS_ListIteratorOfListOfMeshElement_HeaderFile +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" +#endif +SMDS_ListNodeOfListOfMeshElement::~SMDS_ListNodeOfListOfMeshElement() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_ListNodeOfListOfMeshElement_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_ListNodeOfListOfMeshElement", + sizeof(SMDS_ListNodeOfListOfMeshElement), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_ListNodeOfListOfMeshElement) Handle(SMDS_ListNodeOfListOfMeshElement)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_ListNodeOfListOfMeshElement) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_ListNodeOfListOfMeshElement))) { + _anOtherObject = Handle(SMDS_ListNodeOfListOfMeshElement)((Handle(SMDS_ListNodeOfListOfMeshElement)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_ListNodeOfListOfMeshElement::DynamicType() const +{ + return STANDARD_TYPE(SMDS_ListNodeOfListOfMeshElement) ; +} +Standard_Boolean SMDS_ListNodeOfListOfMeshElement::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_ListNodeOfListOfMeshElement) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_ListNodeOfListOfMeshElement::~Handle_SMDS_ListNodeOfListOfMeshElement() {} +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx b/src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx new file mode 100644 index 000000000..a365d70fa --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMeshGroup.hxx @@ -0,0 +1,127 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#define _SMDS_ListNodeOfListOfMeshGroup_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshGroup.hxx" +#endif + +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#include "Handle_SMDS_MeshGroup.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_MeshGroup; +class SMDS_ListOfMeshGroup; +class SMDS_ListIteratorOfListOfMeshGroup; + + +class SMDS_ListNodeOfListOfMeshGroup : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_ListNodeOfListOfMeshGroup(const Handle(SMDS_MeshGroup)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMDS_MeshGroup& Value() const; +Standard_EXPORT ~SMDS_ListNodeOfListOfMeshGroup(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_ListNodeOfListOfMeshGroup_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_MeshGroup myValue; + + +}; + +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx b/src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx new file mode 100644 index 000000000..b1727e078 --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMeshGroup_0.cxx @@ -0,0 +1,92 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListNodeOfListOfMeshGroup.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_MeshGroup_HeaderFile +#include "SMDS_MeshGroup.hxx" +#endif +#ifndef _SMDS_ListOfMeshGroup_HeaderFile +#include "SMDS_ListOfMeshGroup.hxx" +#endif +#ifndef _SMDS_ListIteratorOfListOfMeshGroup_HeaderFile +#include "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#endif +SMDS_ListNodeOfListOfMeshGroup::~SMDS_ListNodeOfListOfMeshGroup() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_ListNodeOfListOfMeshGroup_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_ListNodeOfListOfMeshGroup", + sizeof(SMDS_ListNodeOfListOfMeshGroup), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_ListNodeOfListOfMeshGroup) Handle(SMDS_ListNodeOfListOfMeshGroup)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_ListNodeOfListOfMeshGroup) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_ListNodeOfListOfMeshGroup))) { + _anOtherObject = Handle(SMDS_ListNodeOfListOfMeshGroup)((Handle(SMDS_ListNodeOfListOfMeshGroup)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_ListNodeOfListOfMeshGroup::DynamicType() const +{ + return STANDARD_TYPE(SMDS_ListNodeOfListOfMeshGroup) ; +} +Standard_Boolean SMDS_ListNodeOfListOfMeshGroup::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_ListNodeOfListOfMeshGroup) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_ListNodeOfListOfMeshGroup::~Handle_SMDS_ListNodeOfListOfMeshGroup() {} +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" +#include + diff --git a/src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx b/src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx new file mode 100644 index 000000000..1b5caa3a1 --- /dev/null +++ b/src/SMDS/SMDS_ListNodeOfListOfMesh_0.cxx @@ -0,0 +1,92 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListNodeOfListOfMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_ListOfMesh_HeaderFile +#include "SMDS_ListOfMesh.hxx" +#endif +#ifndef _SMDS_ListIteratorOfListOfMesh_HeaderFile +#include "SMDS_ListIteratorOfListOfMesh.hxx" +#endif +SMDS_ListNodeOfListOfMesh::~SMDS_ListNodeOfListOfMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_ListNodeOfListOfMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_ListNodeOfListOfMesh", + sizeof(SMDS_ListNodeOfListOfMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_ListNodeOfListOfMesh) Handle(SMDS_ListNodeOfListOfMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_ListNodeOfListOfMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_ListNodeOfListOfMesh))) { + _anOtherObject = Handle(SMDS_ListNodeOfListOfMesh)((Handle(SMDS_ListNodeOfListOfMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_ListNodeOfListOfMesh::DynamicType() const +{ + return STANDARD_TYPE(SMDS_ListNodeOfListOfMesh) ; +} +Standard_Boolean SMDS_ListNodeOfListOfMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_ListNodeOfListOfMesh) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_ListNodeOfListOfMesh::~Handle_SMDS_ListNodeOfListOfMesh() {} +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_ListOfMesh.hxx b/src/SMDS/SMDS_ListOfMesh.hxx new file mode 100644 index 000000000..f02ba99a0 --- /dev/null +++ b/src/SMDS/SMDS_ListOfMesh.hxx @@ -0,0 +1,155 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListOfMesh_HeaderFile +#define _SMDS_ListOfMesh_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMesh_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMesh.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMDS_ListIteratorOfListOfMesh; +class SMDS_Mesh; +class SMDS_ListNodeOfListOfMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListOfMesh { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListOfMesh(); +Standard_EXPORT void Assign(const SMDS_ListOfMesh& Other) ; + void operator=(const SMDS_ListOfMesh& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMDS_ListOfMesh() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const Handle(SMDS_Mesh)& I) ; +Standard_EXPORT void Prepend(SMDS_ListOfMesh& Other) ; +Standard_EXPORT void Append(const Handle(SMDS_Mesh)& I) ; +Standard_EXPORT void Append(SMDS_ListOfMesh& Other) ; +Standard_EXPORT Handle_SMDS_Mesh& First() const; +Standard_EXPORT Handle_SMDS_Mesh& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMDS_ListIteratorOfListOfMesh& It) ; +Standard_EXPORT void InsertBefore(const Handle(SMDS_Mesh)& I,SMDS_ListIteratorOfListOfMesh& It) ; +Standard_EXPORT void InsertBefore(SMDS_ListOfMesh& Other,SMDS_ListIteratorOfListOfMesh& It) ; +Standard_EXPORT void InsertAfter(const Handle(SMDS_Mesh)& I,SMDS_ListIteratorOfListOfMesh& It) ; +Standard_EXPORT void InsertAfter(SMDS_ListOfMesh& Other,SMDS_ListIteratorOfListOfMesh& It) ; + + +friend class SMDS_ListIteratorOfListOfMesh; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_ListOfMesh(const SMDS_ListOfMesh& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListOfMeshElement.hxx b/src/SMDS/SMDS_ListOfMeshElement.hxx new file mode 100644 index 000000000..d0b3908bd --- /dev/null +++ b/src/SMDS/SMDS_ListOfMeshElement.hxx @@ -0,0 +1,155 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#define _SMDS_ListOfMeshElement_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshElement_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshElement.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMDS_ListIteratorOfListOfMeshElement; +class SMDS_MeshElement; +class SMDS_ListNodeOfListOfMeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListOfMeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListOfMeshElement(); +Standard_EXPORT void Assign(const SMDS_ListOfMeshElement& Other) ; + void operator=(const SMDS_ListOfMeshElement& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMDS_ListOfMeshElement() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const Handle(SMDS_MeshElement)& I) ; +Standard_EXPORT void Prepend(SMDS_ListOfMeshElement& Other) ; +Standard_EXPORT void Append(const Handle(SMDS_MeshElement)& I) ; +Standard_EXPORT void Append(SMDS_ListOfMeshElement& Other) ; +Standard_EXPORT Handle_SMDS_MeshElement& First() const; +Standard_EXPORT Handle_SMDS_MeshElement& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMDS_ListIteratorOfListOfMeshElement& It) ; +Standard_EXPORT void InsertBefore(const Handle(SMDS_MeshElement)& I,SMDS_ListIteratorOfListOfMeshElement& It) ; +Standard_EXPORT void InsertBefore(SMDS_ListOfMeshElement& Other,SMDS_ListIteratorOfListOfMeshElement& It) ; +Standard_EXPORT void InsertAfter(const Handle(SMDS_MeshElement)& I,SMDS_ListIteratorOfListOfMeshElement& It) ; +Standard_EXPORT void InsertAfter(SMDS_ListOfMeshElement& Other,SMDS_ListIteratorOfListOfMeshElement& It) ; + + +friend class SMDS_ListIteratorOfListOfMeshElement; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_ListOfMeshElement(const SMDS_ListOfMeshElement& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListOfMeshElement_0.cxx b/src/SMDS/SMDS_ListOfMeshElement_0.cxx new file mode 100644 index 000000000..227a38920 --- /dev/null +++ b/src/SMDS/SMDS_ListOfMeshElement_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListOfMeshElement.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListIteratorOfListOfMeshElement_HeaderFile +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMeshElement_HeaderFile +#include "SMDS_ListNodeOfListOfMeshElement.hxx" +#endif + + +#define Item Handle_SMDS_MeshElement +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshElement +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshElement +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshElement_Type_() +#define TCollection_List SMDS_ListOfMeshElement +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_ListOfMeshGroup.hxx b/src/SMDS/SMDS_ListOfMeshGroup.hxx new file mode 100644 index 000000000..93cc433f5 --- /dev/null +++ b/src/SMDS/SMDS_ListOfMeshGroup.hxx @@ -0,0 +1,155 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_ListOfMeshGroup_HeaderFile +#define _SMDS_ListOfMeshGroup_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#include "Handle_SMDS_MeshGroup.hxx" +#endif +#ifndef _Handle_SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#include "Handle_SMDS_ListNodeOfListOfMeshGroup.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMDS_ListIteratorOfListOfMeshGroup; +class SMDS_MeshGroup; +class SMDS_ListNodeOfListOfMeshGroup; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_ListOfMeshGroup { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_ListOfMeshGroup(); +Standard_EXPORT void Assign(const SMDS_ListOfMeshGroup& Other) ; + void operator=(const SMDS_ListOfMeshGroup& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMDS_ListOfMeshGroup() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const Handle(SMDS_MeshGroup)& I) ; +Standard_EXPORT void Prepend(SMDS_ListOfMeshGroup& Other) ; +Standard_EXPORT void Append(const Handle(SMDS_MeshGroup)& I) ; +Standard_EXPORT void Append(SMDS_ListOfMeshGroup& Other) ; +Standard_EXPORT Handle_SMDS_MeshGroup& First() const; +Standard_EXPORT Handle_SMDS_MeshGroup& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMDS_ListIteratorOfListOfMeshGroup& It) ; +Standard_EXPORT void InsertBefore(const Handle(SMDS_MeshGroup)& I,SMDS_ListIteratorOfListOfMeshGroup& It) ; +Standard_EXPORT void InsertBefore(SMDS_ListOfMeshGroup& Other,SMDS_ListIteratorOfListOfMeshGroup& It) ; +Standard_EXPORT void InsertAfter(const Handle(SMDS_MeshGroup)& I,SMDS_ListIteratorOfListOfMeshGroup& It) ; +Standard_EXPORT void InsertAfter(SMDS_ListOfMeshGroup& Other,SMDS_ListIteratorOfListOfMeshGroup& It) ; + + +friend class SMDS_ListIteratorOfListOfMeshGroup; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_ListOfMeshGroup(const SMDS_ListOfMeshGroup& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_ListOfMeshGroup_0.cxx b/src/SMDS/SMDS_ListOfMeshGroup_0.cxx new file mode 100644 index 000000000..2cb93c23f --- /dev/null +++ b/src/SMDS/SMDS_ListOfMeshGroup_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListOfMeshGroup.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListIteratorOfListOfMeshGroup_HeaderFile +#include "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#endif +#ifndef _SMDS_MeshGroup_HeaderFile +#include "SMDS_MeshGroup.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMeshGroup_HeaderFile +#include "SMDS_ListNodeOfListOfMeshGroup.hxx" +#endif + + +#define Item Handle_SMDS_MeshGroup +#define Item_hxx "SMDS_MeshGroup.hxx" +#define TCollection_ListNode SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_hxx "SMDS_ListNodeOfListOfMeshGroup.hxx" +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMeshGroup +#define TCollection_ListIterator_hxx "SMDS_ListIteratorOfListOfMeshGroup.hxx" +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMeshGroup +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMeshGroup_Type_() +#define TCollection_List SMDS_ListOfMeshGroup +#define TCollection_List_hxx "SMDS_ListOfMeshGroup.hxx" +#include + diff --git a/src/SMDS/SMDS_ListOfMesh_0.cxx b/src/SMDS/SMDS_ListOfMesh_0.cxx new file mode 100644 index 000000000..8afc4f2d1 --- /dev/null +++ b/src/SMDS/SMDS_ListOfMesh_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_ListOfMesh.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_ListIteratorOfListOfMesh_HeaderFile +#include "SMDS_ListIteratorOfListOfMesh.hxx" +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_ListNodeOfListOfMesh_HeaderFile +#include "SMDS_ListNodeOfListOfMesh.hxx" +#endif + + +#define Item Handle_SMDS_Mesh +#define Item_hxx +#define TCollection_ListNode SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMDS_ListIteratorOfListOfMesh +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMDS_ListNodeOfListOfMesh +#define TCollection_ListNode_Type_() SMDS_ListNodeOfListOfMesh_Type_() +#define TCollection_List SMDS_ListOfMesh +#define TCollection_List_hxx +#include + diff --git a/src/SMDS/SMDS_Map.gxx b/src/SMDS/SMDS_Map.gxx new file mode 100644 index 000000000..95f1677f9 --- /dev/null +++ b/src/SMDS/SMDS_Map.gxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_Map.gxx has disappeared diff --git a/src/SMDS/SMDS_MapHasher.gxx b/src/SMDS/SMDS_MapHasher.gxx new file mode 100644 index 000000000..2ee518363 --- /dev/null +++ b/src/SMDS/SMDS_MapHasher.gxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_MapHasher.gxx has disappeared diff --git a/src/SMDS/SMDS_MapIterator.gxx b/src/SMDS/SMDS_MapIterator.gxx new file mode 100644 index 000000000..a42ad7d37 --- /dev/null +++ b/src/SMDS/SMDS_MapIterator.gxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_MapIterator.gxx has disappeared diff --git a/src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx b/src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx new file mode 100644 index 000000000..eaa917e59 --- /dev/null +++ b/src/SMDS/SMDS_MapIteratorOfExtendedMap.hxx @@ -0,0 +1,102 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MapIteratorOfExtendedMap_HeaderFile +#define _SMDS_MapIteratorOfExtendedMap_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedMap.hxx" +#endif +class Standard_NoSuchObject; +class SMDS_MeshElement; +class SMDS_MeshElementMapHasher; +class SMDS_ExtendedMap; +class SMDS_StdMapNodeOfExtendedMap; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MapIteratorOfExtendedMap : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MapIteratorOfExtendedMap(); +Standard_EXPORT SMDS_MapIteratorOfExtendedMap(const SMDS_ExtendedMap& aMap); +Standard_EXPORT void Initialize(const SMDS_ExtendedMap& aMap) ; +Standard_EXPORT const Handle_SMDS_MeshElement& Key() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx b/src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx new file mode 100644 index 000000000..b0831e3f5 --- /dev/null +++ b/src/SMDS/SMDS_MapIteratorOfExtendedMap_0.cxx @@ -0,0 +1,48 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MapIteratorOfExtendedMap.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif +#ifndef _SMDS_ExtendedMap_HeaderFile +#include "SMDS_ExtendedMap.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_() +#define TCollection_Map SMDS_ExtendedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap.hxx b/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap.hxx new file mode 100644 index 000000000..d505ac7ac --- /dev/null +++ b/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap.hxx @@ -0,0 +1,102 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile +#define _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif +class Standard_NoSuchObject; +class SMDS_MeshElement; +class SMDS_MeshOrientedElementMapHasher; +class SMDS_ExtendedOrientedMap; +class SMDS_StdMapNodeOfExtendedOrientedMap; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MapIteratorOfExtendedOrientedMap : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MapIteratorOfExtendedOrientedMap(); +Standard_EXPORT SMDS_MapIteratorOfExtendedOrientedMap(const SMDS_ExtendedOrientedMap& aMap); +Standard_EXPORT void Initialize(const SMDS_ExtendedOrientedMap& aMap) ; +Standard_EXPORT const Handle_SMDS_MeshElement& Key() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap_0.cxx b/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap_0.cxx new file mode 100644 index 000000000..87ddaf91f --- /dev/null +++ b/src/SMDS/SMDS_MapIteratorOfExtendedOrientedMap_0.cxx @@ -0,0 +1,48 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshOrientedElementMapHasher_HeaderFile +#include "SMDS_MeshOrientedElementMapHasher.hxx" +#endif +#ifndef _SMDS_ExtendedOrientedMap_HeaderFile +#include "SMDS_ExtendedOrientedMap.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshOrientedElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +#define TCollection_Map SMDS_ExtendedOrientedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_MapNode.lxx b/src/SMDS/SMDS_MapNode.lxx new file mode 100644 index 000000000..f4dd175e5 --- /dev/null +++ b/src/SMDS/SMDS_MapNode.lxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_MapNode.lxx has disappeared diff --git a/src/SMDS/SMDS_MapOfMeshElement.cdl b/src/SMDS/SMDS_MapOfMeshElement.cdl new file mode 100644 index 000000000..2033419ad --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.cdl @@ -0,0 +1,60 @@ +-- File: SMDS_MapOfMeshElement.cdl +-- Created: Fri Jan 25 11:39:17 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MapOfMeshElement from SMDS inherits ExtendedMap from SMDS + + ---Purpose: Redefinition/definition of methods of Map from TCollection + +uses + MeshElement from SMDS + +raises + NoSuchObject from Standard + +is + Create(NbBuckets : Integer =1) returns MapOfMeshElement from SMDS; + ---Purpose: Creates a Map with buckets. Without + -- arguments the map is automatically dimensioned. + ---C++: inline + + Find(me; K : MeshElement) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the Key in the Map. + ---Trigger: An exception is raised when is not in the map. + raises NoSuchObject from Standard + ---C++: alias operator() + ---C++: return const & + is static; + + ChangeFind(me : in out; K : MeshElement) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the Key in the + -- Map. This Item can be modified with the syntax + -- aMap(K) = newItem; + ---Trigger: An exception is raised when is not in the map. + ---C++: alias operator() + ---C++: return & + raises NoSuchObject from Standard + is static; + + FindID(me; ID : Integer) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the ID in the Map. + ---Trigger: An exception is raised when ID is not in the map. + raises NoSuchObject from Standard + ---C++: alias operator() + ---C++: return const & + is static; + + + ContainsID(me; ID : Integer) returns Boolean + ---Level: Public + ---Purpose: Returns True if the ID is stored in the + -- map . + is static; + +end MapOfMeshElement; diff --git a/src/SMDS/SMDS_MapOfMeshElement.cxx b/src/SMDS/SMDS_MapOfMeshElement.cxx new file mode 100644 index 000000000..f85b90a22 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.cxx @@ -0,0 +1,131 @@ +using namespace std; +// File: SMDS_MapOfMeshElement.cxx +// Created: Fri Jan 25 11:47:26 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MapOfMeshElement.ixx" +#include + + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_() +#define TCollection_Map SMDS_ExtendedMap +#define TCollection_Map_hxx + + + +//======================================================================= +//function : Find +//purpose : +//======================================================================= + +const Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::Find(const TheKey& K) const +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find"); + } +// Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::Find"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())]; + while (p) { + if (Hasher::IsEqual(p->Key(),K)) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find"); + return p->Key(); +} + +//======================================================================= +//function : ChangeFind +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::ChangeFind(const TheKey& K) +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::ChangeFind"); + } +//Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::ChangeFind"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())]; + while (p) { + if (Hasher::IsEqual(p->Key(),K)) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::ChangeFind"); + return p->Key(); +} + + +//======================================================================= +//function : FindID +//purpose : +//======================================================================= + +const Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::FindID(const Standard_Integer ID) const +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::FindID"); + } +// Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::Find"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[ID % NbBuckets()]; + while (p) { + if (p->Key()->GetID() == ID) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find"); + return p->Key(); +} + +//======================================================================= +//function : ContainsID +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MapOfMeshElement::ContainsID(const Standard_Integer ID) const +{ + if (IsEmpty()) return Standard_False; + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[ID % NbBuckets()]; + while (p) { + if (p->Key()->GetID() == ID) { + return Standard_True; + } + p = (TCollection_StdMapNode*)p->Next(); + } + return Standard_False; +} diff --git a/src/SMDS/SMDS_MapOfMeshElement.hxx b/src/SMDS/SMDS_MapOfMeshElement.hxx new file mode 100644 index 000000000..aef4e4448 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.hxx @@ -0,0 +1,119 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#define _SMDS_MapOfMeshElement_HeaderFile + +#ifndef _SMDS_ExtendedMap_HeaderFile +#include "SMDS_ExtendedMap.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMDS_MeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MapOfMeshElement : public SMDS_ExtendedMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_MapOfMeshElement(const Standard_Integer NbBuckets = 1); +Standard_EXPORT const Handle_SMDS_MeshElement& Find(const Handle(SMDS_MeshElement)& K) const; + const Handle_SMDS_MeshElement& operator()(const Handle(SMDS_MeshElement)& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMDS_MeshElement& ChangeFind(const Handle(SMDS_MeshElement)& K) ; + Handle_SMDS_MeshElement& operator()(const Handle(SMDS_MeshElement)& K) +{ + return ChangeFind(K); +} + +Standard_EXPORT const Handle_SMDS_MeshElement& FindID(const Standard_Integer ID) const; + const Handle_SMDS_MeshElement& operator()(const Standard_Integer ID) const +{ + return FindID(ID); +} + +Standard_EXPORT Standard_Boolean ContainsID(const Standard_Integer ID) const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MapOfMeshElement.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MapOfMeshElement.ixx b/src/SMDS/SMDS_MapOfMeshElement.ixx new file mode 100644 index 000000000..d6a7c11cc --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MapOfMeshElement.jxx" + + + + diff --git a/src/SMDS/SMDS_MapOfMeshElement.jxx b/src/SMDS/SMDS_MapOfMeshElement.jxx new file mode 100644 index 000000000..816ba77ab --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.jxx @@ -0,0 +1,9 @@ +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif diff --git a/src/SMDS/SMDS_MapOfMeshElement.lxx b/src/SMDS/SMDS_MapOfMeshElement.lxx new file mode 100644 index 000000000..82a06100b --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshElement.lxx @@ -0,0 +1,12 @@ +// File: SMDS_MapOfMeshElement.lxx +// Created: Fri Jan 25 11:43:44 2002 +// Author: Jean-Michel BOULCOURT +// + +#include + +inline SMDS_MapOfMeshElement::SMDS_MapOfMeshElement( + const Standard_Integer NbBuckets ): + SMDS_ExtendedMap( NbBuckets ) +{} + diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.cdl b/src/SMDS/SMDS_MapOfMeshOrientedElement.cdl new file mode 100644 index 000000000..1956d8b70 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.cdl @@ -0,0 +1,60 @@ +-- File: SMDS_MapOfMeshOrientedElement.cdl +-- Created: Fri Jan 25 11:39:17 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MapOfMeshOrientedElement from SMDS inherits ExtendedOrientedMap from SMDS + + ---Purpose: Redefinition/definition of methods of Map from TCollection + +uses + MeshElement from SMDS + +raises + NoSuchObject from Standard + +is + Create(NbBuckets : Integer =1) returns MapOfMeshOrientedElement from SMDS; + ---Purpose: Creates a Map with buckets. Without + -- arguments the map is automatically dimensioned. + ---C++: inline + + Find(me; K : MeshElement) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the Key in the Map. + ---Trigger: An exception is raised when is not in the map. + raises NoSuchObject from Standard + ---C++: alias operator() + ---C++: return const & + is static; + + ChangeFind(me : in out; K : MeshElement) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the Key in the + -- Map. This Item can be modified with the syntax + -- aMap(K) = newItem; + ---Trigger: An exception is raised when is not in the map. + ---C++: alias operator() + ---C++: return & + raises NoSuchObject from Standard + is static; + + FindID(me; ID : Integer) returns MeshElement + ---Level: Public + ---Purpose: Returns the Item stored with the ID in the Map. + ---Trigger: An exception is raised when ID is not in the map. + raises NoSuchObject from Standard + ---C++: alias operator() + ---C++: return const & + is static; + + + ContainsID(me; ID : Integer) returns Boolean + ---Level: Public + ---Purpose: Returns True if the ID is stored in the + -- map . + is static; + +end MapOfMeshOrientedElement; diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.cxx b/src/SMDS/SMDS_MapOfMeshOrientedElement.cxx new file mode 100644 index 000000000..cc0cd099b --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.cxx @@ -0,0 +1,131 @@ +using namespace std; +// File: SMDS_MapOfMeshOrientedElement.cxx +// Created: Fri Jan 25 11:47:26 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MapOfMeshOrientedElement.ixx" +#include + + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif +#ifndef _SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" +#endif + + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +#define TCollection_Map SMDS_ExtendedOrientedMap +#define TCollection_Map_hxx + + + +//======================================================================= +//function : Find +//purpose : +//======================================================================= + +const Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::Find(const TheKey& K) const +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::Find"); + } +// Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::Find"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())]; + while (p) { + if (Hasher::IsEqual(p->Key(),K)) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::Find"); + return p->Key(); +} + +//======================================================================= +//function : ChangeFind +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::ChangeFind(const TheKey& K) +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::ChangeFind"); + } +//Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::ChangeFind"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())]; + while (p) { + if (Hasher::IsEqual(p->Key(),K)) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::ChangeFind"); + return p->Key(); +} + + +//======================================================================= +//function : FindID +//purpose : +//======================================================================= + +const Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::FindID(const Standard_Integer ID) const +{ + if (IsEmpty()) { + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::FindID"); + } +// Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::Find"); + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[ID % NbBuckets()]; + while (p) { + if (p->Key()->GetID() == ID) { + return p->Key(); + } + p = (TCollection_StdMapNode*) p->Next(); + } + Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::Find"); + return p->Key(); +} + +//======================================================================= +//function : ContainsID +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MapOfMeshOrientedElement::ContainsID(const Standard_Integer ID) const +{ + if (IsEmpty()) return Standard_False; + TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1; + TCollection_StdMapNode* p = data[ID % NbBuckets()]; + while (p) { + if (p->Key()->GetID() == ID) { + return Standard_True; + } + p = (TCollection_StdMapNode*)p->Next(); + } + return Standard_False; +} diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.hxx b/src/SMDS/SMDS_MapOfMeshOrientedElement.hxx new file mode 100644 index 000000000..c4139e7f6 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.hxx @@ -0,0 +1,119 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MapOfMeshOrientedElement_HeaderFile +#define _SMDS_MapOfMeshOrientedElement_HeaderFile + +#ifndef _SMDS_ExtendedOrientedMap_HeaderFile +#include "SMDS_ExtendedOrientedMap.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMDS_MeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MapOfMeshOrientedElement : public SMDS_ExtendedOrientedMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_MapOfMeshOrientedElement(const Standard_Integer NbBuckets = 1); +Standard_EXPORT const Handle_SMDS_MeshElement& Find(const Handle(SMDS_MeshElement)& K) const; + const Handle_SMDS_MeshElement& operator()(const Handle(SMDS_MeshElement)& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMDS_MeshElement& ChangeFind(const Handle(SMDS_MeshElement)& K) ; + Handle_SMDS_MeshElement& operator()(const Handle(SMDS_MeshElement)& K) +{ + return ChangeFind(K); +} + +Standard_EXPORT const Handle_SMDS_MeshElement& FindID(const Standard_Integer ID) const; + const Handle_SMDS_MeshElement& operator()(const Standard_Integer ID) const +{ + return FindID(ID); +} + +Standard_EXPORT Standard_Boolean ContainsID(const Standard_Integer ID) const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MapOfMeshOrientedElement.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.ixx b/src/SMDS/SMDS_MapOfMeshOrientedElement.ixx new file mode 100644 index 000000000..8b5c67a72 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MapOfMeshOrientedElement.jxx" + + + + diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.jxx b/src/SMDS/SMDS_MapOfMeshOrientedElement.jxx new file mode 100644 index 000000000..9f32c1fb6 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.jxx @@ -0,0 +1,9 @@ +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MapOfMeshOrientedElement_HeaderFile +#include "SMDS_MapOfMeshOrientedElement.hxx" +#endif diff --git a/src/SMDS/SMDS_MapOfMeshOrientedElement.lxx b/src/SMDS/SMDS_MapOfMeshOrientedElement.lxx new file mode 100644 index 000000000..c4396f2f6 --- /dev/null +++ b/src/SMDS/SMDS_MapOfMeshOrientedElement.lxx @@ -0,0 +1,12 @@ +// File: SMDS_MapOfMeshOrientedElement.lxx +// Created: Fri Jan 25 11:43:44 2002 +// Author: Jean-Michel BOULCOURT +// + +#include + +inline SMDS_MapOfMeshOrientedElement::SMDS_MapOfMeshOrientedElement( + const Standard_Integer NbBuckets ): + SMDS_ExtendedOrientedMap( NbBuckets ) +{} + diff --git a/src/SMDS/SMDS_Mesh.cdl b/src/SMDS/SMDS_Mesh.cdl new file mode 100755 index 000000000..96b1e7c6c --- /dev/null +++ b/src/SMDS/SMDS_Mesh.cdl @@ -0,0 +1,408 @@ +-- File: SMDS_Mesh.cdl +-- Created: Wed Jan 23 12:08:54 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class Mesh from SMDS inherits MeshObject from SMDS + + ---Purpose: + +uses + MeshNodeIDFactory from SMDS, + MeshElementIDFactory from SMDS, + ListOfMeshElement from SMDS, + ListOfMesh from SMDS, + MapOfMeshOrientedElement from SMDS, + MeshElement from SMDS, + MeshNode from SMDS, + ListIteratorOfListOfMesh from SMDS +raises + + NoSuchObject from Standard +is + + ---================================ + ---Category: public API methods + -- Mesh creation + --================================= + + Create(nbnodes: Integer = 10; nbedges : Integer = 10; + nbfaces : Integer = 10; nbvolumes : Integer = 10) returns mutable Mesh; + ---Purpose: create a new mesh. It is possible to specify the + -- initial size of elements. + -- It is recommended to set the size of mesh elements + -- in the constructor to avoid too much resizing of data storage + + AddSubMesh(me: mutable) returns Mesh from SMDS + ---Purpose: create an submesh. + -- uses a private constructor to create a instance of the submesh + -- and attach it to the mesh parent. + is static; + + + + ---================================ + ---Category: public API methods + -- Mesh Element creation + --================================= + + -- *** Nodes *** -- + + + AddNode(me: mutable; x,y,z : Real) returns Integer + ---Purpose: create an instance of MeshNode and add it to the mesh + -- if the mesh has a parent then the node is also added + -- to the parent mesh. + -- Returns a generated ID for the created node. + is virtual; + + AddNodeWithID(me: mutable; x,y,z : Real; ID: Integer) returns Boolean + ---Purpose: create an instance of MeshNode and add it to the mesh + -- if the mesh has a parent then the node is also added + -- to the parent mesh. + -- returns False in case the ID already exists + is virtual; + + AddNode(me: mutable; ID : Integer) returns Boolean + ---Purpose: add an existing node in the mesh. This is useful to + -- add a node from a parent mesh to the submesh + is virtual; + + + -- *** Edges *** -- + + AddEdge(me: mutable; idnode1, idnode2 : Integer) returns Integer + ---Purpose: create an instance of MeshEdge and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddEdgeWithID(me: mutable; idnode1, idnode2, ID : Integer) returns Boolean + ---Purpose: create an instance of MeshEdge and add it to the mesh + is virtual; + + + -- *** Faces *** -- + + AddFace(me: mutable; idnode1, idnode2, idnode3 : Integer) returns Integer + ---Purpose: create an instance of MeshFace and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, ID : Integer) returns Boolean + ---Purpose: create an instance of MeshFace and add it to the mesh + is virtual; + + + AddFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) + returns Integer + ---Purpose: create an instance of MeshFace and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddFaceWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer) + returns Boolean + ---Purpose: create an instance of MeshFace and add it to the mesh + is virtual; + + + + -- *** Volumes *** -- + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) + returns Integer + ---Purpose: create an instance of MeshVolume and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, ID : Integer) + returns Boolean + ---Purpose: create an instance of MeshVolume and add it to the mesh + is virtual; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5 : Integer) + returns Integer + ---Purpose: create an instance of MeshVolume and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, ID : Integer) + returns Boolean + ---Purpose: create an instance of MeshVolume and add it to the mesh + is virtual; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer) + returns Integer + ---Purpose: create an instance of MeshVolume and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, ID : Integer) + returns Boolean + ---Purpose: create an instance of MeshVolume and add it to the mesh + is virtual; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, + idnode7, idnode8 : Integer) + returns Integer + ---Purpose: create an instance of MeshVolume and add it to the mesh + -- returns the id of the element. Returns 0 if creation failed + is virtual; + + AddVolumeWithID(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, + idnode7, idnode8, ID : Integer) + returns Boolean + ---Purpose: create an instance of MeshVolume and add it to the mesh + is virtual; + + + AddVolume(me: mutable; node1, node2, node3, node4 : MeshElement) + returns MeshElement from SMDS + ---Purpose: create an instance of MeshVolume and add it to the mesh + is static; + + AddVolume(me: mutable; node1, node2, node3, node4, node5 : MeshElement) + returns MeshElement from SMDS + ---Purpose: create an instance of MeshVolume and add it to the mesh + is static; + + AddVolume(me: mutable; node1, node2, node3, node4, node5, node6 : MeshElement) + returns MeshElement from SMDS + ---Purpose: create an instance of MeshVolume and add it to the mesh + is static; + + AddVolume(me: mutable; node1, node2, node3, node4, + node5, node6, node7, node8 : MeshElement) + returns MeshElement from SMDS + ---Purpose: create an instance of MeshVolume and add it to the mesh + is static; + + + + ---================================ + ---Category: public API methods + -- Mesh Element deletion + --================================= + + + RemoveNode(me: mutable; IDnode: Integer) + ---Purpose: remove the node IDnode in the mesh and in all the children mesh + -- if it exists, it remains in the parent mesh + -- if the mesh has no parent, then ID is released + is virtual; + + RemoveEdge(me: mutable; idnode1, idnode2 : Integer) + ---Purpose: remove the edge defined by idnode1,idnode2 in the mesh + is virtual; + + RemoveFace(me: mutable; idnode1, idnode2, idnode3 : Integer) + ---Purpose: remove the face defined by idnode1,idnode2,idnode3 in the mesh + is virtual; + + RemoveFace(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) + ---Purpose: remove the face defined by idnode1,idnode2,idnode3,idnode4 in the mesh + is virtual; + + RemoveElement(me: mutable; IDelem : Integer;removenodes : Boolean = Standard_False) + ---Purpose: remove the mesh element IDelem + -- Caution : Cannot be used to remove nodes, instead + -- use method RemoveNode + is virtual; + + RemoveElement(me: mutable; elem: MeshElement;removenodes : Boolean = Standard_False) + is static; + + RemoveFromParent(me: mutable) + returns Boolean + ---Purpose: remove this from its parent + -- if this has no parent then it returns False (True otherwise) + is virtual; + + RemoveSubMesh(me: mutable; aMesh : Mesh from SMDS) + returns Boolean + ---Purpose: remove aMesh from the list of Children + -- if the submesh does not belong to this, it returns False + -- (True otherwiswe) + is virtual; + + ---================================ + ---Category: public API methods + -- Mesh exploration + --================================= + + GetNode(me; rank: Integer; ME: MeshElement) returns MeshNode from SMDS + is static; + + FindNode(me; idnode: Integer) returns MeshElement from SMDS + ---Purpose: return the meshnode idnode in the mesh + is static; + + FindEdge(me; idnode1, idnode2: Integer) returns MeshElement from SMDS + ---Purpose: + is static; + + FindFace(me; idnode1, idnode2, idnode3: Integer) returns MeshElement from SMDS + ---Purpose: + is static; + + FindFace(me; idnode1, idnode2, idnode3, idnode4: Integer) returns MeshElement from SMDS + ---Purpose: + is static; + + FindElement(me; IDelem: Integer) returns MeshElement from SMDS + ---Purpose: returns the mesh element corresponding to IDelem + is static; + + Contains(me; elem: MeshElement) returns Boolean + ---Purpose: + is static; + + RebuildAllInverseConnections(me: mutable) + ---Purpose: clean the inverse connections and rebuild them + -- completely. If the mesh has children, the + -- inverse connections are also rebuilt + is static; + + SubMeshIterator(me;itmsh: out ListIteratorOfListOfMesh from SMDS) + ---Purpose: + is static; + + + NbNodes(me) returns Integer; + ---C++: inline + + NbEdges(me) returns Integer; + ---C++: inline + + NbFaces(me) returns Integer; + ---C++: inline + + NbVolumes(me) returns Integer; + ---C++: inline + + NbSubMesh(me) returns Integer; + ---C++: inline + + DumpNodes(me); + + DumpEdges(me); + + DumpFaces(me); + + DumpVolumes(me); + + DebugStats(me); + + + + ---Category: private or protected methods + -- + + Create(parent: Mesh; nbnodes: Integer = 10) returns mutable Mesh + ---Purpose: constructor used internally to create submesh + -- + is private; + + AddNode(me: mutable; node : MeshElement ) returns Boolean + ---Purpose: add a node in the mesh + -- if the mesh has parent, the node is also added to the parent. + -- returns False if the node is invalid ( null handle) + is private; + + CreateEdge(me; ID, idnode1, idnode2 : Integer) returns MeshElement from SMDS; + + CreateFace(me; ID, idnode1, idnode2, idnode3 : Integer) returns MeshElement from SMDS; + + CreateFace(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer) + returns MeshElement from SMDS; + + CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4 : Integer) + returns MeshElement from SMDS; + + CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5 : Integer) + returns MeshElement from SMDS; + + CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer) + returns MeshElement from SMDS; + + CreateVolume(me; ID, idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer) + returns MeshElement from SMDS; + + + FindNode(me; node: MeshElement) returns MeshElement from SMDS + ---Purpose: + is protected; + + FindEdge(me; edge: MeshElement) returns MeshElement from SMDS + ---Purpose: + is protected; + + FindFace(me; face: MeshElement) returns MeshElement from SMDS + ---Purpose: + is protected; + + FindVolume(me; volume: MeshElement) returns MeshElement from SMDS + ---Purpose: + is protected; + + + RemoveInverseElement(me; node,parent : MeshElement) + ---Purpose: + is protected; + + FreeNode(me: mutable; node: MeshElement) + is private; + + RemoveNode(me: mutable; node: MeshElement) returns Boolean + is protected; + + RemoveEdge(me: mutable; edge: MeshElement) + is protected; + + RemoveFace(me: mutable; face: MeshElement) + is protected; + + RemoveVolume(me: mutable; volume: MeshElement) + is protected; + + + + GetNode(me; ID: Integer) returns MeshElement from SMDS + is protected; + + RemoveAncestors(me: mutable; ME: MeshElement from SMDS; map: MapOfMeshOrientedElement from SMDS) + is protected; + + BuildMapNodeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS) + is private; + + BuildMapEdgeAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS) + is private; + + BuildMapFaceAncestors(me; ME: MeshElement from SMDS;map: in out MapOfMeshOrientedElement from SMDS) + is private; + + RebuildInverseConnections(me: mutable) + ---Purpose: + is private; + + +fields + + myNodes : MapOfMeshOrientedElement from SMDS; + myEdges : MapOfMeshOrientedElement from SMDS; + myFaces : MapOfMeshOrientedElement from SMDS; + myVolumes : MapOfMeshOrientedElement from SMDS; + myParent : Mesh from SMDS; + myChildren : ListOfMesh from SMDS; + myNodeIDFactory : MeshNodeIDFactory from SMDS; + myElementIDFactory : MeshElementIDFactory from SMDS; + myHasInverse : Boolean; +friends + class MeshVolumesIterator from SMDS, + class MeshFacesIterator from SMDS, + class MeshEdgesIterator from SMDS, + class MeshNodesIterator from SMDS + +end Mesh; diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx new file mode 100644 index 000000000..5eaf68c76 --- /dev/null +++ b/src/SMDS/SMDS_Mesh.cxx @@ -0,0 +1,1472 @@ +using namespace std; +// File: SMDS_Mesh.cxx +// Created: Wed Jan 23 16:49:00 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_Mesh.ixx" +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" +#include "SMDS_ListOfMeshElement.hxx" +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdge.hxx" +#include "SMDS_MeshFace.hxx" +#include "SMDS_MeshTriangle.hxx" +#include "SMDS_MeshQuadrangle.hxx" +#include "SMDS_MeshVolume.hxx" +#include "SMDS_MeshTetrahedron.hxx" +#include "SMDS_MeshPyramid.hxx" +#include "SMDS_MeshPrism.hxx" +#include "SMDS_MeshHexahedron.hxx" +#include "SMDS_ListOfMesh.hxx" +#include "SMDS_ListIteratorOfListOfMesh.hxx" + + +#include +#include + +#include "utilities.h" + + +//======================================================================= +//function : SMDS_Mesh +//purpose : creation of a new mesh object +//======================================================================= + +SMDS_Mesh::SMDS_Mesh(const Standard_Integer nbnodes, + const Standard_Integer nbedges, + const Standard_Integer nbfaces, + const Standard_Integer nbvolumes) + :myNodes(nbnodes),myEdges(nbedges),myFaces(nbfaces),myVolumes(nbvolumes), + myNodeIDFactory(new SMDS_MeshNodeIDFactory()), + myElementIDFactory(new SMDS_MeshElementIDFactory()),myHasInverse(Standard_False) +{ +} + +//======================================================================= +//function : SMDS_Mesh +//purpose : +//======================================================================= + +SMDS_Mesh::SMDS_Mesh(const Handle(SMDS_Mesh)& parent, + const Standard_Integer nbnodes) + :myNodes(nbnodes),myParent(parent),myNodeIDFactory(parent->myNodeIDFactory), + myElementIDFactory(parent->myElementIDFactory), + myHasInverse(Standard_False) +{ +} + +//======================================================================= +//function : AddSubMesh +//purpose : create an submesh +//======================================================================= + +Handle(SMDS_Mesh) SMDS_Mesh::AddSubMesh() +{ + Handle(SMDS_Mesh) submesh = new SMDS_Mesh(this); + if (!submesh.IsNull()) { + myChildren.Append(submesh); + } + + return submesh; +} + + +//======================================================================= +//function : AddNode +//purpose : create a MeshNode and returns an ID +//======================================================================= + +Standard_Integer SMDS_Mesh::AddNode(const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + Standard_Integer ID = myNodeIDFactory->GetFreeID(); + + Handle(SMDS_MeshElement) node = new SMDS_MeshNode(ID,x,y,z); + AddNode(node); + + return ID; +} + +//======================================================================= +//function : AddNode +//purpose : create a MeshNode. Returns False if the ID already exists +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddNodeWithID(const Standard_Real x, + const Standard_Real y, + const Standard_Real z, + const Standard_Integer ID) +{ + + // find the MeshNode corresponding to ID + Handle(SMDS_MeshElement) node; + node = GetNode(ID); + + if (node.IsNull()) { + node = new SMDS_MeshNode(ID,x,y,z); + AddNode(node); + return Standard_True; + } else + return Standard_False; + +} + +//======================================================================= +//function : AddNode +//purpose : add an existing node in the mesh (useful for submesh) +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddNode(const Standard_Integer ID) +{ + // find the MeshNode corresponding to ID + Handle(SMDS_MeshElement) node; + + node = GetNode(ID); + + if (!node.IsNull()) { + myNodes.Add(node); + return Standard_True;; + } else + return Standard_False; +} + +//======================================================================= +//function : AddNode +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddNode(const Handle(SMDS_MeshElement)& node) +{ + + if (!node.IsNull()) { + myNodes.Add(node); + if (!myParent.IsNull()) { + myParent->AddNode(node); + } + return Standard_True; + } else + return Standard_False; +} + + +//======================================================================= +//function : AddEdge +//purpose : +//======================================================================= + +Standard_Integer SMDS_Mesh::AddEdge(const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddEdgeWithID(idnode1,idnode2,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddEdge +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddEdgeWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) edge,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + elem = CreateEdge(ID,idnode1,idnode2); + edge = FindEdge(elem); + if (edge.IsNull()) { + edge = elem; + myEdges.Add(edge); + } + successAdd = myElementIDFactory->BindID(ID,edge); + } + } + + return successAdd; + +} + +//======================================================================= +//function : AddFace +//purpose : +//======================================================================= + +Standard_Integer SMDS_Mesh::AddFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddFaceWithID(idnode1,idnode2,idnode3,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddFace +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddFaceWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) face,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + elem = CreateFace(ID,idnode1,idnode2,idnode3); + face = FindFace(elem); + if (face.IsNull()) { + face = elem; + myFaces.Add(face); + } + successAdd = myElementIDFactory->BindID(ID,face); + } + } + } + + return successAdd; + +} + + +//======================================================================= +//function : AddFace +//purpose : +//======================================================================= + +Standard_Integer SMDS_Mesh::AddFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddFaceWithID(idnode1,idnode2,idnode3,idnode4,ID)) + return ID; + else + return 0; + +} + + +//======================================================================= +//function : AddFace +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddFaceWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) face,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + // find the MeshNode corresponding to idnode4 + if (AddNode(idnode4)) { + elem = CreateFace(ID,idnode1,idnode2,idnode3,idnode4); + face = FindFace(elem); + if (face.IsNull()) { + face = elem; + myFaces.Add(face); + } + successAdd = myElementIDFactory->BindID(ID,face); + } + } + } + } + + return successAdd; + +} + + + +//======================================================================= +//function : AddVolume +//purpose : Tetrahedra +//======================================================================= + +Standard_Integer SMDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddVolumeWithID(idnode1,idnode2,idnode3,idnode4,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddVolume +//purpose : Tetrahedra +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddVolumeWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) volume,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + // find the MeshNode corresponding to idnode4 + if (AddNode(idnode4)) { + elem = CreateVolume(ID,idnode1,idnode2,idnode3,idnode4); + volume = FindVolume(elem); + if (volume.IsNull()) { + volume = elem; + myVolumes.Add(volume); + } + successAdd = myElementIDFactory->BindID(ID,volume); + } + } + } + } + + return successAdd; + +} + +//======================================================================= +//function : AddVolume +//purpose : Pyramid +//======================================================================= + +Standard_Integer SMDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddVolumeWithID(idnode1,idnode2,idnode3,idnode4,idnode5,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddVolume +//purpose : Pyramid +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddVolumeWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) volume,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + // find the MeshNode corresponding to idnode4 + if (AddNode(idnode4)) { + // find the MeshNode corresponding to idnode5 + if (AddNode(idnode5)) { + elem = CreateVolume(ID,idnode1,idnode2,idnode3,idnode4,idnode5); + volume = FindVolume(elem); + if (volume.IsNull()) { + volume = elem; + myVolumes.Add(volume); + } + successAdd = myElementIDFactory->BindID(ID,volume); + } + } + } + } + } + + return successAdd; + +} + +//======================================================================= +//function : AddVolume +//purpose : Prism +//======================================================================= + +Standard_Integer SMDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddVolumeWithID(idnode1,idnode2,idnode3,idnode4, + idnode5,idnode6,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddVolume +//purpose : Prism +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddVolumeWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) volume,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + // find the MeshNode corresponding to idnode4 + if (AddNode(idnode4)) { + // find the MeshNode corresponding to idnode5 + if (AddNode(idnode5)) { + // find the MeshNode corresponding to idnode6 + if (AddNode(idnode6)) { + elem = CreateVolume(ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); + volume = FindVolume(elem); + if (volume.IsNull()) { + volume = elem; + myVolumes.Add(volume); + } + successAdd = myElementIDFactory->BindID(ID,volume); + } + } + } + } + } + } + + return successAdd; + +} + +//======================================================================= +//function : AddVolume +//purpose : Hexahedra +//======================================================================= + +Standard_Integer SMDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) +{ + Standard_Integer ID = myElementIDFactory->GetFreeID(); + + if (AddVolumeWithID(idnode1,idnode2,idnode3,idnode4, + idnode5,idnode6,idnode7,idnode8,ID)) + return ID; + else + return 0; + +} + +//======================================================================= +//function : AddVolume +//purpose : Hexahedra +//======================================================================= + +Standard_Boolean SMDS_Mesh::AddVolumeWithID(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8, + const Standard_Integer ID) +{ + Handle(SMDS_MeshElement) volume,elem; + Standard_Boolean successAdd = Standard_False; + + // find the MeshNode corresponding to idnode1 + if (AddNode(idnode1)) { + // find the MeshNode corresponding to idnode2 + if (AddNode(idnode2)) { + // find the MeshNode corresponding to idnode3 + if (AddNode(idnode3)) { + // find the MeshNode corresponding to idnode4 + if (AddNode(idnode4)) { + // find the MeshNode corresponding to idnode5 + if (AddNode(idnode5)) { + // find the MeshNode corresponding to idnode6 + if (AddNode(idnode6)) { + // find the MeshNode corresponding to idnode7 + if (AddNode(idnode7)) { + // find the MeshNode corresponding to idnode8 + if (AddNode(idnode8)) { + elem = CreateVolume(ID,idnode1,idnode2,idnode3,idnode4,idnode5, + idnode6,idnode7,idnode8); + volume = FindVolume(elem); + if (volume.IsNull()) { + volume = elem; + myVolumes.Add(volume); + } + successAdd = myElementIDFactory->BindID(ID,volume); + } + } + } + } + } + } + } + } + + return successAdd; + +} + + +//======================================================================= +//function : GetNode +//purpose : returns the MeshNode corresponding to the ID +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::GetNode(const Standard_Integer idnode) const +{ + + Handle(SMDS_MeshElement) node; + + Handle(SMDS_MeshElement) elem = FindNode(idnode); + if (!elem.IsNull()) { // found one correspondance + node = elem; + } else { + if (!myParent.IsNull()) + node = myParent->GetNode(idnode); + } + + return node; +} + +//======================================================================= +//function : FindNode +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindNode(const Standard_Integer ID) const +{ + Handle(SMDS_MeshElement) elem; + if (myNodes.ContainsID(ID)) + elem = myNodes.FindID(ID); + return elem; +} + +//======================================================================= +//function : FindNode +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindNode(const Handle(SMDS_MeshElement)& node) const +{ + Handle(SMDS_MeshElement) elem; + if (myNodes.Contains(node)) + elem = myNodes.Find(node); + + return elem; +} + +//======================================================================= +//function : CreateEdge +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateEdge(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2) const +{ + Handle(SMDS_MeshEdge) edge = new SMDS_MeshEdge(ID,idnode1,idnode2); + return edge; +} + + +//======================================================================= +//function : CreateFace +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateFace(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) const +{ + Handle(SMDS_MeshFace) face = new SMDS_MeshTriangle(ID,idnode1,idnode2,idnode3); + return face; +} + + +//======================================================================= +//function : CreateFace +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateFace(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) const +{ + Handle(SMDS_MeshFace) face = new SMDS_MeshQuadrangle(ID,idnode1,idnode2,idnode3,idnode4); + return face; +} + +//======================================================================= +//function : CreateVolume +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateVolume(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) const +{ + Handle(SMDS_MeshVolume) volume = new SMDS_MeshTetrahedron(ID,idnode1,idnode2,idnode3,idnode4); + return volume; +} + +//======================================================================= +//function : CreateVolume +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateVolume(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) const +{ + Handle(SMDS_MeshVolume) volume = new SMDS_MeshPyramid(ID,idnode1,idnode2,idnode3,idnode4,idnode5); + return volume; +} + +//======================================================================= +//function : CreateVolume +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateVolume(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) const +{ + Handle(SMDS_MeshVolume) volume = new SMDS_MeshPrism(ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); + return volume; +} + +//======================================================================= +//function : CreateVolume +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::CreateVolume(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) const +{ + Handle(SMDS_MeshVolume) volume = new SMDS_MeshHexahedron(ID,idnode1,idnode2,idnode3,idnode4, + idnode5,idnode6,idnode7,idnode8); + return volume; +} + +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::Contains(const Handle(SMDS_MeshElement)& elem) const +{ + Standard_Boolean isinmesh = Standard_False; + if (myNodes.Contains(elem)) + isinmesh = Standard_True; + else if (myEdges.Contains(elem)) + isinmesh = Standard_True; + else if (myFaces.Contains(elem)) + isinmesh = Standard_True; + else if (myVolumes.Contains(elem)) + isinmesh = Standard_True; + + return isinmesh; +} + +//======================================================================= +//function : FindEdge +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindEdge(const Handle(SMDS_MeshElement)& edge) const +{ + Handle(SMDS_MeshElement) elem; + if (myEdges.Contains(edge)) + elem = myEdges.Find(edge); + + return elem; +} + +//======================================================================= +//function : FindFace +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindFace(const Handle(SMDS_MeshElement)& face) const +{ + Handle(SMDS_MeshElement) elem; + if (myFaces.Contains(face)) + elem = myFaces.Find(face); + + return elem; +} + + +//======================================================================= +//function : FindVolume +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindVolume(const Handle(SMDS_MeshElement)& volume) const +{ + Handle(SMDS_MeshElement) elem; + if (myVolumes.Contains(volume)) + elem = myVolumes.Find(volume); + + return elem; +} + + +//======================================================================= +//function : FreeNode +//purpose : +//======================================================================= + +void SMDS_Mesh::FreeNode(const Handle(SMDS_MeshElement)& node) +{ + myNodes.Remove(node); + + SMDS_ListIteratorOfListOfMesh itmsh(myChildren); + for (;itmsh.More(); itmsh.Next()) { + const Handle(SMDS_Mesh)& submesh = itmsh.Value(); + submesh->RemoveNode(node->GetID()); + } +} + + + +//======================================================================= +//function : RemoveNode +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveNode(const Standard_Integer IDnode) +{ + // find the MeshNode corresponding to IDnode + Handle(SMDS_MeshElement) node = FindNode(IDnode); + if (RemoveNode(node)) { + if (myParent.IsNull()) { // if no parent we can release the ID + myNodeIDFactory->ReleaseID(IDnode); + } + } + +} + +//======================================================================= +//function : RemoveNode +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::RemoveNode(const Handle(SMDS_MeshElement)& node) +{ + Standard_Boolean successRemove = Standard_False; + + if (!node.IsNull()) { + if (myHasInverse && myNodes.Contains(node)) { + SMDS_MapOfMeshOrientedElement map(1); + BuildMapNodeAncestors(node,map); + RemoveAncestors(node,map); + } + + FreeNode(node); + successRemove = Standard_True; + } + + return successRemove; +} + +//======================================================================= +//function : RemoveEdge +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveEdge(const Standard_Integer idnode1, const Standard_Integer idnode2) +{ + Handle(SMDS_MeshElement) edge = FindEdge(idnode1,idnode2); + RemoveEdge(edge); +} + +//======================================================================= +//function : RemoveEdge +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveEdge(const Handle(SMDS_MeshElement)& edge) +{ + + if (!edge.IsNull()) { + myEdges.Remove(edge); + + myElementIDFactory->ReleaseID(edge->GetID()); + } +} + + +//======================================================================= +//function : RemoveFace +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + Handle(SMDS_MeshElement) face = FindFace(idnode1,idnode2,idnode3); + RemoveFace(face); +} + +//======================================================================= +//function : RemoveFace +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Handle(SMDS_MeshElement) face = FindFace(idnode1,idnode2,idnode3,idnode4); + RemoveFace(face); +} + + +//======================================================================= +//function : RemoveFace +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveFace(const Handle(SMDS_MeshElement)& face) +{ + if (!face.IsNull()) { + myFaces.Remove(face); + myElementIDFactory->ReleaseID(face->GetID()); + } +} + +//======================================================================= +//function : RemoveVolume +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveVolume(const Handle(SMDS_MeshElement)& volume) +{ + if (myVolumes.Contains(volume)) { + myVolumes.Remove(volume); + myElementIDFactory->ReleaseID(volume->GetID()); + } +} + +//======================================================================= +//function : RemoveElement +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveElement(const Standard_Integer IDelem,const Standard_Boolean removenodes) +{ + Handle(SMDS_MeshElement) elem = myElementIDFactory->MeshElement(IDelem); + RemoveElement(elem,removenodes); + + + +} + +//======================================================================= +//function : RemoveElement +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveElement(const Handle(SMDS_MeshElement)& elem,const Standard_Boolean removenodes) +{ + if ( elem->IsKind(STANDARD_TYPE(SMDS_MeshEdge)) ) { + RemoveEdge(elem); + } else if ( elem->IsKind(STANDARD_TYPE(SMDS_MeshNode))) { + RemoveNode(elem); + return; + } else if ( elem->IsKind(STANDARD_TYPE(SMDS_MeshFace))) { + RemoveFace(elem); + } else if ( elem->IsKind(STANDARD_TYPE(SMDS_MeshVolume))) { + RemoveVolume(elem); + } else { + MESSAGE( "remove function : unknown type" ); + return; + } + + Standard_Integer nbcnx = elem->NbNodes(); + Standard_Integer i; + for (i=1; i <= nbcnx; ++i) { + RemoveInverseElement(GetNode(i,elem),elem); + + } + + if (removenodes) { + for (i=1; i <= nbcnx; ++i) { + if (GetNode(i,elem)->InverseElements().IsEmpty()) + FreeNode(GetNode(i,elem)); + } + } + +} + +//======================================================================= +//function : RemoveFromParent +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::RemoveFromParent() +{ + if (myParent.IsNull()) + return Standard_False; + + return (myParent->RemoveSubMesh(this)); + +} + +//======================================================================= +//function : RemoveSubMesh +//purpose : +//======================================================================= + +Standard_Boolean SMDS_Mesh::RemoveSubMesh(const Handle(SMDS_Mesh)& aMesh) +{ + Standard_Boolean found = Standard_False; + + SMDS_ListIteratorOfListOfMesh itmsh(myChildren); + for (;itmsh.More() && !found; itmsh.Next()) { + Handle(SMDS_Mesh) submesh; + submesh = itmsh.Value(); + if (submesh == aMesh) { + found = Standard_True; + myChildren.Remove(itmsh); + } + } + + return found; +} + +//======================================================================= +//function : RemoveInverseElement +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveInverseElement(const Handle(SMDS_MeshElement)& elem, + const Handle(SMDS_MeshElement)& parent) const +{ + if (!myHasInverse) + return; + + Handle(SMDS_MeshNode)& node = *((Handle(SMDS_MeshNode)*)&elem); + node->RemoveInverseElement(parent); +} + +//======================================================================= +//function : RemoveAncestors +//purpose : +//======================================================================= + +void SMDS_Mesh::RemoveAncestors(const Handle(SMDS_MeshElement)& elem, + const SMDS_MapOfMeshOrientedElement& map) +{ + + if (!myHasInverse) + return; + + SMDS_MapIteratorOfExtendedOrientedMap itAnc(map); + + for (;itAnc.More();itAnc.Next()) { + const Handle(SMDS_MeshElement)& ME = itAnc.Key(); + Standard_Integer nbcnx = ME->NbNodes(); + + for (Standard_Integer i=1; i <= nbcnx; ++i) { + RemoveInverseElement(GetNode(i,ME),ME); + } + } + + SMDS_MapIteratorOfExtendedOrientedMap itAnc2(map); + + for (;itAnc2.More();itAnc2.Next()) { + const Handle(SMDS_MeshElement)& ME = itAnc2.Key(); + RemoveElement(ME); + } +} + +//======================================================================= +//function : BuildMapNodeAncestors +//purpose : +//======================================================================= + +void SMDS_Mesh::BuildMapNodeAncestors(const Handle(SMDS_MeshElement)& ME, + SMDS_MapOfMeshOrientedElement& map) const +{ + + if (!myHasInverse) + return; + + Standard_Integer nbcnx = ME->NbNodes(); + + for (Standard_Integer i=1; i <= nbcnx; ++i) { + const SMDS_ListOfMeshElement& lstInvElements = GetNode(i,ME)->InverseElements(); + + SMDS_ListIteratorOfListOfMeshElement it(lstInvElements); + for (;it.More();it.Next()) { + const Handle(SMDS_MeshElement)& meParent = it.Value(); + if (Contains(meParent)) + map.Add(meParent); + } + + } + +} + + +//======================================================================= +//function : BuildMapEdgeAncestors +//purpose : +//======================================================================= + +void SMDS_Mesh::BuildMapEdgeAncestors(const Handle(SMDS_MeshElement)& ME, + SMDS_MapOfMeshOrientedElement& map) const +{ + + if (!myHasInverse) + return; + + Standard_Integer nbcnx = ME->NbNodes(); + + for (Standard_Integer i=1; i <= nbcnx; ++i) { + const SMDS_ListOfMeshElement& lstInvElements = GetNode(i,ME)->InverseElements(); + + SMDS_ListIteratorOfListOfMeshElement it(lstInvElements); + for (;it.More();it.Next()) { + const Handle(SMDS_MeshElement)& meParent = it.Value(); + if ( !meParent->IsKind(STANDARD_TYPE(SMDS_MeshEdge)) && Contains(meParent)) + map.Add(meParent); + } + + } + +} + + +//======================================================================= +//function : BuildMapFaceAncestors +//purpose : +//======================================================================= + +void SMDS_Mesh::BuildMapFaceAncestors(const Handle(SMDS_MeshElement)& ME, + SMDS_MapOfMeshOrientedElement& map) const +{ + + if (!myHasInverse) + return; + + Standard_Integer nbcnx = ME->NbNodes(); + + for (Standard_Integer i=1; i <= nbcnx; ++i) { + const SMDS_ListOfMeshElement& lstInvElements = GetNode(i,ME)->InverseElements(); + + SMDS_ListIteratorOfListOfMeshElement it(lstInvElements); + for (;it.More();it.Next()) { + const Handle(SMDS_MeshElement)& meParent = it.Value(); + if ( !meParent->IsKind(STANDARD_TYPE(SMDS_MeshEdge)) + && ( !meParent->IsKind(STANDARD_TYPE(SMDS_MeshFace))) && Contains(meParent) ) + map.Add(meParent); + } + + } + +} + + +//======================================================================= +//function : FindEdge +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindEdge(const Standard_Integer idnode1, + const Standard_Integer idnode2 ) const +{ + Handle(SMDS_MeshEdge) edge = new SMDS_MeshEdge(0,idnode1,idnode2); + return FindEdge(edge); +} + +//======================================================================= +//function : FindFace +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3 ) const +{ + Handle(SMDS_MeshFace) face = new SMDS_MeshTriangle(0,idnode1,idnode2,idnode3); + return FindFace(face); +} + +//======================================================================= +//function : FindFace +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4 ) const +{ + Handle(SMDS_MeshFace) face = new SMDS_MeshQuadrangle(0,idnode1,idnode2,idnode3,idnode4); + return FindFace(face); +} + +//======================================================================= +//function : FindElement +//purpose : +//======================================================================= + +Handle(SMDS_MeshElement) SMDS_Mesh::FindElement(const Standard_Integer IDelem) const +{ + return myElementIDFactory->MeshElement(IDelem); +} + +//======================================================================= +//function : GetNode +//purpose : +//======================================================================= + +Handle(SMDS_MeshNode) SMDS_Mesh::GetNode(const Standard_Integer rank, + const Handle(SMDS_MeshElement)& ME) const + +{ + const Standard_Integer idnode = ME->GetConnection(rank); // take care, no control of bounds + + Handle(SMDS_MeshElement) elem = FindNode(idnode); + Handle(SMDS_MeshNode)& node = *((Handle(SMDS_MeshNode)*)&elem); + return node; + +} + + +//======================================================================= +//function : DumpNodes +//purpose : +//======================================================================= + +void SMDS_Mesh::DumpNodes() const +{ + MESSAGE( "dump nodes of mesh : " ); + + SMDS_MapIteratorOfExtendedOrientedMap itnode(myNodes); + + for (;itnode.More();itnode.Next()) { + const Handle(SMDS_MeshElement)& node = itnode.Key(); + MESSAGE( node); + + } + +} + + + +//======================================================================= +//function : DumpEdges +//purpose : +//======================================================================= + +void SMDS_Mesh::DumpEdges() const +{ + MESSAGE( "dump edges of mesh : " ); + + SMDS_MapIteratorOfExtendedOrientedMap itedge(myEdges); + + for (;itedge.More();itedge.Next()) { + const Handle(SMDS_MeshElement)& edge = itedge.Key(); + MESSAGE( edge); + } +} + + + +//======================================================================= +//function : DumpFaces +//purpose : +//======================================================================= + +void SMDS_Mesh::DumpFaces() const +{ + MESSAGE( "dump faces of mesh : " ); + + SMDS_MapIteratorOfExtendedOrientedMap itface(myFaces); + + for (;itface.More();itface.Next()) { + const Handle(SMDS_MeshElement)& face = itface.Key(); + MESSAGE( face); + } +} + + +//======================================================================= +//function : DumpVolumes +//purpose : +//======================================================================= + +void SMDS_Mesh::DumpVolumes() const +{ + MESSAGE( "dump volumes of mesh : " ); + + SMDS_MapIteratorOfExtendedOrientedMap itvol(myVolumes); + + for (;itvol.More();itvol.Next()) { + const Handle(SMDS_MeshElement)& volume = itvol.Key(); + MESSAGE( volume); + } +} + + + +//======================================================================= +//function : DebugStats +//purpose : +//======================================================================= + +void SMDS_Mesh::DebugStats() const +{ + //VRV: T2.4 impossible to use Logger server + MESSAGE( "Debug stats of mesh : " ); + + MESSAGE( "===== NODES =====" ); + myNodes.Statistics(cout); + + MESSAGE( "===== EDGES =====" ); + myEdges.Statistics(cout); + + MESSAGE( "===== FACES =====" ); + myFaces.Statistics(cout); + + MESSAGE( "===== VOLUMES =====" ); + myVolumes.Statistics(cout); + //VRV: T2.4 impossible to use Logger server + + MESSAGE( "End Debug stats of mesh " ); + + //#ifdef DEB + SMDS_MapIteratorOfExtendedOrientedMap itnode(myNodes); + Standard_Integer sizeofnodes = 0; + Standard_Integer sizeoffaces = 0; + + + for (;itnode.More();itnode.Next()) { + const Handle(SMDS_MeshElement)& node = itnode.Key(); + + Standard_Transient *p = node->This(); + sizeofnodes += sizeof( *((SMDS_MeshNode *)p) ); + + SMDS_ListIteratorOfListOfMeshElement it(node->InverseElements()); + for (;it.More();it.Next()) { + const Handle(SMDS_MeshElement)& me = it.Value(); + sizeofnodes += sizeof(me); + } + + } + + SMDS_MapIteratorOfExtendedOrientedMap itface(myFaces); + + for (;itface.More();itface.Next()) { + const Handle(SMDS_MeshElement)& face = itface.Key(); + + Standard_Transient *p = face->This(); + sizeoffaces += sizeof( *((SMDS_MeshFace *)p) ); + + } + MESSAGE( "total size of node elements = " << sizeofnodes );; + MESSAGE( "total size of face elements = " << sizeoffaces );; + + //#endif + +} + +//======================================================================= +//function : RebuildAllInverseConnections +//purpose : +//======================================================================= + +void SMDS_Mesh::RebuildAllInverseConnections() +{ + if (!myParent.IsNull()) + myParent->RebuildAllInverseConnections(); + + else { + // Clear all inverseconnections from nodes + SMDS_MapIteratorOfExtendedOrientedMap itnode(myNodes); + + for (;itnode.More();itnode.Next()) { + const Handle(SMDS_MeshElement)& elem = itnode.Key(); + elem->ClearInverseElements(); + } + + + RebuildInverseConnections(); + + SMDS_ListIteratorOfListOfMesh itmsh(myChildren); + for (;itmsh.More(); itmsh.Next()) { + Handle(SMDS_Mesh) submesh; + submesh = itmsh.Value(); + + submesh->RebuildInverseConnections(); + + } + } +} + +//======================================================================= +//function : RebuildInverseConnections +//purpose : +//======================================================================= + +void SMDS_Mesh::RebuildInverseConnections() +{ + // rebuld inverse connections to volumes + SMDS_MapIteratorOfExtendedOrientedMap itvol(myVolumes); + + for (;itvol.More();itvol.Next()) { + const Handle(SMDS_MeshElement)& vol = itvol.Key(); + + Standard_Integer nbcnx = vol->NbNodes(); + for (Standard_Integer inode=1; inode<=nbcnx; ++inode) { + Standard_Integer idnode = vol->GetConnection(inode); + Handle(SMDS_MeshElement) node = FindNode(idnode); + if (!node.IsNull()) + node->AddInverseElement(vol); + } + + } + + // rebuld inverse connections to faces + SMDS_MapIteratorOfExtendedOrientedMap itface(myFaces); + + for (;itface.More();itface.Next()) { + const Handle(SMDS_MeshElement)& face = itface.Key(); + + Standard_Integer nbcnx = face->NbNodes(); + for (Standard_Integer inode=1; inode<=nbcnx; ++inode) { + Standard_Integer idnode = face->GetConnection(inode); + Handle(SMDS_MeshElement) node = FindNode(idnode); + if (!node.IsNull()) + node->AddInverseElement(face); + } + + } + + // rebuld inverse connections to edges + SMDS_MapIteratorOfExtendedOrientedMap itedge(myEdges); + + for (;itedge.More();itedge.Next()) { + const Handle(SMDS_MeshElement)& edge = itedge.Key(); + + Standard_Integer nbcnx = edge->NbNodes(); + for (Standard_Integer inode=1; inode<=nbcnx; ++inode) { + Standard_Integer idnode = edge->GetConnection(inode); + Handle(SMDS_MeshElement) node = FindNode(idnode); + if (!node.IsNull()) + node->AddInverseElement(edge); + } + + } + + myHasInverse = Standard_True; +} + + +//======================================================================= +//function : SubMeshIterator +//purpose : returns the ith SubMesh +//======================================================================= + +void SMDS_Mesh::SubMeshIterator(SMDS_ListIteratorOfListOfMesh& itmsh) const +{ + itmsh.Initialize(myChildren); +} + diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx new file mode 100644 index 000000000..e4db75a00 --- /dev/null +++ b/src/SMDS/SMDS_Mesh.hxx @@ -0,0 +1,224 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_Mesh_HeaderFile +#define _SMDS_Mesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif + +#ifndef _SMDS_MapOfMeshOrientedElement_HeaderFile +#include "SMDS_MapOfMeshOrientedElement.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_ListOfMesh_HeaderFile +#include "SMDS_ListOfMesh.hxx" +#endif +#ifndef _Handle_SMDS_MeshNodeIDFactory_HeaderFile +#include "Handle_SMDS_MeshNodeIDFactory.hxx" +#endif +#ifndef _Handle_SMDS_MeshElementIDFactory_HeaderFile +#include "Handle_SMDS_MeshElementIDFactory.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include "Standard_Boolean.hxx" +#endif +#ifndef _SMDS_MeshObject_HeaderFile +#include "SMDS_MeshObject.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_MeshNode_HeaderFile +#include "Handle_SMDS_MeshNode.hxx" +#endif +class SMDS_MeshNodeIDFactory; +class SMDS_MeshElementIDFactory; +class Standard_NoSuchObject; +class SMDS_MeshVolumesIterator; +class SMDS_MeshFacesIterator; +class SMDS_MeshEdgesIterator; +class SMDS_MeshNodesIterator; +class SMDS_MeshElement; +class SMDS_MeshNode; +class SMDS_ListIteratorOfListOfMesh; +class SMDS_MapOfMeshOrientedElement; + + +class SMDS_Mesh : public SMDS_MeshObject { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_Mesh(const Standard_Integer nbnodes = 10,const Standard_Integer nbedges = 10,const Standard_Integer nbfaces = 10,const Standard_Integer nbvolumes = 10); +Standard_EXPORT Handle_SMDS_Mesh AddSubMesh() ; +Standard_EXPORT virtual Standard_Integer AddNode(const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT virtual Standard_Boolean AddNodeWithID(const Standard_Real x,const Standard_Real y,const Standard_Real z,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Boolean AddNode(const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT virtual Standard_Boolean AddEdgeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT virtual Standard_Boolean AddFaceWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT virtual Standard_Boolean AddFaceWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT virtual Standard_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ; +Standard_EXPORT virtual Standard_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ; +Standard_EXPORT virtual Standard_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer ID) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ; +Standard_EXPORT virtual Standard_Boolean AddVolumeWithID(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8,const Standard_Integer ID) ; +Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4) ; +Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5) ; +Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5,const Handle(SMDS_MeshElement)& node6) ; +Standard_EXPORT Handle_SMDS_MeshElement AddVolume(const Handle(SMDS_MeshElement)& node1,const Handle(SMDS_MeshElement)& node2,const Handle(SMDS_MeshElement)& node3,const Handle(SMDS_MeshElement)& node4,const Handle(SMDS_MeshElement)& node5,const Handle(SMDS_MeshElement)& node6,const Handle(SMDS_MeshElement)& node7,const Handle(SMDS_MeshElement)& node8) ; +Standard_EXPORT virtual void RemoveNode(const Standard_Integer IDnode) ; +Standard_EXPORT virtual void RemoveEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT virtual void RemoveFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT virtual void RemoveFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT virtual void RemoveElement(const Standard_Integer IDelem,const Standard_Boolean removenodes = Standard_False) ; +Standard_EXPORT void RemoveElement(const Handle(SMDS_MeshElement)& elem,const Standard_Boolean removenodes = Standard_False) ; +Standard_EXPORT virtual Standard_Boolean RemoveFromParent() ; +Standard_EXPORT virtual Standard_Boolean RemoveSubMesh(const Handle(SMDS_Mesh)& aMesh) ; +Standard_EXPORT Handle_SMDS_MeshNode GetNode(const Standard_Integer rank,const Handle(SMDS_MeshElement)& ME) const; +Standard_EXPORT Handle_SMDS_MeshElement FindNode(const Standard_Integer idnode) const; +Standard_EXPORT Handle_SMDS_MeshElement FindEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) const; +Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) const; +Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const; +Standard_EXPORT Handle_SMDS_MeshElement FindElement(const Standard_Integer IDelem) const; +Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& elem) const; +Standard_EXPORT void RebuildAllInverseConnections() ; +Standard_EXPORT void SubMeshIterator(SMDS_ListIteratorOfListOfMesh& itmsh) const; +Standard_EXPORT inline Standard_Integer NbNodes() const; +Standard_EXPORT inline Standard_Integer NbEdges() const; +Standard_EXPORT inline Standard_Integer NbFaces() const; +Standard_EXPORT inline Standard_Integer NbVolumes() const; +Standard_EXPORT inline Standard_Integer NbSubMesh() const; +Standard_EXPORT void DumpNodes() const; +Standard_EXPORT void DumpEdges() const; +Standard_EXPORT void DumpFaces() const; +Standard_EXPORT void DumpVolumes() const; +Standard_EXPORT void DebugStats() const; +Standard_EXPORT Handle_SMDS_MeshElement CreateEdge(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateFace(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateFace(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) const; +Standard_EXPORT Handle_SMDS_MeshElement CreateVolume(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) const; +Standard_EXPORT ~SMDS_Mesh(); + + +friend class SMDS_MeshVolumesIterator; +friend class SMDS_MeshFacesIterator; +friend class SMDS_MeshEdgesIterator; +friend class SMDS_MeshNodesIterator; + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_Mesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT Handle_SMDS_MeshElement FindNode(const Handle(SMDS_MeshElement)& node) const; +Standard_EXPORT Handle_SMDS_MeshElement FindEdge(const Handle(SMDS_MeshElement)& edge) const; +Standard_EXPORT Handle_SMDS_MeshElement FindFace(const Handle(SMDS_MeshElement)& face) const; +Standard_EXPORT Handle_SMDS_MeshElement FindVolume(const Handle(SMDS_MeshElement)& volume) const; +Standard_EXPORT void RemoveInverseElement(const Handle(SMDS_MeshElement)& node,const Handle(SMDS_MeshElement)& parent) const; +Standard_EXPORT Standard_Boolean RemoveNode(const Handle(SMDS_MeshElement)& node) ; +Standard_EXPORT void RemoveEdge(const Handle(SMDS_MeshElement)& edge) ; +Standard_EXPORT void RemoveFace(const Handle(SMDS_MeshElement)& face) ; +Standard_EXPORT void RemoveVolume(const Handle(SMDS_MeshElement)& volume) ; +Standard_EXPORT Handle_SMDS_MeshElement GetNode(const Standard_Integer ID) const; +Standard_EXPORT void RemoveAncestors(const Handle(SMDS_MeshElement)& ME,const SMDS_MapOfMeshOrientedElement& map) ; + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_Mesh(const Handle(SMDS_Mesh)& parent,const Standard_Integer nbnodes = 10); +Standard_EXPORT Standard_Boolean AddNode(const Handle(SMDS_MeshElement)& node) ; +Standard_EXPORT void FreeNode(const Handle(SMDS_MeshElement)& node) ; +Standard_EXPORT void BuildMapNodeAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const; +Standard_EXPORT void BuildMapEdgeAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const; +Standard_EXPORT void BuildMapFaceAncestors(const Handle(SMDS_MeshElement)& ME,SMDS_MapOfMeshOrientedElement& map) const; +Standard_EXPORT void RebuildInverseConnections() ; + + + // Fields PRIVATE + // +SMDS_MapOfMeshOrientedElement myNodes; +SMDS_MapOfMeshOrientedElement myEdges; +SMDS_MapOfMeshOrientedElement myFaces; +SMDS_MapOfMeshOrientedElement myVolumes; +Handle_SMDS_Mesh myParent; +SMDS_ListOfMesh myChildren; +Handle_SMDS_MeshNodeIDFactory myNodeIDFactory; +Handle_SMDS_MeshElementIDFactory myElementIDFactory; +Standard_Boolean myHasInverse; + + +}; + + +#include "SMDS_Mesh.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_Mesh.ixx b/src/SMDS/SMDS_Mesh.ixx new file mode 100644 index 000000000..c81e2dae8 --- /dev/null +++ b/src/SMDS/SMDS_Mesh.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_Mesh.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_Mesh::~SMDS_Mesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_Mesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_Mesh", + sizeof(SMDS_Mesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_Mesh) Handle(SMDS_Mesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_Mesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_Mesh))) { + _anOtherObject = Handle(SMDS_Mesh)((Handle(SMDS_Mesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_Mesh::DynamicType() const +{ + return STANDARD_TYPE(SMDS_Mesh) ; +} +Standard_Boolean SMDS_Mesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_Mesh) == AType || SMDS_MeshObject::IsKind(AType)); +} +Handle_SMDS_Mesh::~Handle_SMDS_Mesh() {} + diff --git a/src/SMDS/SMDS_Mesh.jxx b/src/SMDS/SMDS_Mesh.jxx new file mode 100644 index 000000000..9f8349556 --- /dev/null +++ b/src/SMDS/SMDS_Mesh.jxx @@ -0,0 +1,36 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshNodeIDFactory_HeaderFile +#include "SMDS_MeshNodeIDFactory.hxx" +#endif +#ifndef _SMDS_MeshElementIDFactory_HeaderFile +#include "SMDS_MeshElementIDFactory.hxx" +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_MeshVolumesIterator_HeaderFile +#include "SMDS_MeshVolumesIterator.hxx" +#endif +#ifndef _SMDS_MeshFacesIterator_HeaderFile +#include "SMDS_MeshFacesIterator.hxx" +#endif +#ifndef _SMDS_MeshEdgesIterator_HeaderFile +#include "SMDS_MeshEdgesIterator.hxx" +#endif +#ifndef _SMDS_MeshNodesIterator_HeaderFile +#include "SMDS_MeshNodesIterator.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshNode_HeaderFile +#include "SMDS_MeshNode.hxx" +#endif +#ifndef _SMDS_MapOfMeshOrientedElement_HeaderFile +#include "SMDS_MapOfMeshOrientedElement.hxx" +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif diff --git a/src/SMDS/SMDS_Mesh.lxx b/src/SMDS/SMDS_Mesh.lxx new file mode 100644 index 000000000..fe73d5f71 --- /dev/null +++ b/src/SMDS/SMDS_Mesh.lxx @@ -0,0 +1,57 @@ +// File: SMDS_Mesh.lxx +// Created: Thu Jan 24 09:45:40 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : NbNodes +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Mesh::NbNodes() const +{ + return myNodes.Extent(); +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Mesh::NbEdges() const +{ + return myEdges.Extent(); +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Mesh::NbFaces() const +{ + return myFaces.Extent(); +} + +//======================================================================= +//function : NbVolumes +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Mesh::NbVolumes() const +{ + return myVolumes.Extent(); +} + + +//======================================================================= +//function : NbSubMesh +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Mesh::NbSubMesh() const +{ + return myChildren.Extent(); +} + + diff --git a/src/SMDS/SMDS_MeshEdge.cdl b/src/SMDS/SMDS_MeshEdge.cdl new file mode 100755 index 000000000..335d64aed --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.cdl @@ -0,0 +1,38 @@ +-- File: SMDS_MeshEdge.cdl +-- Created: Wed Jan 23 16:15:51 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshEdge from SMDS inherits MeshElement from SMDS + + ---Purpose: + +is + Create (ID,idnode1,idnode2: Integer) returns mutable MeshEdge; + + ComputeKey(me: mutable); + ---Purpose: compute the ID of the edge based on the id's of its + -- bounding nodes + ---C++: inline + + GetKey(me) returns Integer is redefined static; + ---C++: inline + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2: Integer) is private; + + Print(me; OS: in out OStream) is redefined static; + +fields + + myKey : Integer; + myNodes : Integer [2]; + +end MeshEdge; diff --git a/src/SMDS/SMDS_MeshEdge.cxx b/src/SMDS/SMDS_MeshEdge.cxx new file mode 100644 index 000000000..cbb448286 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File: SMDS_MeshEdge.cxx +// Created: Wed Jan 23 17:02:20 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshEdge.ixx" + +//======================================================================= +//function : SMDS_MeshEdge +//purpose : +//======================================================================= + +SMDS_MeshEdge::SMDS_MeshEdge(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2) : +SMDS_MeshElement(ID,2,SMDSAbs_Edge) +{ + SetConnections(idnode1,idnode2); + ComputeKey(); +} + +//======================================================================= +//function : SetConnections +//purpose : +//======================================================================= +void SMDS_MeshEdge::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + Standard_Integer idmin = (idnode1 < idnode2? idnode1 : idnode2); + + myNodes[0] = idmin; + if (idmin == idnode1) { + myNodes[1] = idnode2; + } else { + myNodes[1] = idnode1; + } +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_MeshEdge::Print(Standard_OStream& OS) const +{ + OS << "edge <" << myID <<"> : (" << myNodes[0] << " , " << myNodes[1] << ") " << endl; +} + + + + diff --git a/src/SMDS/SMDS_MeshEdge.hxx b/src/SMDS/SMDS_MeshEdge.hxx new file mode 100644 index 000000000..74c4e9351 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.hxx @@ -0,0 +1,113 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshEdge_HeaderFile +#define _SMDS_MeshEdge_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshEdge_HeaderFile +#include "Handle_SMDS_MeshEdge.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Standard_OStream_HeaderFile +#include +#endif + + +class SMDS_MeshEdge : public SMDS_MeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshEdge(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2); +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline Standard_Integer GetKey() const; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT void Print(Standard_OStream& OS) const; +Standard_EXPORT ~SMDS_MeshEdge(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshEdge_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2) ; + + + // Fields PRIVATE + // +Standard_Integer myKey; +Standard_Integer myNodes[2]; + + +}; + + +#include "SMDS_MeshEdge.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshEdge.ixx b/src/SMDS/SMDS_MeshEdge.ixx new file mode 100644 index 000000000..735bb4b67 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshEdge.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshEdge::~SMDS_MeshEdge() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshEdge_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshEdge", + sizeof(SMDS_MeshEdge), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshEdge) Handle(SMDS_MeshEdge)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshEdge) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshEdge))) { + _anOtherObject = Handle(SMDS_MeshEdge)((Handle(SMDS_MeshEdge)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshEdge::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshEdge) ; +} +Standard_Boolean SMDS_MeshEdge::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshEdge) == AType || SMDS_MeshElement::IsKind(AType)); +} +Handle_SMDS_MeshEdge::~Handle_SMDS_MeshEdge() {} + diff --git a/src/SMDS/SMDS_MeshEdge.jxx b/src/SMDS/SMDS_MeshEdge.jxx new file mode 100644 index 000000000..e5a7e1dd7 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshEdge_HeaderFile +#include "SMDS_MeshEdge.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshEdge.lxx b/src/SMDS/SMDS_MeshEdge.lxx new file mode 100644 index 000000000..42cde7c49 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdge.lxx @@ -0,0 +1,51 @@ +// File: SMDS_MeshEdge.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the edge based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshEdge::ComputeKey() +{ + // myKey = (myNodes[0] << 2) + myNodes[1]; + myKey = myNodes[0] + myNodes[1]; +} + +//======================================================================= +//function : GetKey +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshEdge::GetKey() const +{ + return myKey; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshEdge::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshEdge::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + diff --git a/src/SMDS/SMDS_MeshEdgesIterator.cdl b/src/SMDS/SMDS_MeshEdgesIterator.cdl new file mode 100644 index 000000000..79aa3c86c --- /dev/null +++ b/src/SMDS/SMDS_MeshEdgesIterator.cdl @@ -0,0 +1,35 @@ +-- File: SMDS_MeshEdgesIterator.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshEdgesIterator from SMDS inherits MeshElementsIterator from SMDS + + ---Purpose: The Iterator objet to iterate on all edges of a mesh + -- + +uses + Mesh from SMDS, + MeshElement from SMDS, + MapIteratorOfExtendedMap from SMDS + +raises + NoMoreObject, + NoSuchObject + +is + + Create returns MeshEdgesIterator from SMDS; + ---Purpose: Creates an empty Iterator. + + Create(M : Mesh from SMDS) returns MeshEdgesIterator from SMDS; + ---Purpose: Creates an Iterator on faces of mesh . + + Initialize(me : in out; M : Mesh from SMDS) + ---Purpose: Reset the Iterator on the faces of mesh . + is redefined static; + + +end MeshEdgesIterator; diff --git a/src/SMDS/SMDS_MeshEdgesIterator.cxx b/src/SMDS/SMDS_MeshEdgesIterator.cxx new file mode 100644 index 000000000..235855055 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdgesIterator.cxx @@ -0,0 +1,42 @@ +using namespace std; +// File: SMDS_MeshEdgesIterator.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshEdgesIterator.ixx" + +//======================================================================= +//function : SMDS_MeshEdgesIterator +//purpose : +//======================================================================= + +SMDS_MeshEdgesIterator::SMDS_MeshEdgesIterator() +{ +} + +//======================================================================= +//function : SMDS_MeshEdgesIterator +//purpose : +//======================================================================= + +SMDS_MeshEdgesIterator::SMDS_MeshEdgesIterator(const Handle(SMDS_Mesh)& M) +{ + Initialize(M); +} + +//======================================================================= +//function : Initialize +//purpose : +//======================================================================= + +void SMDS_MeshEdgesIterator::Initialize(const Handle(SMDS_Mesh)& M) +{ + + myMapIterator.Initialize(M->myEdges); + if (More()) { + myCurrentMeshElement = myMapIterator.Key(); + } +} + diff --git a/src/SMDS/SMDS_MeshEdgesIterator.hxx b/src/SMDS/SMDS_MeshEdgesIterator.hxx new file mode 100644 index 000000000..ed2b22bc6 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdgesIterator.hxx @@ -0,0 +1,96 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshEdgesIterator_HeaderFile +#define _SMDS_MeshEdgesIterator_HeaderFile + +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#include "SMDS_MeshElementsIterator.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_Mesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshEdgesIterator : public SMDS_MeshElementsIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshEdgesIterator(); +Standard_EXPORT SMDS_MeshEdgesIterator(const Handle(SMDS_Mesh)& M); +Standard_EXPORT void Initialize(const Handle(SMDS_Mesh)& M) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshEdgesIterator.ixx b/src/SMDS/SMDS_MeshEdgesIterator.ixx new file mode 100644 index 000000000..b30c842c9 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdgesIterator.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshEdgesIterator.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshEdgesIterator.jxx b/src/SMDS/SMDS_MeshEdgesIterator.jxx new file mode 100644 index 000000000..a6a892465 --- /dev/null +++ b/src/SMDS/SMDS_MeshEdgesIterator.jxx @@ -0,0 +1,12 @@ +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshEdgesIterator_HeaderFile +#include "SMDS_MeshEdgesIterator.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshElement.cdl b/src/SMDS/SMDS_MeshElement.cdl new file mode 100644 index 000000000..b14b6758e --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.cdl @@ -0,0 +1,115 @@ + +-- -- File: SMDS_MeshElement.cdl +-- Created: Wed Jan 23 12:09:23 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshElement from SMDS inherits MeshObject from SMDS + + ---Purpose: MeshElement is the base class for all mesh -- + -- elements that constitutes a mesh. The children + -- classes will include elements like Node, Edge, + -- Face, and Volume. + +uses + ListOfMeshElement from SMDS, + HArray1OfDir from TColgp, + Dir from gp, + Vec from gp, + ElementType from SMDSAbs + +raises + OutOfRange from Standard + +is + + Initialize(ID: Integer; NbConnections : Integer; + Type: ElementType from SMDSAbs) + returns mutable MeshElement; + + HashCode (me; Upper : Integer) returns Integer is redefined static; + ---Purpose: Returns a hashed value denoting . This value is in + -- the range 1... + ---C++: inline + + IsSame(me; other : MeshElement) returns Boolean; + ---Purpose: Returns True if two mesh elements are same but not + -- necessary the same orientation + ---C++: inline + + + IsEqual(me; other : MeshElement) returns Boolean; + ---Purpose: Returns True if two mesh elements are same and + -- havesame orientation + ---C++: inline + + + IsNodeInElement(me; idnode: Integer) returns Boolean; + ---Purpose: returns true or false if idnode is in the list of the + -- direct connections + ---C++: inline + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1, idnode2 : out Integer) is virtual; + ---Purpose: returns the idnodes of the ith edge (rank) of the face + -- rank must be comprised between 1 and myNbConnections included. + + GetFaceDefinedByNodes(me; rank: Integer; idnode : Address;nb: out Integer) is virtual; + ---Purpose: returns the idnodes of the ith edge (rank) of the face + -- rank must be comprised between 1 and myNbConnections included. + + GetConnections(me) returns Address + is virtual protected; + + GetConnection(me; rank: Integer) returns Integer is virtual; + + AddInverseElement(me:mutable; ME: MeshElement from SMDS) is virtual; + + InverseElements(me) returns ListOfMeshElement is virtual; + ---C++: return const & + + ClearInverseElements(me: mutable) is virtual; + + NbNodes(me) returns Integer; + ---C++: inline + + NbEdges(me) returns Integer + is virtual; + + NbFaces(me) returns Integer + is virtual; + + GetID(me) returns Integer; + ---Purpose: returns identifier of node + ---C++: inline + + GetKey(me) returns Integer is deferred; + ---Purpose: returns key for hashcode + + + SetNormal(me: mutable; rank: Integer; vx,vy,vz : Real) is virtual; + ---Purpose: set the rank th normal of the element + + SetNormal(me: mutable; rank: Integer; v : Vec from gp) is virtual; + ---Purpose: set the rank th normal of the element + + GetNormal(me:mutable; rank: Integer) returns Dir from gp is virtual; + ---Purpose: get the rank th normal of the element + + Print(me; OS: in out OStream) is virtual; + ---Purpose: + ---C++: alias "friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& OS, const Handle(SMDS_MeshElement)& );" + + GetType(me) returns ElementType from SMDSAbs; + ---Purpose: return the mesh element type + ---C++: inline + +fields + + myID : Integer is protected; + myType : ElementType from SMDSAbs; + myNbNodes : Integer is protected; + myNormals : HArray1OfDir from TColgp is protected; + +end MeshElement; diff --git a/src/SMDS/SMDS_MeshElement.cxx b/src/SMDS/SMDS_MeshElement.cxx new file mode 100644 index 000000000..df8be2d75 --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.cxx @@ -0,0 +1,177 @@ +using namespace std; +// File: SMDS_MeshElement.cxx +// Created: Wed Jan 23 16:49:11 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElement.ixx" + +//======================================================================= +//function : SMDS_MeshElement +//purpose : +//======================================================================= + +SMDS_MeshElement::SMDS_MeshElement(const Standard_Integer ID, const Standard_Integer nb,const SMDSAbs_ElementType Type) + :myID(ID),myNbNodes(nb),myType(Type) +{ +} + +//======================================================================= +//function : GetConnections +//purpose : +//======================================================================= + +Standard_Address SMDS_MeshElement::GetConnections() const +{ + return (Standard_Address)&myID; +} + + +//======================================================================= +//function : GetConnection +//purpose : +//======================================================================= + +Standard_Integer SMDS_MeshElement::GetConnection(const Standard_Integer rank) const +{ + return myID; +} + + +//======================================================================= +//function : InverseElements +//purpose : +//======================================================================= + +const SMDS_ListOfMeshElement& SMDS_MeshElement::InverseElements() const +{ + static SMDS_ListOfMeshElement empty; + return empty; +} + +//======================================================================= +//function : ClearInverseElements +//purpose : +//======================================================================= + +void SMDS_MeshElement::ClearInverseElements() +{ +} + +//======================================================================= +//function : AddInverseElement +//purpose : +//======================================================================= + +void SMDS_MeshElement::AddInverseElement(const Handle(SMDS_MeshElement)& elem) +{ +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +Standard_Integer SMDS_MeshElement::NbEdges() const +{ + return 0; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +Standard_Integer SMDS_MeshElement::NbFaces() const +{ + return 0; +} + + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= + +void SMDS_MeshElement::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = 0; + idnode2 = 0; +} + +//======================================================================= +//function : GetFaceDefinedByNodes +//purpose : +//======================================================================= + +void SMDS_MeshElement::GetFaceDefinedByNodes(const Standard_Integer rank, + const Standard_Address idnode, + Standard_Integer& nb) const +{ + nb = 0; +} + +//======================================================================= +//function : SetNormal +//purpose : +//======================================================================= + +void SMDS_MeshElement::SetNormal(const Standard_Integer rank, + const Standard_Real vx, + const Standard_Real vy, + const Standard_Real vz) + +{ + if (myNormals.IsNull()) { + myNormals = new TColgp_HArray1OfDir(1,NbNodes()); + } + myNormals->SetValue(rank, gp_Dir(vx,vy,vz)); +} + +//======================================================================= +//function : SetNormal +//purpose : +//======================================================================= + +void SMDS_MeshElement::SetNormal(const Standard_Integer rank, + const gp_Vec& V) +{ + if (myNormals.IsNull()) { + myNormals = new TColgp_HArray1OfDir(1,NbNodes()); + } + myNormals->SetValue(rank, gp_Dir(V)); +} + +//======================================================================= +//function : GetNormal +//purpose : +//======================================================================= + +gp_Dir SMDS_MeshElement::GetNormal(const Standard_Integer rank) +{ + if (myNormals.IsNull()) { + myNormals = new TColgp_HArray1OfDir(1,NbNodes()); + } + return myNormals->Value(rank); +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_MeshElement::Print(Standard_OStream& OS) const +{ + OS << "dump of mesh element" << endl; +} + + +Standard_OStream& operator << (Standard_OStream& OS + ,const Handle(SMDS_MeshElement)& ME) +{ + ME->Print(OS); + return OS; +} diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx new file mode 100644 index 000000000..61631859c --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -0,0 +1,148 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshElement_HeaderFile +#define _SMDS_MeshElement_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDSAbs_ElementType_HeaderFile +#include "SMDSAbs_ElementType.hxx" +#endif +#ifndef _Handle_TColgp_HArray1OfDir_HeaderFile +#include "Handle_TColgp_HArray1OfDir.hxx" +#endif +#ifndef _SMDS_MeshObject_HeaderFile +#include "SMDS_MeshObject.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _Standard_OStream_HeaderFile +#include +#endif +class TColgp_HArray1OfDir; +class Standard_OutOfRange; +class SMDS_ListOfMeshElement; +class gp_Vec; +class gp_Dir; + + +class SMDS_MeshElement : public SMDS_MeshObject { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline Standard_Integer HashCode(const Standard_Integer Upper) const; +Standard_EXPORT inline Standard_Boolean IsSame(const Handle(SMDS_MeshElement)& other) const; +Standard_EXPORT inline Standard_Boolean IsEqual(const Handle(SMDS_MeshElement)& other) const; +Standard_EXPORT inline Standard_Boolean IsNodeInElement(const Standard_Integer idnode) const; +Standard_EXPORT virtual void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT virtual void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const; +Standard_EXPORT virtual Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT virtual void AddInverseElement(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT virtual const SMDS_ListOfMeshElement& InverseElements() const; +Standard_EXPORT virtual void ClearInverseElements() ; +Standard_EXPORT inline Standard_Integer NbNodes() const; +Standard_EXPORT virtual Standard_Integer NbEdges() const; +Standard_EXPORT virtual Standard_Integer NbFaces() const; +Standard_EXPORT inline Standard_Integer GetID() const; +Standard_EXPORT virtual Standard_Integer GetKey() const = 0; +Standard_EXPORT virtual void SetNormal(const Standard_Integer rank,const Standard_Real vx,const Standard_Real vy,const Standard_Real vz) ; +Standard_EXPORT virtual void SetNormal(const Standard_Integer rank,const gp_Vec& v) ; +Standard_EXPORT virtual gp_Dir GetNormal(const Standard_Integer rank) ; +Standard_EXPORT virtual void Print(Standard_OStream& OS) const; +friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& OS, const Handle(SMDS_MeshElement)& ); +Standard_EXPORT inline SMDSAbs_ElementType GetType() const; +Standard_EXPORT ~SMDS_MeshElement(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshElement_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDS_MeshElement(const Standard_Integer ID,const Standard_Integer NbConnections,const SMDSAbs_ElementType Type); +Standard_EXPORT virtual Standard_Address GetConnections() const; + + + // Fields PROTECTED + // +Standard_Integer myID; +Standard_Integer myNbNodes; +Handle_TColgp_HArray1OfDir myNormals; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMDSAbs_ElementType myType; + + +}; + + +#include "SMDS_MeshElement.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshElement.ixx b/src/SMDS/SMDS_MeshElement.ixx new file mode 100644 index 000000000..a54cd490e --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshElement.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshElement::~SMDS_MeshElement() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshElement_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshElement", + sizeof(SMDS_MeshElement), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshElement) Handle(SMDS_MeshElement)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshElement) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshElement))) { + _anOtherObject = Handle(SMDS_MeshElement)((Handle(SMDS_MeshElement)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshElement::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshElement) ; +} +Standard_Boolean SMDS_MeshElement::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshElement) == AType || SMDS_MeshObject::IsKind(AType)); +} +Handle_SMDS_MeshElement::~Handle_SMDS_MeshElement() {} + diff --git a/src/SMDS/SMDS_MeshElement.jxx b/src/SMDS/SMDS_MeshElement.jxx new file mode 100644 index 000000000..61b241d0e --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.jxx @@ -0,0 +1,18 @@ +#ifndef _TColgp_HArray1OfDir_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _gp_Vec_HeaderFile +#include +#endif +#ifndef _gp_Dir_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshElement.lxx b/src/SMDS/SMDS_MeshElement.lxx new file mode 100644 index 000000000..c1b9a5fb8 --- /dev/null +++ b/src/SMDS/SMDS_MeshElement.lxx @@ -0,0 +1,131 @@ +// File: SMDS_MeshElement.lxx +// Created: Thu Jan 24 09:45:40 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshElement::HashCode(const Standard_Integer Upper) const +{ + return (GetKey() % Upper); +} + +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= + +inline Standard_Boolean SMDS_MeshElement::IsEqual(const Handle(SMDS_MeshElement)& other) const +{ + if (this->NbNodes()!=other->NbNodes()) + return Standard_False; + Standard_Integer *c1,*c2; + Standard_Integer n = this->NbNodes(); + + c1 = (Standard_Integer *)this->GetConnections(); + c2 = (Standard_Integer *)other->GetConnections(); + if (*c1 != *c2) + return Standard_False; + + n--; + c1++; + c2++; + + for (;n--; c1++,c2++) { + if (*c1 != *c2) { + return Standard_False; + } + } + + return Standard_True; + +} + +//======================================================================= +//function : IsSame +//purpose : +//======================================================================= + +inline Standard_Boolean SMDS_MeshElement::IsSame(const Handle(SMDS_MeshElement)& other) const +{ + if (this->NbNodes()!=other->NbNodes()) + return Standard_False; + Standard_Integer *c1,*c2; + Standard_Integer n = this->NbNodes(); + + c1 = (Standard_Integer *)this->GetConnections(); + c2 = (Standard_Integer *)other->GetConnections(); + if (*c1 != *c2) + return Standard_False; + + n--; + c1++; + c2++; + + Standard_Integer off = n-1; + + for (;n--; c1++,c2++) { + if (*c1 != *c2 && *c1 != *(c2+off)) { + return Standard_False; + } + off -= 2; + } + + return Standard_True; +} + +//======================================================================= +//function : IsNodeInElement +//purpose : +//======================================================================= +inline Standard_Boolean SMDS_MeshElement::IsNodeInElement(const Standard_Integer idnode) const +{ + if (idnode < GetConnection(1)) + return Standard_False; + + Standard_Integer *c; + c = (Standard_Integer *)this->GetConnections(); + Standard_Integer n = myNbNodes; + + for (;n--; c++) { + if (*c == idnode) + return Standard_True; + } + + return Standard_False; +} + + +//======================================================================= +//function : NbNodes +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshElement::NbNodes() const +{ + return myNbNodes; +} + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshElement::GetID() const +{ + return myID; +} + +//======================================================================= +//function : GetType +//purpose : +//======================================================================= +inline SMDSAbs_ElementType SMDS_MeshElement::GetType() const +{ + return myType; +} + + + diff --git a/src/SMDS/SMDS_MeshElementIDFactory.cdl b/src/SMDS/SMDS_MeshElementIDFactory.cdl new file mode 100644 index 000000000..588c3a5a2 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.cdl @@ -0,0 +1,45 @@ +-- File: SMDS_MeshElementIDFactory.cdl +-- Created: Tue May 7 16:19:36 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +private class MeshElementIDFactory from SMDS inherits MeshIDFactory + + ---Purpose: + +uses + DataMapOfIntegerMeshElement from SMDS, + MeshElement from SMDS + +is + + Create returns mutable MeshElementIDFactory from SMDS; + + GetFreeID(me:mutable) returns Integer is redefined static; + ---Purpose: returns a free identifier for mesh from + -- the pool of ID + ---C++: inline + + ReleaseID(me: mutable;ID :Integer) is redefined static; + ---Purpose: free the ID and give it back to the pool of ID + ---C++: inline + + BindID(me: mutable;ID :Integer; elem : MeshElement from SMDS ) + returns Boolean; + ---Purpose: bind the ID with the mesh element + -- returns False if the ID is already bound. + -- In this case the element is not replaced + ---C++: inline + + MeshElement(me;ID :Integer) returns MeshElement from SMDS; + ---Purpose: returns the MeshElement associated with ID + -- raises an exception if the ID is not bound + ---C++: inline + + +fields + myIDElements : DataMapOfIntegerMeshElement from SMDS; + +end MeshElementIDFactory; diff --git a/src/SMDS/SMDS_MeshElementIDFactory.cxx b/src/SMDS/SMDS_MeshElementIDFactory.cxx new file mode 100644 index 000000000..34b433f41 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.cxx @@ -0,0 +1,18 @@ +using namespace std; +// File: SMDS_MeshElementIDFactory.cxx +// Created: Tue May 7 16:57:15 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElementIDFactory.ixx" + +//======================================================================= +//function : SMDS_MeshElementIDFactory +//purpose : +//======================================================================= + +SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory() : SMDS_MeshIDFactory() +{ +} + diff --git a/src/SMDS/SMDS_MeshElementIDFactory.hxx b/src/SMDS/SMDS_MeshElementIDFactory.hxx new file mode 100644 index 000000000..7875a9af0 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.hxx @@ -0,0 +1,114 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshElementIDFactory_HeaderFile +#define _SMDS_MeshElementIDFactory_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElementIDFactory_HeaderFile +#include "Handle_SMDS_MeshElementIDFactory.hxx" +#endif + +#ifndef _SMDS_DataMapOfIntegerMeshElement_HeaderFile +#include "SMDS_DataMapOfIntegerMeshElement.hxx" +#endif +#ifndef _SMDS_MeshIDFactory_HeaderFile +#include "SMDS_MeshIDFactory.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +class SMDS_MeshElement; + + +class SMDS_MeshElementIDFactory : public SMDS_MeshIDFactory { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshElementIDFactory(); +Standard_EXPORT inline Standard_Integer GetFreeID() ; +Standard_EXPORT inline void ReleaseID(const Standard_Integer ID) ; +Standard_EXPORT inline Standard_Boolean BindID(const Standard_Integer ID,const Handle(SMDS_MeshElement)& elem) ; +Standard_EXPORT inline Handle_SMDS_MeshElement MeshElement(const Standard_Integer ID) const; +Standard_EXPORT ~SMDS_MeshElementIDFactory(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshElementIDFactory_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMDS_DataMapOfIntegerMeshElement myIDElements; + + +}; + + +#include "SMDS_MeshElementIDFactory.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshElementIDFactory.ixx b/src/SMDS/SMDS_MeshElementIDFactory.ixx new file mode 100644 index 000000000..95cf8263c --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshElementIDFactory.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshElementIDFactory::~SMDS_MeshElementIDFactory() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshElementIDFactory_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshIDFactory); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshIDFactory); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshElementIDFactory", + sizeof(SMDS_MeshElementIDFactory), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshElementIDFactory) Handle(SMDS_MeshElementIDFactory)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshElementIDFactory) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshElementIDFactory))) { + _anOtherObject = Handle(SMDS_MeshElementIDFactory)((Handle(SMDS_MeshElementIDFactory)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshElementIDFactory::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshElementIDFactory) ; +} +Standard_Boolean SMDS_MeshElementIDFactory::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshElementIDFactory) == AType || SMDS_MeshIDFactory::IsKind(AType)); +} +Handle_SMDS_MeshElementIDFactory::~Handle_SMDS_MeshElementIDFactory() {} + diff --git a/src/SMDS/SMDS_MeshElementIDFactory.jxx b/src/SMDS/SMDS_MeshElementIDFactory.jxx new file mode 100644 index 000000000..f7eadb66d --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementIDFactory_HeaderFile +#include "SMDS_MeshElementIDFactory.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshElementIDFactory.lxx b/src/SMDS/SMDS_MeshElementIDFactory.lxx new file mode 100644 index 000000000..b8581cbf6 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementIDFactory.lxx @@ -0,0 +1,56 @@ +// File: SMDS_MeshElementIDFactory.lxx +// Created: Tue May 7 16:30:34 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : GetFreeID +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshElementIDFactory::GetFreeID() +{ + if (myPoolOfID.IsEmpty()) { + ++myMaxID; + while (myIDElements.IsBound(myMaxID)) ++myMaxID; + return myMaxID; + } else { + Standard_Integer ID = myPoolOfID.Top(); + myPoolOfID.Pop(); + return ID; + } + +} + +//======================================================================= +//function : ReleaseID +//purpose : +//======================================================================= +inline void SMDS_MeshElementIDFactory::ReleaseID(const Standard_Integer ID) +{ + myIDElements.UnBind(ID); + if (ID < myMaxID) + myPoolOfID.Push(ID); + +} + +//======================================================================= +//function : BindID +//purpose : +//======================================================================= +inline Standard_Boolean SMDS_MeshElementIDFactory::BindID(const Standard_Integer ID, + const Handle(SMDS_MeshElement)& elem) +{ + return myIDElements.Bind(ID,elem); + +} + +//======================================================================= +//function : MeshElement +//purpose : +//======================================================================= +inline Handle(SMDS_MeshElement) SMDS_MeshElementIDFactory::MeshElement(const Standard_Integer ID) const +{ + return myIDElements.Find(ID); + +} + diff --git a/src/SMDS/SMDS_MeshElementMapHasher.cdl b/src/SMDS/SMDS_MeshElementMapHasher.cdl new file mode 100644 index 000000000..4e9aa74de --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.cdl @@ -0,0 +1,31 @@ +-- File: SMDS_MeshElementMapHasher.cdl +-- Created: Wed Jan 23 14:04:07 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshElementMapHasher from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + + +is + HashCode(myclass; ME: MeshElement from SMDS; Upper : Integer) returns Integer; + ---Purpose: Returns a HasCode value for the Key in the + -- range 0..Upper. + -- + ---C++: inline + + IsEqual(myclass; ME1, ME2 : MeshElement from SMDS) returns Boolean; + ---Purpose: Returns True when the two keys are the same. Two + -- same keys must have the same hashcode, the + -- contrary is not necessary. + -- + ---C++: inline + + +end MeshElementMapHasher; diff --git a/src/SMDS/SMDS_MeshElementMapHasher.cxx b/src/SMDS/SMDS_MeshElementMapHasher.cxx new file mode 100644 index 000000000..c6d7e352f --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.cxx @@ -0,0 +1,8 @@ +using namespace std; +// File: SMDS_MeshElementMapHasher.cxx +// Created: Wed Jan 23 14:09:30 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElementMapHasher.ixx" diff --git a/src/SMDS/SMDS_MeshElementMapHasher.hxx b/src/SMDS/SMDS_MeshElementMapHasher.hxx new file mode 100644 index 000000000..307824f7d --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.hxx @@ -0,0 +1,97 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#define _SMDS_MeshElementMapHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class SMDS_MeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshElementMapHasher { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline static Standard_Integer HashCode(const Handle(SMDS_MeshElement)& ME,const Standard_Integer Upper) ; +Standard_EXPORT inline static Standard_Boolean IsEqual(const Handle(SMDS_MeshElement)& ME1,const Handle(SMDS_MeshElement)& ME2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshElementMapHasher.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshElementMapHasher.ixx b/src/SMDS/SMDS_MeshElementMapHasher.ixx new file mode 100644 index 000000000..a158ff549 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshElementMapHasher.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshElementMapHasher.jxx b/src/SMDS/SMDS_MeshElementMapHasher.jxx new file mode 100644 index 000000000..1042eee59 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshElementMapHasher.lxx b/src/SMDS/SMDS_MeshElementMapHasher.lxx new file mode 100644 index 000000000..bc6649cc3 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementMapHasher.lxx @@ -0,0 +1,27 @@ +// File: SMDS_MeshElementMapHasher.lxx +// Created: Wed Jan 23 14:07:00 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElement.hxx" + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshElementMapHasher::HashCode + (const Handle(SMDS_MeshElement)& ME, const Standard_Integer Upper) +{ + return ME->HashCode(Upper); +} + +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= +inline Standard_Boolean SMDS_MeshElementMapHasher::IsEqual + (const Handle(SMDS_MeshElement)& ME1, const Handle(SMDS_MeshElement)& ME2) +{ + return ME1->IsSame(ME2); +} diff --git a/src/SMDS/SMDS_MeshElementsIterator.cdl b/src/SMDS/SMDS_MeshElementsIterator.cdl new file mode 100644 index 000000000..a51d0f98a --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.cdl @@ -0,0 +1,56 @@ +-- File: SMDS_MeshElementsIterator.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshElementsIterator from SMDS + + ---Purpose: The Iterator objet to iterate on all faces of a mesh + -- + +uses + Mesh from SMDS, + MeshElement from SMDS, + MapIteratorOfExtendedOrientedMap from SMDS + +raises + NoMoreObject, + NoSuchObject + +is + + Delete(me:out) is virtual; + ---C++: alias "Standard_EXPORT virtual ~SMDS_MeshElementsIterator(){Delete();}" + + Initialize(me : in out; M : Mesh from SMDS) + ---Purpose: Reset the Iterator on the faces of mesh . + is deferred; + + More(me) returns Boolean + ---Purpose: Returns True if there is a current meshface. + -- + ---C++: inline + is static; + + Next(me : in out) + ---Purpose: Moves to the next face. + raises + NoMoreObject from Standard + is static; + + Value(me) returns MeshElement from SMDS + ---Purpose: Returns the meshface. + raises + NoSuchObject from Standard + ---C++: return const & + ---C++: inline + is static; + + +fields + myCurrentMeshElement : MeshElement from SMDS is protected; + myMapIterator : MapIteratorOfExtendedOrientedMap from SMDS is protected; + +end MeshElementsIterator; diff --git a/src/SMDS/SMDS_MeshElementsIterator.cxx b/src/SMDS/SMDS_MeshElementsIterator.cxx new file mode 100644 index 000000000..da45e145f --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.cxx @@ -0,0 +1,24 @@ +using namespace std; +// File: SMDS_MeshElementsIterator.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElementsIterator.ixx" + +void SMDS_MeshElementsIterator::Delete() +{} + +//======================================================================= +//function : Next +//purpose : +//======================================================================= + +void SMDS_MeshElementsIterator::Next() +{ + myMapIterator.Next(); + if (More()) { + myCurrentMeshElement = myMapIterator.Key(); + } +} diff --git a/src/SMDS/SMDS_MeshElementsIterator.hxx b/src/SMDS/SMDS_MeshElementsIterator.hxx new file mode 100644 index 000000000..f94d004b1 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.hxx @@ -0,0 +1,109 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#define _SMDS_MeshElementsIterator_HeaderFile + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class SMDS_MeshElement; +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_Mesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshElementsIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual void Delete() ; +Standard_EXPORT virtual ~SMDS_MeshElementsIterator(){Delete();} +Standard_EXPORT virtual void Initialize(const Handle(SMDS_Mesh)& M) = 0; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT inline const Handle_SMDS_MeshElement& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +Handle_SMDS_MeshElement myCurrentMeshElement; +SMDS_MapIteratorOfExtendedOrientedMap myMapIterator; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshElementsIterator.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshElementsIterator.ixx b/src/SMDS/SMDS_MeshElementsIterator.ixx new file mode 100644 index 000000000..a4b01e7c5 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshElementsIterator.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshElementsIterator.jxx b/src/SMDS/SMDS_MeshElementsIterator.jxx new file mode 100644 index 000000000..e5bb60a50 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.jxx @@ -0,0 +1,15 @@ +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#include "SMDS_MeshElementsIterator.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshElementsIterator.lxx b/src/SMDS/SMDS_MeshElementsIterator.lxx new file mode 100644 index 000000000..6e08e6404 --- /dev/null +++ b/src/SMDS/SMDS_MeshElementsIterator.lxx @@ -0,0 +1,28 @@ +// File: SMDS_MeshElementsIterator.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include + +//======================================================================= +//function : More +//purpose : +//======================================================================= + +inline Standard_Boolean SMDS_MeshElementsIterator::More() const +{ + return myMapIterator.More(); +} + +//======================================================================= +//function : Value +//purpose : +//======================================================================= + +inline const Handle(SMDS_MeshElement)& SMDS_MeshElementsIterator::Value() const +{ + Standard_NoSuchObject_Raise_if(!More(),"SMDS_MeshElementsIterator::Value"); + return myCurrentMeshElement; +} diff --git a/src/SMDS/SMDS_MeshFace.cdl b/src/SMDS/SMDS_MeshFace.cdl new file mode 100755 index 000000000..4dfd830ab --- /dev/null +++ b/src/SMDS/SMDS_MeshFace.cdl @@ -0,0 +1,34 @@ +-- File: SMDS_MeshFace.cdl +-- Created: Wed Jan 23 16:16:09 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshFace from SMDS inherits MeshElement from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +is + + Initialize(ID: Integer; NbConnections : Integer) returns mutable MeshFace; + + ComputeKey(me: mutable) is deferred; + ---Purpose: compute the ID of the face based on the id's of its + -- bounding nodes + + GetKey(me) returns Integer is redefined static; + ---C++: inline + + NbEdges(me) returns Integer + is redefined virtual; + + Print(me; OS: in out OStream) is redefined virtual; + +fields + myKey : Integer is protected; + +end MeshFace; diff --git a/src/SMDS/SMDS_MeshFace.cxx b/src/SMDS/SMDS_MeshFace.cxx new file mode 100644 index 000000000..94deb44ff --- /dev/null +++ b/src/SMDS/SMDS_MeshFace.cxx @@ -0,0 +1,45 @@ +using namespace std; +// File: SMDS_MeshFace.cxx +// Created: Wed Jan 23 17:02:27 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshFace.ixx" + + +//======================================================================= +//function : SMDS_MeshFace +//purpose : +//======================================================================= + +SMDS_MeshFace::SMDS_MeshFace(const Standard_Integer ID, const Standard_Integer nb) +:SMDS_MeshElement(ID,nb,SMDSAbs_Face) +{ +} + + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +Standard_Integer SMDS_MeshFace::NbEdges() const +{ + return myNbNodes; +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_MeshFace::Print(Standard_OStream& OS) const +{ + OS << "face <" << myID <<" > : "; + for (Standard_Integer i=1; i +#endif +#ifndef _Handle_SMDS_MeshFace_HeaderFile +#include "Handle_SMDS_MeshFace.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_OStream_HeaderFile +#include +#endif + + +class SMDS_MeshFace : public SMDS_MeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual void ComputeKey() = 0; +Standard_EXPORT inline Standard_Integer GetKey() const; +Standard_EXPORT virtual Standard_Integer NbEdges() const; +Standard_EXPORT virtual void Print(Standard_OStream& OS) const; +Standard_EXPORT ~SMDS_MeshFace(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshFace_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDS_MeshFace(const Standard_Integer ID,const Standard_Integer NbConnections); + + + // Fields PROTECTED + // +Standard_Integer myKey; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshFace.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshFace.ixx b/src/SMDS/SMDS_MeshFace.ixx new file mode 100644 index 000000000..766d598d4 --- /dev/null +++ b/src/SMDS/SMDS_MeshFace.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshFace.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshFace::~SMDS_MeshFace() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshFace_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshFace", + sizeof(SMDS_MeshFace), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshFace) Handle(SMDS_MeshFace)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshFace) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshFace))) { + _anOtherObject = Handle(SMDS_MeshFace)((Handle(SMDS_MeshFace)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshFace::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshFace) ; +} +Standard_Boolean SMDS_MeshFace::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshFace) == AType || SMDS_MeshElement::IsKind(AType)); +} +Handle_SMDS_MeshFace::~Handle_SMDS_MeshFace() {} + diff --git a/src/SMDS/SMDS_MeshFace.jxx b/src/SMDS/SMDS_MeshFace.jxx new file mode 100644 index 000000000..439ee7742 --- /dev/null +++ b/src/SMDS/SMDS_MeshFace.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshFace_HeaderFile +#include "SMDS_MeshFace.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshFace.lxx b/src/SMDS/SMDS_MeshFace.lxx new file mode 100644 index 000000000..db68e26ea --- /dev/null +++ b/src/SMDS/SMDS_MeshFace.lxx @@ -0,0 +1,16 @@ +// File: SMDS_MeshFace.lxx +// Created: Tue May 7 18:09:59 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : GetKey +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshFace::GetKey() const +{ + return myKey; +} + diff --git a/src/SMDS/SMDS_MeshFacesIterator.cdl b/src/SMDS/SMDS_MeshFacesIterator.cdl new file mode 100644 index 000000000..99901da4a --- /dev/null +++ b/src/SMDS/SMDS_MeshFacesIterator.cdl @@ -0,0 +1,34 @@ +-- File: SMDS_MeshFacesIterator.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshFacesIterator from SMDS inherits MeshElementsIterator from SMDS + + ---Purpose: The Iterator objet to iterate on all faces of a mesh + -- + +uses + Mesh from SMDS, + MeshElement from SMDS + +raises + NoMoreObject, + NoSuchObject + +is + + Create returns MeshFacesIterator from SMDS; + ---Purpose: Creates an empty Iterator. + + Create(M : Mesh from SMDS) returns MeshFacesIterator from SMDS; + ---Purpose: Creates an Iterator on faces of mesh . + + Initialize(me : in out; M : Mesh from SMDS) + ---Purpose: Reset the Iterator on the faces of mesh . + is redefined static; + + +end MeshFacesIterator; diff --git a/src/SMDS/SMDS_MeshFacesIterator.cxx b/src/SMDS/SMDS_MeshFacesIterator.cxx new file mode 100644 index 000000000..466488c09 --- /dev/null +++ b/src/SMDS/SMDS_MeshFacesIterator.cxx @@ -0,0 +1,42 @@ +using namespace std; +// File: SMDS_MeshFacesIterator.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshFacesIterator.ixx" + +//======================================================================= +//function : SMDS_MeshFacesIterator +//purpose : +//======================================================================= + +SMDS_MeshFacesIterator::SMDS_MeshFacesIterator() +{ +} + +//======================================================================= +//function : SMDS_MeshFacesIterator +//purpose : +//======================================================================= + +SMDS_MeshFacesIterator::SMDS_MeshFacesIterator(const Handle(SMDS_Mesh)& M) +{ + Initialize(M); +} + +//======================================================================= +//function : Initialize +//purpose : +//======================================================================= + +void SMDS_MeshFacesIterator::Initialize(const Handle(SMDS_Mesh)& M) +{ + + myMapIterator.Initialize(M->myFaces); + if (More()) { + myCurrentMeshElement = myMapIterator.Key(); + } +} + diff --git a/src/SMDS/SMDS_MeshFacesIterator.hxx b/src/SMDS/SMDS_MeshFacesIterator.hxx new file mode 100644 index 000000000..1d66bc106 --- /dev/null +++ b/src/SMDS/SMDS_MeshFacesIterator.hxx @@ -0,0 +1,96 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshFacesIterator_HeaderFile +#define _SMDS_MeshFacesIterator_HeaderFile + +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#include "SMDS_MeshElementsIterator.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_Mesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshFacesIterator : public SMDS_MeshElementsIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshFacesIterator(); +Standard_EXPORT SMDS_MeshFacesIterator(const Handle(SMDS_Mesh)& M); +Standard_EXPORT void Initialize(const Handle(SMDS_Mesh)& M) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshFacesIterator.ixx b/src/SMDS/SMDS_MeshFacesIterator.ixx new file mode 100644 index 000000000..380bcdad0 --- /dev/null +++ b/src/SMDS/SMDS_MeshFacesIterator.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshFacesIterator.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshFacesIterator.jxx b/src/SMDS/SMDS_MeshFacesIterator.jxx new file mode 100644 index 000000000..32276e371 --- /dev/null +++ b/src/SMDS/SMDS_MeshFacesIterator.jxx @@ -0,0 +1,12 @@ +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshFacesIterator_HeaderFile +#include "SMDS_MeshFacesIterator.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshGroup.cdl b/src/SMDS/SMDS_MeshGroup.cdl new file mode 100644 index 000000000..40f4080f9 --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.cdl @@ -0,0 +1,116 @@ +-- File: SMDS_MeshGroup.cdl +-- Created: Mon Jun 3 11:49:08 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshGroup from SMDS inherits MeshObject from SMDS + + ---Purpose: + +uses + Mesh from SMDS, + MeshElement from SMDS, + ElementType from SMDSAbs, + ListOfMeshGroup from SMDS, + MapOfMeshElement from SMDS + +raises + + NoSuchObject from Standard, + TypeMismatch from Standard + +is + + ---===================================== + ---Category: public API methods + -- Group creation and deletion + --====================================== + + Create(aMesh: Mesh from SMDS) returns MeshGroup from SMDS; + ---Purpose: constructor + + AddSubGroup(me: mutable) returns MeshGroup from SMDS; + ---Purpose: create a sub group. + -- uses a private constructor to create an instance of the + -- subgroup and attahc it the parent group. + + RemoveSubGroup(me: mutable; aGroup: MeshGroup from SMDS) + returns Boolean + ---Purpose: remove aGroup from the list of Children + -- if the subgroup does not belong to this, it returns False + -- (True otherwise) + is virtual; + + RemoveFromParent(me: mutable) + returns Boolean + ---Purpose: remove this from its parent + -- if this has no parent then it returns False (True otherwise) + is virtual; + + + + ---===================================== + ---Category: public API methods + -- Group contents edition + --====================================== + + Clear(me: mutable); + ---Purpose: clear the group + -- once the group is cleared, the type is set to All + -- but the referenced mesh remains. + + Add(me: mutable; ME: MeshElement from SMDS) + raises TypeMismatch from Standard; + ---Purpose: add an element to the group + + Remove(me: mutable; ME: MeshElement from SMDS) + raises NoSuchObject from Standard; + ---Purpose: remove an element from the group + -- raises if the element is not in the group + + ---===================================== + ---Category: public API methods + -- Group contents exploration + --====================================== + + IsEmpty(me) + returns Boolean from Standard; + ---Purpose: check if the group is empty + + Extent(me) returns Integer from Standard; + ---Purpose: return numner of elements in the group + + Type(me) returns ElementType from SMDSAbs; + ---Purpose: return current element type + -- if the group is empty, returns All + + Contains(me; ME : MeshElement from SMDS) + returns Boolean from Standard; + ---Purpose: check if the group contains the mesh element + + Elements(me) returns MapOfMeshElement from SMDS; + ---Purpose: check if the group contains the mesh element + ---C++: return const & + ---C++: inline + + ---=========================================== + ---Category: private or protected API methods + -- + --============================================ + + Create(parent: MeshGroup) returns mutable MeshGroup + ---Purpose: constructor used internally to create subgroup + -- + is private; + + +fields + myMesh : Mesh from SMDS; + myType : ElementType from SMDSAbs; + myElements : MapOfMeshElement from SMDS; + myParent : MeshGroup from SMDS; + myChildren : ListOfMeshGroup from SMDS; + +end MeshGroup; diff --git a/src/SMDS/SMDS_MeshGroup.cxx b/src/SMDS/SMDS_MeshGroup.cxx new file mode 100644 index 000000000..6951886fd --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.cxx @@ -0,0 +1,162 @@ +using namespace std; +// File: SMDS_MeshGroup.cxx +// Created: Mon Jun 3 12:15:55 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshGroup.ixx" +#include "SMDS_ListIteratorOfListOfMeshGroup.hxx" + +//======================================================================= +//function : SMDS_MeshGroup +//purpose : +//======================================================================= + +SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh) + :myMesh(aMesh),myType(SMDSAbs_All) +{ +} + +//======================================================================= +//function : SMDS_MeshGroup +//purpose : +//======================================================================= + +SMDS_MeshGroup::SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent) + :myMesh(parent->myMesh),myType(SMDSAbs_All),myParent(parent) +{ +} + +//======================================================================= +//function : AddSubGroup +//purpose : +//======================================================================= + +Handle(SMDS_MeshGroup) SMDS_MeshGroup::AddSubGroup() +{ + Handle(SMDS_MeshGroup) subgroup = new SMDS_MeshGroup(this); + if (!subgroup.IsNull()) { + myChildren.Append(subgroup); + } + return subgroup; +} + +//======================================================================= +//function : RemoveSubGroup +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MeshGroup::RemoveSubGroup(const Handle(SMDS_MeshGroup)& aGroup) +{ + Standard_Boolean found = Standard_False; + + SMDS_ListIteratorOfListOfMeshGroup itgroup(myChildren); + for (;itgroup.More() && !found; itgroup.Next()) { + Handle(SMDS_MeshGroup) subgroup; + subgroup = itgroup.Value(); + if (subgroup == aGroup) { + found = Standard_True; + myChildren.Remove(itgroup); + } + } + + return found; +} + +//======================================================================= +//function : RemoveFromParent +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MeshGroup::RemoveFromParent() +{ + if (myParent.IsNull()) + return Standard_False; + + return (myParent->RemoveSubGroup(this)); + +} + +//======================================================================= +//function : Clear +//purpose : +//======================================================================= + +void SMDS_MeshGroup::Clear() +{ + myElements.Clear(); + myType = SMDSAbs_All; +} + +//======================================================================= +//function : IsEmpty +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MeshGroup::IsEmpty() const +{ + return myElements.IsEmpty(); +} + +//======================================================================= +//function : Extent +//purpose : +//======================================================================= + +Standard_Integer SMDS_MeshGroup::Extent() const +{ + return myElements.Extent(); +} + +//======================================================================= +//function : Add +//purpose : +//======================================================================= + +void SMDS_MeshGroup::Add(const Handle(SMDS_MeshElement)& ME) +{ + // the type of the group is determined by the first element added + if (myElements.IsEmpty()) { + myType = ME->GetType(); + } + + if (ME->GetType() != myType) { + Standard_TypeMismatch::Raise("SMDS_MeshGroup::Add"); + } + + myElements.Add(ME); +} + + +//======================================================================= +//function : Remove +//purpose : +//======================================================================= + +void SMDS_MeshGroup::Remove(const Handle(SMDS_MeshElement)& ME) +{ + myElements.Remove(ME); + if (myElements.IsEmpty()) + myType = SMDSAbs_All; +} + +//======================================================================= +//function : Type +//purpose : +//======================================================================= + +SMDSAbs_ElementType SMDS_MeshGroup::Type() const +{ + return myType; +} + +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +Standard_Boolean SMDS_MeshGroup::Contains(const Handle(SMDS_MeshElement)& ME) const +{ + return myElements.Contains(ME); +} diff --git a/src/SMDS/SMDS_MeshGroup.hxx b/src/SMDS/SMDS_MeshGroup.hxx new file mode 100644 index 000000000..46d4048a0 --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.hxx @@ -0,0 +1,142 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshGroup_HeaderFile +#define _SMDS_MeshGroup_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#include "Handle_SMDS_MeshGroup.hxx" +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _SMDSAbs_ElementType_HeaderFile +#include "SMDSAbs_ElementType.hxx" +#endif +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _Handle_SMDS_MeshGroup_HeaderFile +#include "Handle_SMDS_MeshGroup.hxx" +#endif +#ifndef _SMDS_ListOfMeshGroup_HeaderFile +#include "SMDS_ListOfMeshGroup.hxx" +#endif +#ifndef _SMDS_MeshObject_HeaderFile +#include "SMDS_MeshObject.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class SMDS_Mesh; +class Standard_NoSuchObject; +class Standard_TypeMismatch; +class SMDS_MeshElement; +class SMDS_MapOfMeshElement; + + +class SMDS_MeshGroup : public SMDS_MeshObject { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshGroup(const Handle(SMDS_Mesh)& aMesh); +Standard_EXPORT Handle_SMDS_MeshGroup AddSubGroup() ; +Standard_EXPORT virtual Standard_Boolean RemoveSubGroup(const Handle(SMDS_MeshGroup)& aGroup) ; +Standard_EXPORT virtual Standard_Boolean RemoveFromParent() ; +Standard_EXPORT void Clear() ; +Standard_EXPORT void Add(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT void Remove(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT Standard_Boolean IsEmpty() const; +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT SMDSAbs_ElementType Type() const; +Standard_EXPORT Standard_Boolean Contains(const Handle(SMDS_MeshElement)& ME) const; +Standard_EXPORT inline const SMDS_MapOfMeshElement& Elements() const; +Standard_EXPORT ~SMDS_MeshGroup(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshGroup_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_MeshGroup(const Handle(SMDS_MeshGroup)& parent); + + + // Fields PRIVATE + // +Handle_SMDS_Mesh myMesh; +SMDSAbs_ElementType myType; +SMDS_MapOfMeshElement myElements; +Handle_SMDS_MeshGroup myParent; +SMDS_ListOfMeshGroup myChildren; + + +}; + + +#include "SMDS_MeshGroup.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshGroup.ixx b/src/SMDS/SMDS_MeshGroup.ixx new file mode 100644 index 000000000..c871db275 --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshGroup.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include "Standard_TypeMismatch.hxx" +#endif + +SMDS_MeshGroup::~SMDS_MeshGroup() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshGroup_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshGroup", + sizeof(SMDS_MeshGroup), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshGroup) Handle(SMDS_MeshGroup)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshGroup) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshGroup))) { + _anOtherObject = Handle(SMDS_MeshGroup)((Handle(SMDS_MeshGroup)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshGroup::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshGroup) ; +} +Standard_Boolean SMDS_MeshGroup::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshGroup) == AType || SMDS_MeshObject::IsKind(AType)); +} +Handle_SMDS_MeshGroup::~Handle_SMDS_MeshGroup() {} + diff --git a/src/SMDS/SMDS_MeshGroup.jxx b/src/SMDS/SMDS_MeshGroup.jxx new file mode 100644 index 000000000..1c3d76cec --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.jxx @@ -0,0 +1,21 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshGroup_HeaderFile +#include "SMDS_MeshGroup.hxx" +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _SMDS_MeshGroup_HeaderFile +#include "SMDS_MeshGroup.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshGroup.lxx b/src/SMDS/SMDS_MeshGroup.lxx new file mode 100644 index 000000000..697c509b1 --- /dev/null +++ b/src/SMDS/SMDS_MeshGroup.lxx @@ -0,0 +1,14 @@ +// File: SMDS_MeshGroup.lxx +// Created: Fri Jun 7 12:00:06 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : Elements +//purpose : +//======================================================================= + +inline const SMDS_MapOfMeshElement& SMDS_MeshGroup::Elements() const +{ + return myElements; +} diff --git a/src/SMDS/SMDS_MeshHexahedron.cdl b/src/SMDS/SMDS_MeshHexahedron.cdl new file mode 100644 index 000000000..f1a7d04fa --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.cdl @@ -0,0 +1,69 @@ +-- File: SMDS_MeshHexahedron.cdl +-- Created: Wed Jan 23 16:17:22 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshHexahedron from SMDS inherits MeshVolume from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + + +raises + ConstructionError from Standard + +is + + + Create (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8: Integer) + returns mutable MeshHexahedron; + ---Purpose: constructor for a hexaedra + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1 : out Integer; idnode2: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + GetFaceDefinedByNodes(me; rank: Integer; idnode : Address; nb: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith face (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + ComputeKey(me: mutable) is redefined static; + ---Purpose: compute the ID of the volume based on the id's of its + -- bounding nodes + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8: Integer) + is private; + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + NbEdges(me) returns Integer + is redefined static; + ---C++: inline + + NbFaces(me) returns Integer + is redefined static; + ---C++: inline + + NodesOfFace(myclass; rankface,ranknode: Integer) + returns Integer; + ---Purpose: returns the rank node in mynodes. Useful to extract faces from volume + -- + + NodesOfEdge(me; rankedge: Integer; ranknode: Integer) returns Integer; + +fields + + myNodes : Integer [8]; + +end MeshHexahedron; diff --git a/src/SMDS/SMDS_MeshHexahedron.cxx b/src/SMDS/SMDS_MeshHexahedron.cxx new file mode 100644 index 000000000..f2986a1ea --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.cxx @@ -0,0 +1,196 @@ +using namespace std; +// File: SMDS_MeshHexahedron.cxx +// Created: Wed Jan 23 17:02:34 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshHexahedron.ixx" +#include + + +//======================================================================= +//function : SMDS_MeshHexahedron +//purpose : Hexaedra +//======================================================================= + +SMDS_MeshHexahedron::SMDS_MeshHexahedron(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8):SMDS_MeshVolume(ID,8) +{ + SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8); + ComputeKey(); +} + + +//======================================================================= +//function : SetConnections +//purpose : Heaxahedron +//======================================================================= +void SMDS_MeshHexahedron::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) +{ + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + idmin = (idmin < idnode4 ? idmin : idnode4); + idmin = (idmin < idnode5 ? idmin : idnode5); + idmin = (idmin < idnode6 ? idmin : idnode6); + idmin = (idmin < idnode7 ? idmin : idnode7); + idmin = (idmin < idnode8 ? idmin : idnode8); + + myNodes[0] = idmin; + if (idmin == idnode1) { // 1 2 3 4 5 6 7 8 + myNodes[1] = idnode2; + myNodes[2] = idnode3; + myNodes[3] = idnode4; + myNodes[4] = idnode5; + myNodes[5] = idnode6; + myNodes[6] = idnode7; + myNodes[7] = idnode8; + } else if (idmin == idnode2) { // 2 3 4 1 6 7 8 5 + myNodes[1] = idnode3; + myNodes[2] = idnode4; + myNodes[3] = idnode1; + myNodes[4] = idnode6; + myNodes[5] = idnode7; + myNodes[6] = idnode8; + myNodes[7] = idnode5; + } else if (idmin == idnode3) { // 3 4 1 2 7 8 5 6 + myNodes[1] = idnode4; + myNodes[2] = idnode1; + myNodes[3] = idnode2; + myNodes[4] = idnode7; + myNodes[5] = idnode8; + myNodes[6] = idnode5; + myNodes[7] = idnode6; + } else if (idmin == idnode4) { // 4 1 2 3 8 5 6 7 + myNodes[1] = idnode1; + myNodes[2] = idnode2; + myNodes[3] = idnode3; + myNodes[4] = idnode8; + myNodes[5] = idnode5; + myNodes[6] = idnode6; + myNodes[7] = idnode7; + } else if (idmin == idnode5) { // 5 6 7 8 1 2 3 4 + myNodes[1] = idnode6; + myNodes[2] = idnode7; + myNodes[3] = idnode8; + myNodes[4] = idnode1; + myNodes[5] = idnode2; + myNodes[6] = idnode3; + myNodes[7] = idnode4; + } else if (idmin == idnode6){ // 6 7 8 5 2 3 4 1 + myNodes[1] = idnode7; + myNodes[2] = idnode8; + myNodes[3] = idnode5; + myNodes[4] = idnode2; + myNodes[5] = idnode3; + myNodes[6] = idnode4; + myNodes[7] = idnode1; + } else if (idmin == idnode7) { // 7 8 5 6 3 4 1 2 + myNodes[1] = idnode8; + myNodes[2] = idnode5; + myNodes[3] = idnode6; + myNodes[4] = idnode3; + myNodes[5] = idnode4; + myNodes[6] = idnode1; + myNodes[7] = idnode2; + } else { // 8 5 6 7 4 1 2 3 + myNodes[1] = idnode5; + myNodes[2] = idnode6; + myNodes[3] = idnode7; + myNodes[4] = idnode4; + myNodes[5] = idnode1; + myNodes[6] = idnode2; + myNodes[7] = idnode3; + } + +} + +//======================================================================= +//function : NodesOfFace +//purpose : returns the rank node in mynodes. Useful to extract faces from volume +//======================================================================= +Standard_Integer SMDS_MeshHexahedron::NodesOfFace(const Standard_Integer rankface, + const Standard_Integer ranknode) +{ + static Standard_Integer facenode[6][4] = { + {0,1,2,3}, + {4,7,6,5}, + {0,4,5,1}, + {1,5,6,2}, + {2,6,7,3}, + {0,3,7,4} + }; + + return facenode[rankface-1][ranknode-1]; +} + +//======================================================================= +//function : NodesOfEdge +//purpose : returns the rank node in mynodes. Useful to extract edges from volume +//======================================================================= +Standard_Integer SMDS_MeshHexahedron::NodesOfEdge(const Standard_Integer rankedge, + const Standard_Integer ranknode) const +{ + static Standard_Integer faceedge[12][2] = { + {0,1}, + {1,2}, + {2,3}, + {0,3}, + {4,7}, + {6,7}, + {5,6}, + {4,5}, + {0,4}, + {1,5}, + {2,6}, + {3,7} + + }; + + return faceedge[rankedge-1][ranknode-1]; +} + +//======================================================================= +//function : GetFaceDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshHexahedron::GetFaceDefinedByNodes(const Standard_Integer rank, + const Standard_Address idnode, + Standard_Integer& nb) const +{ + Standard_Integer *ptr; + nb = 4; + ptr = (Standard_Integer *)idnode; + ptr[0] = myNodes[NodesOfFace(rank,1)]; + ptr[1] = myNodes[NodesOfFace(rank,2)]; + ptr[2] = myNodes[NodesOfFace(rank,3)]; + ptr[3] = myNodes[NodesOfFace(rank,4)]; + +} + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshHexahedron::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[NodesOfEdge(rank,1)]; + idnode2 = myNodes[NodesOfEdge(rank,2)]; +} + diff --git a/src/SMDS/SMDS_MeshHexahedron.hxx b/src/SMDS/SMDS_MeshHexahedron.hxx new file mode 100644 index 000000000..9d52f78bc --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.hxx @@ -0,0 +1,114 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshHexahedron_HeaderFile +#define _SMDS_MeshHexahedron_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshHexahedron_HeaderFile +#include "Handle_SMDS_MeshHexahedron.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshVolume_HeaderFile +#include "SMDS_MeshVolume.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +class Standard_ConstructionError; + + +class SMDS_MeshHexahedron : public SMDS_MeshVolume { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshHexahedron(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8); +Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const; +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT inline Standard_Integer NbEdges() const; +Standard_EXPORT inline Standard_Integer NbFaces() const; +Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ; +Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const; +Standard_EXPORT ~SMDS_MeshHexahedron(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshHexahedron_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[8]; + + +}; + + +#include "SMDS_MeshHexahedron.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshHexahedron.ixx b/src/SMDS/SMDS_MeshHexahedron.ixx new file mode 100644 index 000000000..c01b2ef1c --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshHexahedron.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshHexahedron::~SMDS_MeshHexahedron() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshHexahedron_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshVolume); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshVolume); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshHexahedron", + sizeof(SMDS_MeshHexahedron), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshHexahedron) Handle(SMDS_MeshHexahedron)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshHexahedron) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshHexahedron))) { + _anOtherObject = Handle(SMDS_MeshHexahedron)((Handle(SMDS_MeshHexahedron)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshHexahedron::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshHexahedron) ; +} +Standard_Boolean SMDS_MeshHexahedron::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshHexahedron) == AType || SMDS_MeshVolume::IsKind(AType)); +} +Handle_SMDS_MeshHexahedron::~Handle_SMDS_MeshHexahedron() {} + diff --git a/src/SMDS/SMDS_MeshHexahedron.jxx b/src/SMDS/SMDS_MeshHexahedron.jxx new file mode 100644 index 000000000..4781dc0b3 --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.jxx @@ -0,0 +1,6 @@ +#ifndef _Standard_ConstructionError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshHexahedron_HeaderFile +#include "SMDS_MeshHexahedron.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshHexahedron.lxx b/src/SMDS/SMDS_MeshHexahedron.lxx new file mode 100644 index 000000000..317534352 --- /dev/null +++ b/src/SMDS/SMDS_MeshHexahedron.lxx @@ -0,0 +1,63 @@ +// File: SMDS_MeshHexahedron.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshHexahedron::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshHexahedron::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : ComputKey +//purpose : compute theKey of the volume based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshHexahedron::ComputeKey() +{ + // myKey = (myNodes[0]<<8) + (myNodes[1]<<7) + (myNodes[2]<<6) + (myNodes[3]<<5) + // +(myNodes[4]<<4) + (myNodes[5]<<3) + (myNodes[6]<<2) + myNodes[7]; + myKey = myNodes[0] + myNodes[1] + myNodes[2] + myNodes[3] + + myNodes[4] + myNodes[5] + myNodes[6] + myNodes[7]; +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshHexahedron::NbEdges() const +{ + return 12; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshHexahedron::NbFaces() const +{ + return 6; +} + diff --git a/src/SMDS/SMDS_MeshIDFactory.cdl b/src/SMDS/SMDS_MeshIDFactory.cdl new file mode 100644 index 000000000..477a016a0 --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.cdl @@ -0,0 +1,32 @@ +-- File: SMDS_MeshIDFactory.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +private deferred class MeshIDFactory from SMDS inherits MeshObject + + ---Purpose: + +uses + StackOfInteger from TColStd + +is + + Initialize returns mutable MeshIDFactory from SMDS; + + GetFreeID(me:mutable) returns Integer is deferred; + ---Purpose: returns a free identifier for mesh from + -- the pool of ID + + + ReleaseID(me: mutable;ID :Integer) is deferred; + ---Purpose: free the ID and give it back to the pool of ID + + +fields + myMaxID : Integer is protected; + myPoolOfID : StackOfInteger from TColStd is protected; + +end MeshIDFactory; diff --git a/src/SMDS/SMDS_MeshIDFactory.cxx b/src/SMDS/SMDS_MeshIDFactory.cxx new file mode 100644 index 000000000..9cd72d412 --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.cxx @@ -0,0 +1,19 @@ +using namespace std; +// File: SMDS_MeshIDFactory.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshIDFactory.ixx" + + +//======================================================================= +//function : SMDS_MeshIDFactory +//purpose : +//======================================================================= + +SMDS_MeshIDFactory::SMDS_MeshIDFactory() : myMaxID(0) +{ +} + diff --git a/src/SMDS/SMDS_MeshIDFactory.hxx b/src/SMDS/SMDS_MeshIDFactory.hxx new file mode 100644 index 000000000..88a266aed --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.hxx @@ -0,0 +1,105 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshIDFactory_HeaderFile +#define _SMDS_MeshIDFactory_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshIDFactory_HeaderFile +#include "Handle_SMDS_MeshIDFactory.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TColStd_StackOfInteger_HeaderFile +#include +#endif +#ifndef _SMDS_MeshObject_HeaderFile +#include "SMDS_MeshObject.hxx" +#endif + + +class SMDS_MeshIDFactory : public SMDS_MeshObject { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual Standard_Integer GetFreeID() = 0; +Standard_EXPORT virtual void ReleaseID(const Standard_Integer ID) = 0; +Standard_EXPORT ~SMDS_MeshIDFactory(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshIDFactory_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDS_MeshIDFactory(); + + + // Fields PROTECTED + // +Standard_Integer myMaxID; +TColStd_StackOfInteger myPoolOfID; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshIDFactory.ixx b/src/SMDS/SMDS_MeshIDFactory.ixx new file mode 100644 index 000000000..ba32bcc39 --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshIDFactory.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshIDFactory::~SMDS_MeshIDFactory() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshIDFactory_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshIDFactory", + sizeof(SMDS_MeshIDFactory), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshIDFactory) Handle(SMDS_MeshIDFactory)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshIDFactory) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshIDFactory))) { + _anOtherObject = Handle(SMDS_MeshIDFactory)((Handle(SMDS_MeshIDFactory)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshIDFactory::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshIDFactory) ; +} +Standard_Boolean SMDS_MeshIDFactory::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshIDFactory) == AType || SMDS_MeshObject::IsKind(AType)); +} +Handle_SMDS_MeshIDFactory::~Handle_SMDS_MeshIDFactory() {} + diff --git a/src/SMDS/SMDS_MeshIDFactory.jxx b/src/SMDS/SMDS_MeshIDFactory.jxx new file mode 100644 index 000000000..ccb401f0a --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshIDFactory_HeaderFile +#include "SMDS_MeshIDFactory.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshIDFactory.lxx b/src/SMDS/SMDS_MeshIDFactory.lxx new file mode 100644 index 000000000..3731249be --- /dev/null +++ b/src/SMDS/SMDS_MeshIDFactory.lxx @@ -0,0 +1,34 @@ +// File: SMDS_MeshIDFactory.lxx +// Created: Thu Jan 24 12:10:57 2002 +// Author: Jean-Michel BOULCOURT +// + + +//======================================================================= +//function : GetFreeID +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshIDFactory::GetFreeID() +{ + if (myPoolOfID.IsEmpty()) + return ++myMaxID; + else { + Standard_Integer ID = myPoolOfID.Top(); + myPoolOfID.Pop(); + return ID; + } + +} + +//======================================================================= +//function : ReleaseID +//purpose : +//======================================================================= +inline void SMDS_MeshIDFactory::ReleaseID(const Standard_Integer ID) +{ + if (ID < myMaxID) + myPoolOfID.Push(ID); + +} + + diff --git a/src/SMDS/SMDS_MeshNode.cdl b/src/SMDS/SMDS_MeshNode.cdl new file mode 100755 index 000000000..319308cc6 --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.cdl @@ -0,0 +1,64 @@ +-- File: SMDS_MeshNode.cdl +-- Created: Wed Jan 23 16:15:04 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshNode from SMDS inherits MeshElement from SMDS + + ---Purpose: +uses + Pnt from gp, + MeshEdge from SMDS, + MeshFace from SMDS, + MeshVolume from SMDS, + ListOfMeshElement from SMDS, + Position from SMDS + +is + + Create (ID: Integer; x, y, z : Real) returns mutable MeshNode; + + Print(me; OS: in out OStream) is redefined static; + + GetKey(me) returns Integer is redefined static; + ---C++: inline + + X(me) returns Real; + ---C++: inline + + Y(me) returns Real; + ---C++: inline + + Z(me) returns Real; + ---C++: inline + + Pnt(me) returns Pnt from gp; + ---C++: inline + + SetPnt(me: mutable;P: Pnt from gp); + ---C++: inline + + AddInverseElement(me:mutable; ME: MeshElement from SMDS) is redefined static; + ---C++: inline + + RemoveInverseElement(me:mutable; parent: MeshElement from SMDS); + + InverseElements(me) returns ListOfMeshElement is redefined static; + ---C++: return const & + ---C++: inline + + ClearInverseElements(me: mutable) is redefined static; + ---C++: inline + + SetPosition(me: mutable; aPos: Position from SMDS); + + GetPosition(me) returns Position from SMDS; + +fields + myPnt : Pnt from gp; + myInverseElements : ListOfMeshElement from SMDS; + myPosition : Position from SMDS; + +end MeshNode; diff --git a/src/SMDS/SMDS_MeshNode.cxx b/src/SMDS/SMDS_MeshNode.cxx new file mode 100644 index 000000000..78a9b70da --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.cxx @@ -0,0 +1,83 @@ +using namespace std; +// File: SMDS_MeshNode.cxx +// Created: Wed Jan 23 17:02:11 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshNode.ixx" +#include "SMDS_ListIteratorOfListOfMeshElement.hxx" +#include "SMDS_SpacePosition.hxx" + +static Handle(SMDS_Position)& StaticInstancePosition() +{ + static Handle(SMDS_SpacePosition) staticpos; + if (staticpos.IsNull()) + staticpos = new SMDS_SpacePosition(); + + return staticpos; +} + +//======================================================================= +//function : SMDS_MeshNode +//purpose : +//======================================================================= + +SMDS_MeshNode::SMDS_MeshNode(const Standard_Integer ID, + const Standard_Real x, const Standard_Real y, const Standard_Real z) : + SMDS_MeshElement(ID,1,SMDSAbs_Node),myPnt(x,y,z),myPosition(StaticInstancePosition()) +{ +} + + +//======================================================================= +//function : RemoveInverseElement +//purpose : +//======================================================================= + +void SMDS_MeshNode::RemoveInverseElement(const Handle(SMDS_MeshElement)& parent) +{ + + SMDS_ListIteratorOfListOfMeshElement itLstInvCnx(myInverseElements); + + for (;itLstInvCnx.More();itLstInvCnx.Next()) { + Handle(SMDS_MeshElement)& ME = itLstInvCnx.Value(); + if (ME->IsSame(parent)) + myInverseElements.Remove(itLstInvCnx); + if (!itLstInvCnx.More()) + break; + } +} + + +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_MeshNode::Print(Standard_OStream& OS) const +{ + OS << "Node <" << myID << "> : X = " << myPnt.X() << " Y = " << myPnt.Y() << " Z = " << myPnt.Z() << endl; +} + + +//======================================================================= +//function : SetPosition +//purpose : +//======================================================================= + +void SMDS_MeshNode::SetPosition(const Handle(SMDS_Position)& aPos) +{ + myPosition = aPos; +} + +//======================================================================= +//function : GetPosition +//purpose : +//======================================================================= + +Handle(SMDS_Position) SMDS_MeshNode::GetPosition() const +{ + return myPosition; +} + diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx new file mode 100644 index 000000000..4d9c35d2e --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -0,0 +1,137 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshNode_HeaderFile +#define _SMDS_MeshNode_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshNode_HeaderFile +#include "Handle_SMDS_MeshNode.hxx" +#endif + +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _Standard_OStream_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +class SMDS_Position; +class gp_Pnt; +class SMDS_MeshElement; +class SMDS_ListOfMeshElement; + + +class SMDS_MeshNode : public SMDS_MeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshNode(const Standard_Integer ID,const Standard_Real x,const Standard_Real y,const Standard_Real z); +Standard_EXPORT void Print(Standard_OStream& OS) const; +Standard_EXPORT inline Standard_Integer GetKey() const; +Standard_EXPORT inline Standard_Real X() const; +Standard_EXPORT inline Standard_Real Y() const; +Standard_EXPORT inline Standard_Real Z() const; +Standard_EXPORT inline gp_Pnt Pnt() const; +Standard_EXPORT inline void SetPnt(const gp_Pnt& P) ; +Standard_EXPORT inline void AddInverseElement(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT void RemoveInverseElement(const Handle(SMDS_MeshElement)& parent) ; +Standard_EXPORT inline const SMDS_ListOfMeshElement& InverseElements() const; +Standard_EXPORT inline void ClearInverseElements() ; +Standard_EXPORT void SetPosition(const Handle(SMDS_Position)& aPos) ; +Standard_EXPORT Handle_SMDS_Position GetPosition() const; +Standard_EXPORT ~SMDS_MeshNode(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshNode_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +gp_Pnt myPnt; +SMDS_ListOfMeshElement myInverseElements; +Handle_SMDS_Position myPosition; + + +}; + + +#include "SMDS_MeshNode.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshNode.ixx b/src/SMDS/SMDS_MeshNode.ixx new file mode 100644 index 000000000..1ed6b3a05 --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshNode.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshNode::~SMDS_MeshNode() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshNode_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshNode", + sizeof(SMDS_MeshNode), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshNode) Handle(SMDS_MeshNode)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshNode) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshNode))) { + _anOtherObject = Handle(SMDS_MeshNode)((Handle(SMDS_MeshNode)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshNode::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshNode) ; +} +Standard_Boolean SMDS_MeshNode::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshNode) == AType || SMDS_MeshElement::IsKind(AType)); +} +Handle_SMDS_MeshNode::~Handle_SMDS_MeshNode() {} + diff --git a/src/SMDS/SMDS_MeshNode.jxx b/src/SMDS/SMDS_MeshNode.jxx new file mode 100644 index 000000000..ed0b2b5f1 --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.jxx @@ -0,0 +1,12 @@ +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_ListOfMeshElement_HeaderFile +#include "SMDS_ListOfMeshElement.hxx" +#endif +#ifndef _SMDS_MeshNode_HeaderFile +#include "SMDS_MeshNode.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshNode.lxx b/src/SMDS/SMDS_MeshNode.lxx new file mode 100644 index 000000000..f42881218 --- /dev/null +++ b/src/SMDS/SMDS_MeshNode.lxx @@ -0,0 +1,103 @@ +// File: SMDS_MeshNode.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + +//======================================================================= +//function : GetKey +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshNode::GetKey() const +{ + return myID; +} + +//======================================================================= +//function : X +//purpose : +// +//======================================================================= + +inline Standard_Real SMDS_MeshNode::X() const +{ + return myPnt.X(); +} + +//======================================================================= +//function : Y +//purpose : +// +//======================================================================= + +inline Standard_Real SMDS_MeshNode::Y() const +{ + return myPnt.Y(); +} + +//======================================================================= +//function : Z +//purpose : +// +//======================================================================= + +inline Standard_Real SMDS_MeshNode::Z() const +{ + return myPnt.Z(); +} + +//======================================================================= +//function : Pnt +//purpose : +// +//======================================================================= + +inline gp_Pnt SMDS_MeshNode::Pnt() const +{ + return myPnt; +} + +//======================================================================= +//function : Pnt +//purpose : +// +//======================================================================= + +inline void SMDS_MeshNode::SetPnt(const gp_Pnt& P) +{ + myPnt = P; +} + +//======================================================================= +//function : AddInverseElement +//purpose : +//======================================================================= + +inline void SMDS_MeshNode::AddInverseElement(const Handle(SMDS_MeshElement)& ME) +{ + myInverseElements.Append(ME); +} + +//======================================================================= +//function : InverseElements +//purpose : +//======================================================================= + +inline const SMDS_ListOfMeshElement& SMDS_MeshNode::InverseElements() const +{ + return myInverseElements; +} + +//======================================================================= +//function : ClearInverseElements +//purpose : +//======================================================================= + +inline void SMDS_MeshNode::ClearInverseElements() +{ + myInverseElements.Clear(); +} + diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.cdl b/src/SMDS/SMDS_MeshNodeIDFactory.cdl new file mode 100644 index 000000000..8034b9e26 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.cdl @@ -0,0 +1,26 @@ +-- File: SMDS_MeshNodeIDFactory.cdl +-- Created: Tue May 7 16:18:08 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +private class MeshNodeIDFactory from SMDS inherits MeshIDFactory + + ---Purpose: + +is + + Create returns mutable MeshNodeIDFactory from SMDS; + + GetFreeID(me:mutable) returns Integer is redefined static; + ---Purpose: returns a free identifier for mesh from + -- the pool of ID + ---C++: inline + + ReleaseID(me: mutable;ID :Integer) is redefined static; + ---Purpose: free the ID and give it back to the pool of ID + ---C++: inline + + +end MeshNodeIDFactory; diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.cxx b/src/SMDS/SMDS_MeshNodeIDFactory.cxx new file mode 100644 index 000000000..27af9b907 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.cxx @@ -0,0 +1,18 @@ +using namespace std; +// File: SMDS_MeshNodeIDFactory.cxx +// Created: Tue May 7 16:58:57 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshNodeIDFactory.ixx" + +//======================================================================= +//function : SMDS_MeshNodeIDFactory +//purpose : +//======================================================================= + +SMDS_MeshNodeIDFactory::SMDS_MeshNodeIDFactory() : SMDS_MeshIDFactory() +{ +} + diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.hxx b/src/SMDS/SMDS_MeshNodeIDFactory.hxx new file mode 100644 index 000000000..44af92bc3 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.hxx @@ -0,0 +1,101 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshNodeIDFactory_HeaderFile +#define _SMDS_MeshNodeIDFactory_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshNodeIDFactory_HeaderFile +#include "Handle_SMDS_MeshNodeIDFactory.hxx" +#endif + +#ifndef _SMDS_MeshIDFactory_HeaderFile +#include "SMDS_MeshIDFactory.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif + + +class SMDS_MeshNodeIDFactory : public SMDS_MeshIDFactory { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshNodeIDFactory(); +Standard_EXPORT inline Standard_Integer GetFreeID() ; +Standard_EXPORT inline void ReleaseID(const Standard_Integer ID) ; +Standard_EXPORT ~SMDS_MeshNodeIDFactory(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshNodeIDFactory_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshNodeIDFactory.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.ixx b/src/SMDS/SMDS_MeshNodeIDFactory.ixx new file mode 100644 index 000000000..6dfed0eac --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshNodeIDFactory.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshNodeIDFactory::~SMDS_MeshNodeIDFactory() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshNodeIDFactory_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshIDFactory); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshIDFactory); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshNodeIDFactory", + sizeof(SMDS_MeshNodeIDFactory), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshNodeIDFactory) Handle(SMDS_MeshNodeIDFactory)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshNodeIDFactory) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshNodeIDFactory))) { + _anOtherObject = Handle(SMDS_MeshNodeIDFactory)((Handle(SMDS_MeshNodeIDFactory)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshNodeIDFactory::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshNodeIDFactory) ; +} +Standard_Boolean SMDS_MeshNodeIDFactory::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshNodeIDFactory) == AType || SMDS_MeshIDFactory::IsKind(AType)); +} +Handle_SMDS_MeshNodeIDFactory::~Handle_SMDS_MeshNodeIDFactory() {} + diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.jxx b/src/SMDS/SMDS_MeshNodeIDFactory.jxx new file mode 100644 index 000000000..d4a69a63f --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshNodeIDFactory_HeaderFile +#include "SMDS_MeshNodeIDFactory.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshNodeIDFactory.lxx b/src/SMDS/SMDS_MeshNodeIDFactory.lxx new file mode 100644 index 000000000..612feb3ac --- /dev/null +++ b/src/SMDS/SMDS_MeshNodeIDFactory.lxx @@ -0,0 +1,34 @@ +// File: SMDS_MeshNodeIDFactory.lxx +// Created: Thu Jan 24 12:10:57 2002 +// Author: Jean-Michel BOULCOURT +// + + +//======================================================================= +//function : GetFreeID +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshNodeIDFactory::GetFreeID() +{ + if (myPoolOfID.IsEmpty()) + return ++myMaxID; + else { + Standard_Integer ID = myPoolOfID.Top(); + myPoolOfID.Pop(); + return ID; + } + +} + +//======================================================================= +//function : ReleaseID +//purpose : +//======================================================================= +inline void SMDS_MeshNodeIDFactory::ReleaseID(const Standard_Integer ID) +{ + if (ID < myMaxID) + myPoolOfID.Push(ID); + +} + + diff --git a/src/SMDS/SMDS_MeshNodesIterator.cdl b/src/SMDS/SMDS_MeshNodesIterator.cdl new file mode 100644 index 000000000..0073a7ea1 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodesIterator.cdl @@ -0,0 +1,34 @@ +-- File: SMDS_MeshNodesIterator.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshNodesIterator from SMDS inherits MeshElementsIterator + + ---Purpose: The Iterator objet to iterate on all faces of a mesh + -- + +uses + Mesh from SMDS, + MeshElement from SMDS + +raises + NoMoreObject, + NoSuchObject + +is + + Create returns MeshNodesIterator from SMDS; + ---Purpose: Creates an empty Iterator. + + Create(M : Mesh from SMDS) returns MeshNodesIterator from SMDS; + ---Purpose: Creates an Iterator on faces of mesh . + + Initialize(me : in out; M : Mesh from SMDS) + ---Purpose: Reset the Iterator on the faces of mesh . + is redefined static; + + +end MeshNodesIterator; diff --git a/src/SMDS/SMDS_MeshNodesIterator.cxx b/src/SMDS/SMDS_MeshNodesIterator.cxx new file mode 100644 index 000000000..4ad9748a2 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodesIterator.cxx @@ -0,0 +1,42 @@ +using namespace std; +// File: SMDS_MeshNodesIterator.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshNodesIterator.ixx" + +//======================================================================= +//function : SMDS_MeshNodesIterator +//purpose : +//======================================================================= + +SMDS_MeshNodesIterator::SMDS_MeshNodesIterator() +{ +} + +//======================================================================= +//function : SMDS_MeshNodesIterator +//purpose : +//======================================================================= + +SMDS_MeshNodesIterator::SMDS_MeshNodesIterator(const Handle(SMDS_Mesh)& M) +{ + Initialize(M); +} + +//======================================================================= +//function : Initialize +//purpose : +//======================================================================= + +void SMDS_MeshNodesIterator::Initialize(const Handle(SMDS_Mesh)& M) +{ + + myMapIterator.Initialize(M->myNodes); + if (More()) { + myCurrentMeshElement = myMapIterator.Key(); + } +} + diff --git a/src/SMDS/SMDS_MeshNodesIterator.hxx b/src/SMDS/SMDS_MeshNodesIterator.hxx new file mode 100644 index 000000000..531145b10 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodesIterator.hxx @@ -0,0 +1,96 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshNodesIterator_HeaderFile +#define _SMDS_MeshNodesIterator_HeaderFile + +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#include "SMDS_MeshElementsIterator.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_Mesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshNodesIterator : public SMDS_MeshElementsIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshNodesIterator(); +Standard_EXPORT SMDS_MeshNodesIterator(const Handle(SMDS_Mesh)& M); +Standard_EXPORT void Initialize(const Handle(SMDS_Mesh)& M) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshNodesIterator.ixx b/src/SMDS/SMDS_MeshNodesIterator.ixx new file mode 100644 index 000000000..ed29b9020 --- /dev/null +++ b/src/SMDS/SMDS_MeshNodesIterator.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshNodesIterator.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshNodesIterator.jxx b/src/SMDS/SMDS_MeshNodesIterator.jxx new file mode 100644 index 000000000..046b05f7b --- /dev/null +++ b/src/SMDS/SMDS_MeshNodesIterator.jxx @@ -0,0 +1,12 @@ +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshNodesIterator_HeaderFile +#include "SMDS_MeshNodesIterator.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshObject.cdl b/src/SMDS/SMDS_MeshObject.cdl new file mode 100644 index 000000000..3bc214260 --- /dev/null +++ b/src/SMDS/SMDS_MeshObject.cdl @@ -0,0 +1,15 @@ +-- File: SMDS_MeshObject.cdl +-- Created: Wed Jan 23 12:01:38 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshObject from SMDS inherits TShared from MMgt + + ---Purpose: + +is + + +end MeshObject; diff --git a/src/SMDS/SMDS_MeshObject.cxx b/src/SMDS/SMDS_MeshObject.cxx new file mode 100644 index 000000000..3a4956159 --- /dev/null +++ b/src/SMDS/SMDS_MeshObject.cxx @@ -0,0 +1,8 @@ +using namespace std; +// File: SMDS_MeshObject.cxx +// Created: Wed Jan 23 16:48:49 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshObject.ixx" diff --git a/src/SMDS/SMDS_MeshObject.hxx b/src/SMDS/SMDS_MeshObject.hxx new file mode 100644 index 000000000..799ce1514 --- /dev/null +++ b/src/SMDS/SMDS_MeshObject.hxx @@ -0,0 +1,94 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshObject_HeaderFile +#define _SMDS_MeshObject_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshObject_HeaderFile +#include "Handle_SMDS_MeshObject.hxx" +#endif + +#ifndef _MMgt_TShared_HeaderFile +#include +#endif + + +class SMDS_MeshObject : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT ~SMDS_MeshObject(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshObject_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshObject.ixx b/src/SMDS/SMDS_MeshObject.ixx new file mode 100644 index 000000000..db154fa4d --- /dev/null +++ b/src/SMDS/SMDS_MeshObject.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshObject.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshObject::~SMDS_MeshObject() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshObject_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshObject", + sizeof(SMDS_MeshObject), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshObject) Handle(SMDS_MeshObject)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshObject) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshObject))) { + _anOtherObject = Handle(SMDS_MeshObject)((Handle(SMDS_MeshObject)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshObject::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshObject) ; +} +Standard_Boolean SMDS_MeshObject::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshObject) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMDS_MeshObject::~Handle_SMDS_MeshObject() {} + diff --git a/src/SMDS/SMDS_MeshObject.jxx b/src/SMDS/SMDS_MeshObject.jxx new file mode 100644 index 000000000..8b5d16d76 --- /dev/null +++ b/src/SMDS/SMDS_MeshObject.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshObject_HeaderFile +#include "SMDS_MeshObject.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.cdl b/src/SMDS/SMDS_MeshOrientedElementMapHasher.cdl new file mode 100644 index 000000000..195e379ad --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.cdl @@ -0,0 +1,31 @@ +-- File: SMDS_MeshOrientedElementMapHasher.cdl +-- Created: Wed Jan 23 14:04:07 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshOrientedElementMapHasher from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + + +is + HashCode(myclass; ME: MeshElement from SMDS; Upper : Integer) returns Integer; + ---Purpose: Returns a HasCode value for the Key in the + -- range 0..Upper. + -- + ---C++: inline + + IsEqual(myclass; ME1, ME2 : MeshElement from SMDS) returns Boolean; + ---Purpose: Returns True when the two keys are the same. Two + -- same keys must have the same hashcode, the + -- contrary is not necessary. + -- + ---C++: inline + + +end MeshOrientedElementMapHasher; diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.cxx b/src/SMDS/SMDS_MeshOrientedElementMapHasher.cxx new file mode 100644 index 000000000..691daf033 --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.cxx @@ -0,0 +1,8 @@ +using namespace std; +// File: SMDS_MeshOrientedElementMapHasher.cxx +// Created: Wed Jan 23 14:09:30 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshOrientedElementMapHasher.ixx" diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.hxx b/src/SMDS/SMDS_MeshOrientedElementMapHasher.hxx new file mode 100644 index 000000000..034efcb8b --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.hxx @@ -0,0 +1,97 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshOrientedElementMapHasher_HeaderFile +#define _SMDS_MeshOrientedElementMapHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class SMDS_MeshElement; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshOrientedElementMapHasher { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline static Standard_Integer HashCode(const Handle(SMDS_MeshElement)& ME,const Standard_Integer Upper) ; +Standard_EXPORT inline static Standard_Boolean IsEqual(const Handle(SMDS_MeshElement)& ME1,const Handle(SMDS_MeshElement)& ME2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshOrientedElementMapHasher.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.ixx b/src/SMDS/SMDS_MeshOrientedElementMapHasher.ixx new file mode 100644 index 000000000..7ccc92b3e --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshOrientedElementMapHasher.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.jxx b/src/SMDS/SMDS_MeshOrientedElementMapHasher.jxx new file mode 100644 index 000000000..16b28c35b --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.jxx @@ -0,0 +1,6 @@ +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshOrientedElementMapHasher_HeaderFile +#include "SMDS_MeshOrientedElementMapHasher.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshOrientedElementMapHasher.lxx b/src/SMDS/SMDS_MeshOrientedElementMapHasher.lxx new file mode 100644 index 000000000..5ca24a19b --- /dev/null +++ b/src/SMDS/SMDS_MeshOrientedElementMapHasher.lxx @@ -0,0 +1,27 @@ +// File: SMDS_MeshOrientedElementMapHasher.lxx +// Created: Wed Jan 23 14:07:00 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshElement.hxx" + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= +inline Standard_Integer SMDS_MeshOrientedElementMapHasher::HashCode + (const Handle(SMDS_MeshElement)& ME, const Standard_Integer Upper) +{ + return ME->HashCode(Upper); +} + +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= +inline Standard_Boolean SMDS_MeshOrientedElementMapHasher::IsEqual + (const Handle(SMDS_MeshElement)& ME1, const Handle(SMDS_MeshElement)& ME2) +{ + return ME1->IsEqual(ME2); +} diff --git a/src/SMDS/SMDS_MeshPrism.cdl b/src/SMDS/SMDS_MeshPrism.cdl new file mode 100644 index 000000000..b0f6ff347 --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.cdl @@ -0,0 +1,67 @@ +-- File: SMDS_MeshPrism.cdl +-- Created: Wed Jan 23 16:17:22 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshPrism from SMDS inherits MeshVolume from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + + +raises + ConstructionError from Standard + +is + + Create (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6: Integer) + returns mutable MeshPrism; + ---Purpose: constructor for a prism + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1 : out Integer; idnode2: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + GetFaceDefinedByNodes(me; rank: Integer; idnode : Address; nb: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith face (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + ComputeKey(me: mutable); + ---Purpose: compute the ID of the volume based on the id's of its + -- bounding nodes + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2,idnode3,idnode4,idnode5,idnode6: Integer) is private; + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + NbEdges(me) returns Integer + is redefined static; + ---C++: inline + + NbFaces(me) returns Integer + is redefined static; + ---C++: inline + + NodesOfFace(myclass; rankface,ranknode: Integer) + returns Integer; + ---Purpose: returns the rank node in mynodes. Useful to extract faces from volume + -- + NodesOfEdge(me; rankedge: Integer; ranknode: Integer) returns Integer; + + +fields + + myNodes : Integer [6]; + +end MeshPrism; diff --git a/src/SMDS/SMDS_MeshPrism.cxx b/src/SMDS/SMDS_MeshPrism.cxx new file mode 100644 index 000000000..94568ca01 --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.cxx @@ -0,0 +1,161 @@ +using namespace std; +// File: SMDS_MeshPrism.cxx +// Created: Wed Jan 23 17:02:34 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshPrism.ixx" +#include "Standard_ConstructionError.hxx" + + +//======================================================================= +//function : SMDS_MeshPrism +//purpose : Prism +//======================================================================= + +SMDS_MeshPrism::SMDS_MeshPrism(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6):SMDS_MeshVolume(ID,6) +{ + SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); + ComputeKey(); +} + + +//======================================================================= +//function : SetConnections +//purpose : Prism +//======================================================================= +void SMDS_MeshPrism::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) +{ + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + idmin = (idmin < idnode4 ? idmin : idnode4); + idmin = (idmin < idnode5 ? idmin : idnode5); + idmin = (idmin < idnode6 ? idmin : idnode6); + + myNodes[0] = idmin; + if (idmin == idnode1) { // 1 2 3 4 5 6 + myNodes[1] = idnode2; + myNodes[2] = idnode3; + myNodes[3] = idnode4; + myNodes[4] = idnode5; + myNodes[5] = idnode6; + } else if (idmin == idnode2) { // 2 3 1 5 6 4 + myNodes[1] = idnode3; + myNodes[2] = idnode1; + myNodes[3] = idnode5; + myNodes[4] = idnode6; + myNodes[5] = idnode4; + } else if (idmin == idnode3) { // 3 1 2 6 4 5 + myNodes[1] = idnode1; + myNodes[2] = idnode2; + myNodes[3] = idnode6; + myNodes[4] = idnode4; + myNodes[5] = idnode5; + } else if (idmin == idnode4) { // 4 5 6 1 2 3 + myNodes[1] = idnode5; + myNodes[2] = idnode6; + myNodes[3] = idnode1; + myNodes[4] = idnode2; + myNodes[5] = idnode3; + } else if (idmin == idnode5) { // 5 6 4 2 3 1 + myNodes[1] = idnode6; + myNodes[2] = idnode4; + myNodes[3] = idnode2; + myNodes[4] = idnode3; + myNodes[5] = idnode1; + } else { // 6 4 5 3 1 2 + myNodes[1] = idnode4; + myNodes[2] = idnode5; + myNodes[3] = idnode3; + myNodes[4] = idnode1; + myNodes[5] = idnode2; + } + +} + + +//======================================================================= +//function : NodesOfFace +//purpose : returns the rank node in mynodes. Useful to extract faces from volume +//======================================================================= +Standard_Integer SMDS_MeshPrism::NodesOfFace(const Standard_Integer rankface, + const Standard_Integer ranknode) +{ + static Standard_Integer facenode[5][4] = { + {0,1,2,-1}, + {3,5,4,-1}, + {0,3,4,1}, + {1,4,5,2}, + {2,5,3,0} + }; + + return facenode[rankface-1][ranknode-1]; +} + +//======================================================================= +//function : NodesOfEdge +//purpose : returns the rank node in mynodes. Useful to extract edges from volume +//======================================================================= +Standard_Integer SMDS_MeshPrism::NodesOfEdge(const Standard_Integer rankedge, + const Standard_Integer ranknode) const +{ + static Standard_Integer faceedge[9][2] = { + {0,1}, + {1,2}, + {0,2}, + {3,5}, + {4,5}, + {3,4}, + {0,3}, + {1,4}, + {2,5} + + }; + + return faceedge[rankedge-1][ranknode-1]; +} + +//======================================================================= +//function : GetFaceDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshPrism::GetFaceDefinedByNodes(const Standard_Integer rank, + const Standard_Address idnode, + Standard_Integer& nb) const +{ + Standard_Integer *ptr; + ptr = (Standard_Integer *)idnode; + ptr[0] = myNodes[NodesOfFace(rank,1)]; + ptr[1] = myNodes[NodesOfFace(rank,2)]; + ptr[2] = myNodes[NodesOfFace(rank,3)]; + ptr[3] = myNodes[NodesOfFace(rank,4)]; + nb = (NodesOfFace(rank,4) == -1 ? 3 : 4); + if (nb == 4) + ptr[3] = myNodes[NodesOfFace(rank,4)]; + +} + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshPrism::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[NodesOfEdge(rank,1)]; + idnode2 = myNodes[NodesOfEdge(rank,2)]; +} + diff --git a/src/SMDS/SMDS_MeshPrism.hxx b/src/SMDS/SMDS_MeshPrism.hxx new file mode 100644 index 000000000..41d0e6caf --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.hxx @@ -0,0 +1,114 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshPrism_HeaderFile +#define _SMDS_MeshPrism_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshPrism_HeaderFile +#include "Handle_SMDS_MeshPrism.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include "Standard_Integer.hxx" +#endif +#ifndef _SMDS_MeshVolume_HeaderFile +#include "SMDS_MeshVolume.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +class Standard_ConstructionError; + + +class SMDS_MeshPrism : public SMDS_MeshVolume { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshPrism(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6); +Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const; +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT inline Standard_Integer NbEdges() const; +Standard_EXPORT inline Standard_Integer NbFaces() const; +Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ; +Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const; +Standard_EXPORT ~SMDS_MeshPrism(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshPrism_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[6]; + + +}; + + +#include "SMDS_MeshPrism.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshPrism.ixx b/src/SMDS/SMDS_MeshPrism.ixx new file mode 100644 index 000000000..9c18b92a4 --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshPrism.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshPrism::~SMDS_MeshPrism() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshPrism_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshVolume); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshVolume); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshPrism", + sizeof(SMDS_MeshPrism), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshPrism) Handle(SMDS_MeshPrism)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshPrism) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshPrism))) { + _anOtherObject = Handle(SMDS_MeshPrism)((Handle(SMDS_MeshPrism)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshPrism::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshPrism) ; +} +Standard_Boolean SMDS_MeshPrism::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshPrism) == AType || SMDS_MeshVolume::IsKind(AType)); +} +Handle_SMDS_MeshPrism::~Handle_SMDS_MeshPrism() {} + diff --git a/src/SMDS/SMDS_MeshPrism.jxx b/src/SMDS/SMDS_MeshPrism.jxx new file mode 100644 index 000000000..f6f50b50f --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.jxx @@ -0,0 +1,6 @@ +#ifndef _Standard_ConstructionError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshPrism_HeaderFile +#include "SMDS_MeshPrism.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshPrism.lxx b/src/SMDS/SMDS_MeshPrism.lxx new file mode 100644 index 000000000..56a987f54 --- /dev/null +++ b/src/SMDS/SMDS_MeshPrism.lxx @@ -0,0 +1,62 @@ +// File: SMDS_MeshPrism.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshPrism::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshPrism::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the volume based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshPrism::ComputeKey() +{ + // myKey = (myNodes[0]<<5) + (myNodes[1]<<4) + (myNodes[2]<<3) + (myNodes[3]<<2) + // +(myNodes[4]<<1) + myNodes[5]; + myKey = myNodes[0] + myNodes[1] + myNodes[2] + myNodes[3] + myNodes[4] + myNodes[5]; +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshPrism::NbEdges() const +{ + return 9; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshPrism::NbFaces() const +{ + return 5; +} + diff --git a/src/SMDS/SMDS_MeshPyramid.cdl b/src/SMDS/SMDS_MeshPyramid.cdl new file mode 100644 index 000000000..5f9839806 --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.cdl @@ -0,0 +1,68 @@ +-- File: SMDS_MeshPyramid.cdl +-- Created: Wed Jan 23 16:17:22 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshPyramid from SMDS inherits MeshVolume from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +raises + ConstructionError from Standard + +is + + Create (ID,idnode1,idnode2,idnode3,idnode4,idnode5: Integer) returns mutable MeshPyramid; + ---Purpose: constructor for a pyramid + + + GetFaceDefinedByNodes(me; rank: Integer; idnode : Address; nb: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith face (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1 : out Integer; idnode2: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + ComputeKey(me: mutable); + ---Purpose: compute the ID of the volume based on the id's of its + -- bounding nodes + ---C++: inline + + + SetConnections(me: mutable; idnode1,idnode2,idnode3,idnode4,idnode5: Integer) is private; + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + NbEdges(me) returns Integer + is redefined static; + ---C++: inline + + NbFaces(me) returns Integer + is redefined static; + ---C++: inline + + NodesOfFace(myclass; rankface,ranknode: Integer) + returns Integer; + ---Purpose: returns the rank node in mynodes. Useful to extract faces from volume + -- + + NodesOfEdge(me; rankedge: Integer; ranknode: Integer) returns Integer; + + +fields + + myNodes : Integer [5]; + +end MeshPyramid; diff --git a/src/SMDS/SMDS_MeshPyramid.cxx b/src/SMDS/SMDS_MeshPyramid.cxx new file mode 100644 index 000000000..d6868bb5d --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.cxx @@ -0,0 +1,147 @@ +using namespace std; +// File: SMDS_MeshPyramid.cxx +// Created: Wed Jan 23 17:02:34 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshPyramid.ixx" +#include + + +//======================================================================= +//function : SMDS_MeshPyramid +//purpose : Pyramid +//======================================================================= + +SMDS_MeshPyramid::SMDS_MeshPyramid(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5):SMDS_MeshVolume(ID,5) +{ + SetConnections(idnode1,idnode2,idnode3,idnode4,idnode5); + ComputeKey(); +} + + + +//======================================================================= +//function : SetConnections +//purpose : Pyramid +//======================================================================= +void SMDS_MeshPyramid::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) +{ + + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + idmin = (idmin < idnode4 ? idmin : idnode4); + idmin = (idmin < idnode5 ? idmin : idnode5); + + myNodes[0] = idmin; + if (idmin == idnode1) { // 1 2 3 4 5 + myNodes[1] = idnode2; + myNodes[2] = idnode3; + myNodes[3] = idnode4; + myNodes[4] = idnode5; + } else if (idmin == idnode2) { // 2 3 4 5 1 + myNodes[1] = idnode3; + myNodes[2] = idnode4; + myNodes[3] = idnode5; + myNodes[4] = idnode1; + } else if (idmin == idnode3) { // 3 4 5 1 2 + myNodes[1] = idnode4; + myNodes[2] = idnode5; + myNodes[3] = idnode1; + myNodes[4] = idnode2; + } else if (idmin == idnode4) { // 4 5 1 2 3 + myNodes[1] = idnode5; + myNodes[2] = idnode1; + myNodes[3] = idnode2; + myNodes[4] = idnode3; + } else { // 5 1 2 3 4 + myNodes[1] = idnode1; + myNodes[2] = idnode2; + myNodes[3] = idnode3; + myNodes[4] = idnode4; + } + +} + +//======================================================================= +//function : NodesOfFace +//purpose : returns the rank node in mynodes. Useful to extract faces from volume +//======================================================================= +Standard_Integer SMDS_MeshPyramid::NodesOfFace(const Standard_Integer rankface, + const Standard_Integer ranknode) +{ + static Standard_Integer facenode[5][4] = { + {0,1,2,3}, + {0,4,1,-1}, + {1,4,2,-1}, + {2,4,3,-1}, + {0,3,4,-1} + }; + + return facenode[rankface-1][ranknode-1]; +} + +//======================================================================= +//function : NodesOfEdge +//purpose : returns the rank node in mynodes. Useful to extract edges from volume +//======================================================================= +Standard_Integer SMDS_MeshPyramid::NodesOfEdge(const Standard_Integer rankedge, + const Standard_Integer ranknode) const +{ + static Standard_Integer faceedge[8][2] = { + {0,1}, + {1,2}, + {2,3}, + {0,3}, + {0,4}, + {1,4}, + {2,4}, + {3,4} + + }; + + return faceedge[rankedge-1][ranknode-1]; +} + + +//======================================================================= +//function : GetFaceDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshPyramid::GetFaceDefinedByNodes(const Standard_Integer rank, + const Standard_Address idnode, + Standard_Integer& nb) const +{ + Standard_Integer *ptr; + ptr = (Standard_Integer *)idnode; + ptr[0] = myNodes[NodesOfFace(rank,1)]; + ptr[1] = myNodes[NodesOfFace(rank,2)]; + ptr[2] = myNodes[NodesOfFace(rank,3)]; + nb = (NodesOfFace(rank,4) == -1 ? 3 : 4); + if (nb == 4) + ptr[3] = myNodes[NodesOfFace(rank,4)]; + +} + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshPyramid::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[NodesOfEdge(rank,1)]; + idnode2 = myNodes[NodesOfEdge(rank,2)]; +} + diff --git a/src/SMDS/SMDS_MeshPyramid.hxx b/src/SMDS/SMDS_MeshPyramid.hxx new file mode 100644 index 000000000..2aa2c4623 --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.hxx @@ -0,0 +1,114 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshPyramid_HeaderFile +#define _SMDS_MeshPyramid_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshPyramid_HeaderFile +#include "Handle_SMDS_MeshPyramid.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshVolume_HeaderFile +#include "SMDS_MeshVolume.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +class Standard_ConstructionError; + + +class SMDS_MeshPyramid : public SMDS_MeshVolume { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshPyramid(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5); +Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const; +Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT inline Standard_Integer NbEdges() const; +Standard_EXPORT inline Standard_Integer NbFaces() const; +Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ; +Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const; +Standard_EXPORT ~SMDS_MeshPyramid(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshPyramid_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[5]; + + +}; + + +#include "SMDS_MeshPyramid.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshPyramid.ixx b/src/SMDS/SMDS_MeshPyramid.ixx new file mode 100644 index 000000000..62833c223 --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshPyramid.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshPyramid::~SMDS_MeshPyramid() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshPyramid_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshVolume); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshVolume); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshPyramid", + sizeof(SMDS_MeshPyramid), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshPyramid) Handle(SMDS_MeshPyramid)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshPyramid) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshPyramid))) { + _anOtherObject = Handle(SMDS_MeshPyramid)((Handle(SMDS_MeshPyramid)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshPyramid::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshPyramid) ; +} +Standard_Boolean SMDS_MeshPyramid::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshPyramid) == AType || SMDS_MeshVolume::IsKind(AType)); +} +Handle_SMDS_MeshPyramid::~Handle_SMDS_MeshPyramid() {} + diff --git a/src/SMDS/SMDS_MeshPyramid.jxx b/src/SMDS/SMDS_MeshPyramid.jxx new file mode 100644 index 000000000..5799b956c --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.jxx @@ -0,0 +1,6 @@ +#ifndef _Standard_ConstructionError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshPyramid_HeaderFile +#include "SMDS_MeshPyramid.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshPyramid.lxx b/src/SMDS/SMDS_MeshPyramid.lxx new file mode 100644 index 000000000..015b90f28 --- /dev/null +++ b/src/SMDS/SMDS_MeshPyramid.lxx @@ -0,0 +1,61 @@ +// File: SMDS_MeshPyramid.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshPyramid::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshPyramid::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the volume based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshPyramid::ComputeKey() +{ + // myKey = (myNodes[0]<<4) + (myNodes[1]<<3) + (myNodes[2]<<2) + (myNodes[3]<<1) + myNodes[4]; + myKey = myNodes[0] + myNodes[1] + myNodes[2] + myNodes[3] + myNodes[4]; +} + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshPyramid::NbEdges() const +{ + return 8; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshPyramid::NbFaces() const +{ + return 5; +} + diff --git a/src/SMDS/SMDS_MeshQuadrangle.cdl b/src/SMDS/SMDS_MeshQuadrangle.cdl new file mode 100644 index 000000000..ba5a3afcc --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.cdl @@ -0,0 +1,43 @@ +-- File: SMDS_MeshQuadrangle.cdl +-- Created: Wed Jan 23 16:16:09 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshQuadrangle from SMDS inherits MeshFace from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +is + + Create (ID,idnode1,idnode2,idnode3,idnode4: Integer) returns mutable MeshQuadrangle; + ---Purpose: constructor for a quandrangle + + ComputeKey(me: mutable) is redefined static; + ---Purpose: compute the ID of the face based on the id's of its + -- bounding nodes + ---C++: inline + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1, idnode2 : out Integer) is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the face + -- rank must be comprised between 1 and myNbConnections included. + ---C++: inline + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2,idnode3,idnode4: Integer) is private; + + +fields + + myNodes : Integer [4]; + +end MeshQuadrangle; diff --git a/src/SMDS/SMDS_MeshQuadrangle.cxx b/src/SMDS/SMDS_MeshQuadrangle.cxx new file mode 100644 index 000000000..6482a1dc4 --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.cxx @@ -0,0 +1,62 @@ +using namespace std; +// File: SMDS_MeshQuadrangle.cxx +// Created: Wed Jan 23 17:02:27 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshQuadrangle.ixx" + + + +//======================================================================= +//function : SMDS_MeshQuadrangle +//purpose : +//======================================================================= + +SMDS_MeshQuadrangle::SMDS_MeshQuadrangle(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4):SMDS_MeshFace(ID,4) +{ + SetConnections(idnode1,idnode2,idnode3,idnode4); + ComputeKey(); +} + + + +//======================================================================= +//function : SetConnections +//purpose : +//======================================================================= +void SMDS_MeshQuadrangle::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + idmin = (idmin < idnode4 ? idmin : idnode4); + + myNodes[0] = idmin; + if (idmin == idnode1) { + myNodes[1] = idnode2; + myNodes[2] = idnode3; + myNodes[3] = idnode4; + } else if (idmin == idnode2) { + myNodes[1] = idnode3; + myNodes[2] = idnode4; + myNodes[3] = idnode1; + } else if (idmin == idnode3) { + myNodes[1] = idnode4; + myNodes[2] = idnode1; + myNodes[3] = idnode2; + } else { + myNodes[1] = idnode1; + myNodes[2] = idnode2; + myNodes[3] = idnode3; + } + +} + diff --git a/src/SMDS/SMDS_MeshQuadrangle.hxx b/src/SMDS/SMDS_MeshQuadrangle.hxx new file mode 100644 index 000000000..3369f7689 --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.hxx @@ -0,0 +1,108 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshQuadrangle_HeaderFile +#define _SMDS_MeshQuadrangle_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshQuadrangle_HeaderFile +#include "Handle_SMDS_MeshQuadrangle.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshFace_HeaderFile +#include "SMDS_MeshFace.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif + + +class SMDS_MeshQuadrangle : public SMDS_MeshFace { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshQuadrangle(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4); +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT ~SMDS_MeshQuadrangle(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshQuadrangle_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[4]; + + +}; + + +#include "SMDS_MeshQuadrangle.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshQuadrangle.ixx b/src/SMDS/SMDS_MeshQuadrangle.ixx new file mode 100644 index 000000000..e4eb0b0ee --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshQuadrangle.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshQuadrangle::~SMDS_MeshQuadrangle() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshQuadrangle_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshFace); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshFace); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshQuadrangle", + sizeof(SMDS_MeshQuadrangle), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshQuadrangle) Handle(SMDS_MeshQuadrangle)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshQuadrangle) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshQuadrangle))) { + _anOtherObject = Handle(SMDS_MeshQuadrangle)((Handle(SMDS_MeshQuadrangle)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshQuadrangle::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshQuadrangle) ; +} +Standard_Boolean SMDS_MeshQuadrangle::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshQuadrangle) == AType || SMDS_MeshFace::IsKind(AType)); +} +Handle_SMDS_MeshQuadrangle::~Handle_SMDS_MeshQuadrangle() {} + diff --git a/src/SMDS/SMDS_MeshQuadrangle.jxx b/src/SMDS/SMDS_MeshQuadrangle.jxx new file mode 100644 index 000000000..dd888e069 --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshQuadrangle_HeaderFile +#include "SMDS_MeshQuadrangle.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshQuadrangle.lxx b/src/SMDS/SMDS_MeshQuadrangle.lxx new file mode 100644 index 000000000..8acbba93c --- /dev/null +++ b/src/SMDS/SMDS_MeshQuadrangle.lxx @@ -0,0 +1,53 @@ +// File: SMDS_MeshQuadrangle.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshQuadrangle::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshQuadrangle::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the face based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshQuadrangle::ComputeKey() +{ + // myKey = (myNodes[0] << 3) + (myNodes[1] << 2) + (myNodes[2] << 1) + myNodes[3]; + myKey = myNodes[0] + myNodes[1] + myNodes[2] + myNodes[3]; +} + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +inline void SMDS_MeshQuadrangle::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[rank-1]; + idnode2 = myNodes[rank % myNbNodes]; +} + diff --git a/src/SMDS/SMDS_MeshTetrahedron.cdl b/src/SMDS/SMDS_MeshTetrahedron.cdl new file mode 100644 index 000000000..a15a0acc7 --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.cdl @@ -0,0 +1,67 @@ +-- File: SMDS_MeshTetrahedron.cdl +-- Created: Wed Jan 23 16:17:22 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshTetrahedron from SMDS inherits MeshVolume from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +raises + ConstructionError from Standard + +is + + Create (ID, idnode1,idnode2,idnode3,idnode4: Integer) returns mutable MeshTetrahedron; + ---Purpose: constructor for a tetrahedra + + GetFaceDefinedByNodes(me; rank: Integer; idnode : Address; nb: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith face (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1 : out Integer; idnode2: out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the volume + -- rank must be comprised between 1 and myNbConnections included. + + + ComputeKey(me: mutable) is redefined static; + ---Purpose: compute the ID of the volume based on the id's of its + -- bounding nodes + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2,idnode3,idnode4: Integer) is private; + + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + NbEdges(me) returns Integer + is redefined static; + ---C++: inline + + NbFaces(me) returns Integer + is redefined static; + ---C++: inline + + NodesOfFace(myclass; rankface,ranknode: Integer) + returns Integer; + ---Purpose: returns the rank node in mynodes. Useful to extract faces from volume + -- + + NodesOfEdge(me; rankedge: Integer; ranknode: Integer) returns Integer; + +fields + + myNodes : Integer [4]; + +end MeshTetrahedron; diff --git a/src/SMDS/SMDS_MeshTetrahedron.cxx b/src/SMDS/SMDS_MeshTetrahedron.cxx new file mode 100644 index 000000000..bfcfcbb8d --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.cxx @@ -0,0 +1,128 @@ +using namespace std; +// File: SMDS_MeshTetrahedron.cxx +// Created: Wed Jan 23 17:02:34 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshTetrahedron.ixx" +#include "Standard_ConstructionError.hxx" + +//======================================================================= +//function : SMDS_MeshTetrahedron +//purpose : Tetrahedra +//======================================================================= + +SMDS_MeshTetrahedron::SMDS_MeshTetrahedron(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4):SMDS_MeshVolume(ID,4) +{ + SetConnections(idnode1,idnode2,idnode3,idnode4); + ComputeKey(); +} + + +//======================================================================= +//function : SetConnections +//purpose : Tetrahedra +//======================================================================= +void SMDS_MeshTetrahedron::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + idmin = (idmin < idnode4 ? idmin : idnode4); + + myNodes[0] = idmin; + if (idmin == idnode1) { + myNodes[1] = idnode2; + myNodes[2] = idnode3; + myNodes[3] = idnode4; + } else if (idmin == idnode2) { + myNodes[1] = idnode3; + myNodes[2] = idnode4; + myNodes[3] = idnode1; + } else if (idmin == idnode3) { + myNodes[1] = idnode4; + myNodes[2] = idnode1; + myNodes[3] = idnode2; + } else { + myNodes[1] = idnode1; + myNodes[2] = idnode2; + myNodes[3] = idnode3; + } + +} + + +//======================================================================= +//function : NodesOfFace +//purpose : returns the rank node in mynodes. Useful to extract faces from volume +//======================================================================= +Standard_Integer SMDS_MeshTetrahedron::NodesOfFace(const Standard_Integer rankface, + const Standard_Integer ranknode) +{ + static Standard_Integer facenode[4][3] = { + {0,1,2}, + {0,3,1}, + {1,3,2}, + {0,2,3} + }; + + return facenode[rankface-1][ranknode-1]; +} + + +//======================================================================= +//function : NodesOfEdge +//purpose : returns the rank node in mynodes. Useful to extract edges from volume +//======================================================================= +Standard_Integer SMDS_MeshTetrahedron::NodesOfEdge(const Standard_Integer rankedge, + const Standard_Integer ranknode) const +{ + static Standard_Integer faceedge[6][2] = { + {0,1}, + {1,2}, + {0,2}, + {0,3}, + {1,3}, + {2,3} + }; + + return faceedge[rankedge-1][ranknode-1]; +} + + +//======================================================================= +//function : GetFaceDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshTetrahedron::GetFaceDefinedByNodes(const Standard_Integer rank, + const Standard_Address idnode, + Standard_Integer& nb) const +{ + Standard_Integer *ptr; + nb = 3; + ptr = (Standard_Integer *)idnode; + ptr[0] = myNodes[NodesOfFace(rank,1)]; + ptr[1] = myNodes[NodesOfFace(rank,2)]; + ptr[2] = myNodes[NodesOfFace(rank,3)]; + +} + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +void SMDS_MeshTetrahedron::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[NodesOfEdge(rank,1)]; + idnode2 = myNodes[NodesOfEdge(rank,2)]; +} + diff --git a/src/SMDS/SMDS_MeshTetrahedron.hxx b/src/SMDS/SMDS_MeshTetrahedron.hxx new file mode 100644 index 000000000..e45f80a55 --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.hxx @@ -0,0 +1,114 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshTetrahedron_HeaderFile +#define _SMDS_MeshTetrahedron_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshTetrahedron_HeaderFile +#include "Handle_SMDS_MeshTetrahedron.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshVolume_HeaderFile +#include "SMDS_MeshVolume.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +class Standard_ConstructionError; + + +class SMDS_MeshTetrahedron : public SMDS_MeshVolume { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshTetrahedron(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4); +Standard_EXPORT void GetFaceDefinedByNodes(const Standard_Integer rank,const Standard_Address idnode,Standard_Integer& nb) const; +Standard_EXPORT void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT inline Standard_Integer NbEdges() const; +Standard_EXPORT inline Standard_Integer NbFaces() const; +Standard_EXPORT static Standard_Integer NodesOfFace(const Standard_Integer rankface,const Standard_Integer ranknode) ; +Standard_EXPORT Standard_Integer NodesOfEdge(const Standard_Integer rankedge,const Standard_Integer ranknode) const; +Standard_EXPORT ~SMDS_MeshTetrahedron(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshTetrahedron_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[4]; + + +}; + + +#include "SMDS_MeshTetrahedron.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshTetrahedron.ixx b/src/SMDS/SMDS_MeshTetrahedron.ixx new file mode 100644 index 000000000..b801dd430 --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshTetrahedron.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshTetrahedron::~SMDS_MeshTetrahedron() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshTetrahedron_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshVolume); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshVolume); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshTetrahedron", + sizeof(SMDS_MeshTetrahedron), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshTetrahedron) Handle(SMDS_MeshTetrahedron)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshTetrahedron) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshTetrahedron))) { + _anOtherObject = Handle(SMDS_MeshTetrahedron)((Handle(SMDS_MeshTetrahedron)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshTetrahedron::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshTetrahedron) ; +} +Standard_Boolean SMDS_MeshTetrahedron::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshTetrahedron) == AType || SMDS_MeshVolume::IsKind(AType)); +} +Handle_SMDS_MeshTetrahedron::~Handle_SMDS_MeshTetrahedron() {} + diff --git a/src/SMDS/SMDS_MeshTetrahedron.jxx b/src/SMDS/SMDS_MeshTetrahedron.jxx new file mode 100644 index 000000000..7430d1b40 --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.jxx @@ -0,0 +1,6 @@ +#ifndef _Standard_ConstructionError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshTetrahedron_HeaderFile +#include "SMDS_MeshTetrahedron.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshTetrahedron.lxx b/src/SMDS/SMDS_MeshTetrahedron.lxx new file mode 100644 index 000000000..37d0fdd46 --- /dev/null +++ b/src/SMDS/SMDS_MeshTetrahedron.lxx @@ -0,0 +1,62 @@ +// File: SMDS_MeshTetrahedron.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshTetrahedron::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshTetrahedron::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the volume based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshTetrahedron::ComputeKey() +{ + // myKey = (myNodes[0]<<3) + (myNodes[1]<<2) + (myNodes[2]<<1) + myNodes[3]; + myKey = myNodes[0] + myNodes[1] + myNodes[2] + myNodes[3]; +} + + +//======================================================================= +//function : NbEdges +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshTetrahedron::NbEdges() const +{ + return 6; +} + +//======================================================================= +//function : NbFaces +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_MeshTetrahedron::NbFaces() const +{ + return 4; +} + diff --git a/src/SMDS/SMDS_MeshTriangle.cdl b/src/SMDS/SMDS_MeshTriangle.cdl new file mode 100644 index 000000000..a1a7dde82 --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.cdl @@ -0,0 +1,44 @@ +-- File: SMDS_MeshTriangle.cdl +-- Created: Wed Jan 23 16:16:09 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshTriangle from SMDS inherits MeshFace from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +is + + Create (ID, idnode1,idnode2,idnode3: Integer) returns mutable MeshTriangle; + ---Purpose: constructor for a triangle + + ComputeKey(me: mutable) is redefined static; + ---Purpose: compute the ID of the face based on the id's of its + -- bounding nodes + ---C++: inline + + GetEdgeDefinedByNodes(me; rank: Integer; idnode1, idnode2 : out Integer) + is redefined static; + ---Purpose: returns the idnodes of the ith edge (rank) of the face + -- rank must be comprised between 1 and myNbConnections included. + ---C++: inline + + GetConnections(me) returns Address is redefined static; + ---C++: inline + + GetConnection(me; rank: Integer) returns Integer is redefined static; + ---C++: inline + + SetConnections(me: mutable; idnode1,idnode2,idnode3: Integer) is private; + + +fields + + myNodes : Integer [3]; + +end MeshTriangle; diff --git a/src/SMDS/SMDS_MeshTriangle.cxx b/src/SMDS/SMDS_MeshTriangle.cxx new file mode 100644 index 000000000..408fb0167 --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File: SMDS_MeshTriangle.cxx +// Created: Wed Jan 23 17:02:27 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshTriangle.ixx" + + +//======================================================================= +//function : SMDS_MeshTriangle +//purpose : +//======================================================================= + +SMDS_MeshTriangle::SMDS_MeshTriangle(const Standard_Integer ID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3):SMDS_MeshFace(ID,3) +{ + SetConnections(idnode1,idnode2,idnode3); + ComputeKey(); +} + + +//======================================================================= +//function : SetConnections +//purpose : +//======================================================================= +void SMDS_MeshTriangle::SetConnections(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2); + idmin = (idmin < idnode3 ? idmin : idnode3); + + myNodes[0] = idmin; + if (idmin == idnode1) { + myNodes[1] = idnode2; + myNodes[2] = idnode3; + } else if (idmin == idnode2) { + myNodes[1] = idnode3; + myNodes[2] = idnode1; + } else { + myNodes[1] = idnode1; + myNodes[2] = idnode2; + } + +} + diff --git a/src/SMDS/SMDS_MeshTriangle.hxx b/src/SMDS/SMDS_MeshTriangle.hxx new file mode 100644 index 000000000..88a021a3c --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.hxx @@ -0,0 +1,108 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_MeshTriangle_HeaderFile +#define _SMDS_MeshTriangle_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshTriangle_HeaderFile +#include "Handle_SMDS_MeshTriangle.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshFace_HeaderFile +#include "SMDS_MeshFace.hxx" +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif + + +class SMDS_MeshTriangle : public SMDS_MeshFace { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshTriangle(const Standard_Integer ID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3); +Standard_EXPORT inline void ComputeKey() ; +Standard_EXPORT inline void GetEdgeDefinedByNodes(const Standard_Integer rank,Standard_Integer& idnode1,Standard_Integer& idnode2) const; +Standard_EXPORT inline Standard_Address GetConnections() const; +Standard_EXPORT inline Standard_Integer GetConnection(const Standard_Integer rank) const; +Standard_EXPORT ~SMDS_MeshTriangle(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshTriangle_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT void SetConnections(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; + + + // Fields PRIVATE + // +Standard_Integer myNodes[3]; + + +}; + + +#include "SMDS_MeshTriangle.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshTriangle.ixx b/src/SMDS/SMDS_MeshTriangle.ixx new file mode 100644 index 000000000..028c45d33 --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.ixx @@ -0,0 +1,75 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshTriangle.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshTriangle::~SMDS_MeshTriangle() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshTriangle_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshFace); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshFace); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType3 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient); + if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshTriangle", + sizeof(SMDS_MeshTriangle), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshTriangle) Handle(SMDS_MeshTriangle)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshTriangle) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshTriangle))) { + _anOtherObject = Handle(SMDS_MeshTriangle)((Handle(SMDS_MeshTriangle)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshTriangle::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshTriangle) ; +} +Standard_Boolean SMDS_MeshTriangle::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshTriangle) == AType || SMDS_MeshFace::IsKind(AType)); +} +Handle_SMDS_MeshTriangle::~Handle_SMDS_MeshTriangle() {} + diff --git a/src/SMDS/SMDS_MeshTriangle.jxx b/src/SMDS/SMDS_MeshTriangle.jxx new file mode 100644 index 000000000..1aef5df6a --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.jxx @@ -0,0 +1,3 @@ +#ifndef _SMDS_MeshTriangle_HeaderFile +#include "SMDS_MeshTriangle.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshTriangle.lxx b/src/SMDS/SMDS_MeshTriangle.lxx new file mode 100644 index 000000000..89c0e10ea --- /dev/null +++ b/src/SMDS/SMDS_MeshTriangle.lxx @@ -0,0 +1,56 @@ +// File: SMDS_MeshTriangle.lxx +// Created: Thu Jan 24 17:06:47 2002 +// Author: Jean-Michel BOULCOURT +// + + + + +//======================================================================= +//function : GetConnections +//purpose : +// +//======================================================================= + +inline Standard_Address SMDS_MeshTriangle::GetConnections() const +{ + return (Standard_Address)&myNodes; +} + +//======================================================================= +//function : GetConnection +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshTriangle::GetConnection(const Standard_Integer rank) const +{ + return myNodes[rank-1]; +} + +//======================================================================= +//function : ComputeKey +//purpose : compute the Key of the face based on the ids of its bounding nodes +// +//======================================================================= + +inline void SMDS_MeshTriangle::ComputeKey() +{ + // myKey = (myNodes[0] << 2) + (myNodes[1] << 1) + (myNodes[2]); + myKey = myNodes[0] + myNodes[1] + myNodes[2]; +} + + +//======================================================================= +//function : GetEdgeDefinedByNodes +//purpose : +//======================================================================= +inline void SMDS_MeshTriangle::GetEdgeDefinedByNodes(const Standard_Integer rank, + Standard_Integer& idnode1, + Standard_Integer& idnode2) const +{ + idnode1 = myNodes[rank-1]; + idnode2 = myNodes[rank % myNbNodes]; +} + + diff --git a/src/SMDS/SMDS_MeshVolume.cdl b/src/SMDS/SMDS_MeshVolume.cdl new file mode 100755 index 000000000..dba7e8130 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolume.cdl @@ -0,0 +1,35 @@ +-- File: SMDS_MeshVolume.cdl +-- Created: Wed Jan 23 16:17:22 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class MeshVolume from SMDS inherits MeshElement from SMDS + + ---Purpose: + +uses + MeshElement from SMDS + +raises + ConstructionError from Standard + +is + + Initialize(ID: Integer; NbConnections : Integer) returns mutable MeshVolume; + + + ComputeKey(me: mutable) is deferred; + ---Purpose: compute the ID of the volume based on the id's of its + -- bounding nodes + + GetKey(me) returns Integer is redefined static; + ---C++: inline + + Print(me; OS: in out OStream) is redefined virtual; + +fields + myKey : Integer is protected; + +end MeshVolume; diff --git a/src/SMDS/SMDS_MeshVolume.cxx b/src/SMDS/SMDS_MeshVolume.cxx new file mode 100644 index 000000000..f965172bf --- /dev/null +++ b/src/SMDS/SMDS_MeshVolume.cxx @@ -0,0 +1,34 @@ +using namespace std; +// File: SMDS_MeshVolume.cxx +// Created: Wed Jan 23 17:02:34 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshVolume.ixx" +#include + +//======================================================================= +//function : SMDS_MeshVolume +//purpose : +//======================================================================= + +SMDS_MeshVolume::SMDS_MeshVolume(const Standard_Integer ID, const Standard_Integer nb) +:SMDS_MeshElement(ID,nb,SMDSAbs_Volume) +{ +} + +//======================================================================= +//function : Print +//purpose : +//======================================================================= + +void SMDS_MeshVolume::Print(Standard_OStream& OS) const +{ + OS << "volume <" << myID <<"> : " ; + for (Standard_Integer i=1; i +#endif +#ifndef _Handle_SMDS_MeshVolume_HeaderFile +#include "Handle_SMDS_MeshVolume.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _Standard_OStream_HeaderFile +#include +#endif +class Standard_ConstructionError; + + +class SMDS_MeshVolume : public SMDS_MeshElement { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual void ComputeKey() = 0; +Standard_EXPORT inline Standard_Integer GetKey() const; +Standard_EXPORT virtual void Print(Standard_OStream& OS) const; +Standard_EXPORT ~SMDS_MeshVolume(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_MeshVolume_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDS_MeshVolume(const Standard_Integer ID,const Standard_Integer NbConnections); + + + // Fields PROTECTED + // +Standard_Integer myKey; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_MeshVolume.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshVolume.ixx b/src/SMDS/SMDS_MeshVolume.ixx new file mode 100644 index 000000000..c29910917 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolume.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshVolume.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_MeshVolume::~SMDS_MeshVolume() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_MeshVolume_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_MeshElement); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_MeshElement); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_MeshVolume", + sizeof(SMDS_MeshVolume), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_MeshVolume) Handle(SMDS_MeshVolume)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_MeshVolume) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_MeshVolume))) { + _anOtherObject = Handle(SMDS_MeshVolume)((Handle(SMDS_MeshVolume)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_MeshVolume::DynamicType() const +{ + return STANDARD_TYPE(SMDS_MeshVolume) ; +} +Standard_Boolean SMDS_MeshVolume::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_MeshVolume) == AType || SMDS_MeshElement::IsKind(AType)); +} +Handle_SMDS_MeshVolume::~Handle_SMDS_MeshVolume() {} + diff --git a/src/SMDS/SMDS_MeshVolume.jxx b/src/SMDS/SMDS_MeshVolume.jxx new file mode 100644 index 000000000..80cff7107 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolume.jxx @@ -0,0 +1,6 @@ +#ifndef _Standard_ConstructionError_HeaderFile +#include +#endif +#ifndef _SMDS_MeshVolume_HeaderFile +#include "SMDS_MeshVolume.hxx" +#endif diff --git a/src/SMDS/SMDS_MeshVolume.lxx b/src/SMDS/SMDS_MeshVolume.lxx new file mode 100644 index 000000000..a8dc5acf4 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolume.lxx @@ -0,0 +1,16 @@ +// File: SMDS_MeshVolume.lxx +// Created: Tue May 7 18:15:11 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : GetKey +//purpose : +// +//======================================================================= + +inline Standard_Integer SMDS_MeshVolume::GetKey() const +{ + return myKey; +} + diff --git a/src/SMDS/SMDS_MeshVolumesIterator.cdl b/src/SMDS/SMDS_MeshVolumesIterator.cdl new file mode 100644 index 000000000..3a3eed139 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolumesIterator.cdl @@ -0,0 +1,34 @@ +-- File: SMDS_MeshVolumesIterator.cdl +-- Created: Thu Jan 24 12:00:41 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class MeshVolumesIterator from SMDS inherits MeshElementsIterator from SMDS + + ---Purpose: The Iterator objet to iterate on all volumes of a mesh + -- + +uses + Mesh from SMDS, + MeshElement from SMDS + +raises + NoMoreObject, + NoSuchObject + +is + + Create returns MeshVolumesIterator from SMDS; + ---Purpose: Creates an empty Iterator. + + Create(M : Mesh from SMDS) returns MeshVolumesIterator from SMDS; + ---Purpose: Creates an Iterator on faces of mesh . + + Initialize(me : in out; M : Mesh from SMDS) + ---Purpose: Reset the Iterator on the faces of mesh . + is redefined static; + + +end MeshVolumesIterator; diff --git a/src/SMDS/SMDS_MeshVolumesIterator.cxx b/src/SMDS/SMDS_MeshVolumesIterator.cxx new file mode 100644 index 000000000..46608dce5 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolumesIterator.cxx @@ -0,0 +1,42 @@ +using namespace std; +// File: SMDS_MeshVolumesIterator.cxx +// Created: Thu Jan 24 12:09:12 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_MeshVolumesIterator.ixx" + +//======================================================================= +//function : SMDS_MeshVolumesIterator +//purpose : +//======================================================================= + +SMDS_MeshVolumesIterator::SMDS_MeshVolumesIterator() +{ +} + +//======================================================================= +//function : SMDS_MeshVolumesIterator +//purpose : +//======================================================================= + +SMDS_MeshVolumesIterator::SMDS_MeshVolumesIterator(const Handle(SMDS_Mesh)& M) +{ + Initialize(M); +} + +//======================================================================= +//function : Initialize +//purpose : +//======================================================================= + +void SMDS_MeshVolumesIterator::Initialize(const Handle(SMDS_Mesh)& M) +{ + + myMapIterator.Initialize(M->myVolumes); + if (More()) { + myCurrentMeshElement = myMapIterator.Key(); + } +} + diff --git a/src/SMDS/SMDS_MeshVolumesIterator.hxx b/src/SMDS/SMDS_MeshVolumesIterator.hxx new file mode 100644 index 000000000..d5a9f098b --- /dev/null +++ b/src/SMDS/SMDS_MeshVolumesIterator.hxx @@ -0,0 +1,96 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_MeshVolumesIterator_HeaderFile +#define _SMDS_MeshVolumesIterator_HeaderFile + +#ifndef _SMDS_MeshElementsIterator_HeaderFile +#include "SMDS_MeshElementsIterator.hxx" +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMDS_Mesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_MeshVolumesIterator : public SMDS_MeshElementsIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_MeshVolumesIterator(); +Standard_EXPORT SMDS_MeshVolumesIterator(const Handle(SMDS_Mesh)& M); +Standard_EXPORT void Initialize(const Handle(SMDS_Mesh)& M) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_MeshVolumesIterator.ixx b/src/SMDS/SMDS_MeshVolumesIterator.ixx new file mode 100644 index 000000000..c74a18090 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolumesIterator.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_MeshVolumesIterator.jxx" + + + + diff --git a/src/SMDS/SMDS_MeshVolumesIterator.jxx b/src/SMDS/SMDS_MeshVolumesIterator.jxx new file mode 100644 index 000000000..45c037688 --- /dev/null +++ b/src/SMDS/SMDS_MeshVolumesIterator.jxx @@ -0,0 +1,12 @@ +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshVolumesIterator_HeaderFile +#include "SMDS_MeshVolumesIterator.hxx" +#endif diff --git a/src/SMDS/SMDS_PntHasher.cdl b/src/SMDS/SMDS_PntHasher.cdl new file mode 100644 index 000000000..b48e9829b --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.cdl @@ -0,0 +1,26 @@ +-- File: IntPoly_PntHasher.cdl +-- Created: Wed Jan 23 16:15:04 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class PntHasher from SMDS + +uses Pnt from gp + +is HashCode(myclass; Point : Pnt from gp; + Upper : Integer) + returns Integer; + ---Purpose: Returns a HasCode value for the Key in the + -- range 0..Upper. + ---C++: inline + + IsEqual(myclass; Point1,Point2 : Pnt from gp) + returns Boolean; + ---Purpose: Returns True when the two keys are the same. Two + -- same keys must have the same hashcode, the + -- contrary is not necessary. + ---C++: inline + +end PntHasher; diff --git a/src/SMDS/SMDS_PntHasher.cxx b/src/SMDS/SMDS_PntHasher.cxx new file mode 100644 index 000000000..3b0c8c244 --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.cxx @@ -0,0 +1,8 @@ +using namespace std; +// File: SMDS_PntHasher.cxx +// Created: Wed Jan 23 14:09:30 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_PntHasher.ixx" diff --git a/src/SMDS/SMDS_PntHasher.hxx b/src/SMDS/SMDS_PntHasher.hxx new file mode 100644 index 000000000..fcb4e8dae --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.hxx @@ -0,0 +1,94 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_PntHasher_HeaderFile +#define _SMDS_PntHasher_HeaderFile + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class gp_Pnt; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_PntHasher { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline static Standard_Integer HashCode(const gp_Pnt& Point,const Standard_Integer Upper) ; +Standard_EXPORT inline static Standard_Boolean IsEqual(const gp_Pnt& Point1,const gp_Pnt& Point2) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + +#include "SMDS_PntHasher.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_PntHasher.ixx b/src/SMDS/SMDS_PntHasher.ixx new file mode 100644 index 000000000..3fe15c8a4 --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.ixx @@ -0,0 +1,19 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_PntHasher.jxx" + + + + diff --git a/src/SMDS/SMDS_PntHasher.jxx b/src/SMDS/SMDS_PntHasher.jxx new file mode 100644 index 000000000..4a51bc08b --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_PntHasher_HeaderFile +#include "SMDS_PntHasher.hxx" +#endif diff --git a/src/SMDS/SMDS_PntHasher.lxx b/src/SMDS/SMDS_PntHasher.lxx new file mode 100644 index 000000000..0f7e79cdc --- /dev/null +++ b/src/SMDS/SMDS_PntHasher.lxx @@ -0,0 +1,42 @@ +// File: SMDS_PntHasher.lxx +// Created: Wed Jan 23 14:07:00 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include + +static Standard_Real tab1[3]; +static Standard_Real tab2[3]; + +//======================================================================= +//function : HashCode +//purpose : +//======================================================================= +inline Standard_Integer SMDS_PntHasher::HashCode + (const gp_Pnt& point, const Standard_Integer Upper) +{ + union + { + Standard_Real R[3]; + Standard_Integer I[6]; + } U; + + point.Coord(U.R[0],U.R[1],U.R[2]); + + return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper); + // return ::HashCode((U.I[0]>>4)+(U.I[1]>>3)+(U.I[2]>>2)+(U.I[3]>>1)+(U.I[4]>>4)+(U.I[5]>>3),Upper); + +} + +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= +inline Standard_Boolean SMDS_PntHasher::IsEqual + (const gp_Pnt& point1, const gp_Pnt& point2) +{ + point1.Coord(tab1[0],tab1[1],tab1[2]); + point2.Coord(tab2[0],tab2[1],tab2[2]); + return (memcmp(tab1,tab2,sizeof(tab1)) == 0); +} diff --git a/src/SMDS/SMDS_Position.cdl b/src/SMDS/SMDS_Position.cdl new file mode 100644 index 000000000..0c493e851 --- /dev/null +++ b/src/SMDS/SMDS_Position.cdl @@ -0,0 +1,48 @@ +-- File: SMDS_Position.cdl +-- Created: Mon May 13 13:40:18 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +deferred class Position from SMDS inherits TShared from MMgt + + ---Purpose: abstract class to define the different positions + -- of a node related to the underlying geometry (CAD model) + +uses + Pnt from gp, + TypeOfPosition from SMDS + +is + + Initialize(aShapeId: Integer; + aType: TypeOfPosition from SMDS = SMDS_TOP_UNSPEC) + returns mutable Position; + + Coords(me) returns Pnt from gp is deferred; + ---Purpose: returns the resulting 3d point to be set + -- in the MeshNode instance + -- must be redefined by inherited classes + + GetTypeOfPosition(me) returns TypeOfPosition from SMDS; + ---Purpose: returns the type of position + -- + ---C++: inline + + SetShapeId(me: mutable; aShapeId: Integer); + ---Purpose: Sets the ShapeId of the position + -- + ---C++: inline + + GetShapeId(me) returns Integer; + ---Purpose: Returns the ShapeId of the position + -- + ---C++: inline + + +fields + + myShapeId : Integer; + myType : TypeOfPosition from SMDS; +end Position; diff --git a/src/SMDS/SMDS_Position.cxx b/src/SMDS/SMDS_Position.cxx new file mode 100644 index 000000000..a0de9a60b --- /dev/null +++ b/src/SMDS/SMDS_Position.cxx @@ -0,0 +1,19 @@ +using namespace std; +// File: SMDS_Position.cxx +// Created: Mon May 13 13:50:20 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_Position.ixx" + +//======================================================================= +//function : SMDS_Position +//purpose : +//======================================================================= + +SMDS_Position::SMDS_Position(const Standard_Integer aShapeId, + const SMDS_TypeOfPosition aType) + :myShapeId(aShapeId),myType(aType) +{ +} diff --git a/src/SMDS/SMDS_Position.hxx b/src/SMDS/SMDS_Position.hxx new file mode 100644 index 000000000..54f499730 --- /dev/null +++ b/src/SMDS/SMDS_Position.hxx @@ -0,0 +1,109 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_Position_HeaderFile +#define _SMDS_Position_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Position_HeaderFile +#include "Handle_SMDS_Position.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMDS_TypeOfPosition_HeaderFile +#include "SMDS_TypeOfPosition.hxx" +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +class gp_Pnt; + + +class SMDS_Position : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT virtual gp_Pnt Coords() const = 0; +Standard_EXPORT inline SMDS_TypeOfPosition GetTypeOfPosition() const; +Standard_EXPORT inline void SetShapeId(const Standard_Integer aShapeId) ; +Standard_EXPORT inline Standard_Integer GetShapeId() const; +Standard_EXPORT ~SMDS_Position(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_Position_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // +Standard_EXPORT SMDS_Position(const Standard_Integer aShapeId,const SMDS_TypeOfPosition aType = SMDS_TOP_UNSPEC); + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myShapeId; +SMDS_TypeOfPosition myType; + + +}; + + +#include "SMDS_Position.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_Position.ixx b/src/SMDS/SMDS_Position.ixx new file mode 100644 index 000000000..f9688c8be --- /dev/null +++ b/src/SMDS/SMDS_Position.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_Position.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_Position::~SMDS_Position() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_Position_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_Position", + sizeof(SMDS_Position), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_Position) Handle(SMDS_Position)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_Position) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_Position))) { + _anOtherObject = Handle(SMDS_Position)((Handle(SMDS_Position)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_Position::DynamicType() const +{ + return STANDARD_TYPE(SMDS_Position) ; +} +Standard_Boolean SMDS_Position::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_Position) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMDS_Position::~Handle_SMDS_Position() {} + diff --git a/src/SMDS/SMDS_Position.jxx b/src/SMDS/SMDS_Position.jxx new file mode 100644 index 000000000..04803a2e1 --- /dev/null +++ b/src/SMDS/SMDS_Position.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif diff --git a/src/SMDS/SMDS_Position.lxx b/src/SMDS/SMDS_Position.lxx new file mode 100644 index 000000000..6498e9524 --- /dev/null +++ b/src/SMDS/SMDS_Position.lxx @@ -0,0 +1,34 @@ +// File: SMDS_Position.lxx +// Created: Mon May 13 13:47:03 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : GetTypeOfPosition +//purpose : +//======================================================================= + +inline SMDS_TypeOfPosition SMDS_Position::GetTypeOfPosition() const +{ + return myType; +} + +//======================================================================= +//function : SetShapeId +//purpose : +//======================================================================= + +inline void SMDS_Position::SetShapeId(const Standard_Integer aShapeId) +{ + myShapeId = aShapeId; +} + +//======================================================================= +//function : GetShapeId +//purpose : +//======================================================================= + +inline Standard_Integer SMDS_Position::GetShapeId() const +{ + return myShapeId; +} diff --git a/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh.hxx b/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh.hxx new file mode 100644 index 000000000..3f4f58103 --- /dev/null +++ b/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh.hxx @@ -0,0 +1,122 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile +#define _SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile +#include "Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _TCollection_SeqNode_HeaderFile +#include +#endif +#ifndef _TCollection_SeqNodePtr_HeaderFile +#include +#endif +class SMDS_Mesh; +class SMDS_SequenceOfMesh; + + +class SMDS_SequenceNodeOfSequenceOfMesh : public TCollection_SeqNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_SequenceNodeOfSequenceOfMesh(const Handle(SMDS_Mesh)& I,const TCollection_SeqNodePtr& n,const TCollection_SeqNodePtr& p); +Standard_EXPORT inline Handle_SMDS_Mesh& Value() const; +Standard_EXPORT ~SMDS_SequenceNodeOfSequenceOfMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_SequenceNodeOfSequenceOfMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_Mesh myValue; + + +}; + +#define SeqItem Handle_SMDS_Mesh +#define SeqItem_hxx "SMDS_Mesh.hxx" +#define TCollection_SequenceNode SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_hxx "SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#define Handle_TCollection_SequenceNode Handle_SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_Type_() SMDS_SequenceNodeOfSequenceOfMesh_Type_() +#define TCollection_Sequence SMDS_SequenceOfMesh +#define TCollection_Sequence_hxx "SMDS_SequenceOfMesh.hxx" + +#include + +#undef SeqItem +#undef SeqItem_hxx +#undef TCollection_SequenceNode +#undef TCollection_SequenceNode_hxx +#undef Handle_TCollection_SequenceNode +#undef TCollection_SequenceNode_Type_ +#undef TCollection_Sequence +#undef TCollection_Sequence_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh_0.cxx b/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh_0.cxx new file mode 100644 index 000000000..fd0c6691d --- /dev/null +++ b/src/SMDS/SMDS_SequenceNodeOfSequenceOfMesh_0.cxx @@ -0,0 +1,87 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_SequenceNodeOfSequenceOfMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_SequenceOfMesh_HeaderFile +#include "SMDS_SequenceOfMesh.hxx" +#endif +SMDS_SequenceNodeOfSequenceOfMesh::~SMDS_SequenceNodeOfSequenceOfMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_SequenceNodeOfSequenceOfMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_SeqNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_SeqNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_SequenceNodeOfSequenceOfMesh", + sizeof(SMDS_SequenceNodeOfSequenceOfMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_SequenceNodeOfSequenceOfMesh) Handle(SMDS_SequenceNodeOfSequenceOfMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_SequenceNodeOfSequenceOfMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_SequenceNodeOfSequenceOfMesh))) { + _anOtherObject = Handle(SMDS_SequenceNodeOfSequenceOfMesh)((Handle(SMDS_SequenceNodeOfSequenceOfMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_SequenceNodeOfSequenceOfMesh::DynamicType() const +{ + return STANDARD_TYPE(SMDS_SequenceNodeOfSequenceOfMesh) ; +} +Standard_Boolean SMDS_SequenceNodeOfSequenceOfMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_SequenceNodeOfSequenceOfMesh) == AType || TCollection_SeqNode::IsKind(AType)); +} +Handle_SMDS_SequenceNodeOfSequenceOfMesh::~Handle_SMDS_SequenceNodeOfSequenceOfMesh() {} +#define SeqItem Handle_SMDS_Mesh +#define SeqItem_hxx "SMDS_Mesh.hxx" +#define TCollection_SequenceNode SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_hxx "SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#define Handle_TCollection_SequenceNode Handle_SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_Type_() SMDS_SequenceNodeOfSequenceOfMesh_Type_() +#define TCollection_Sequence SMDS_SequenceOfMesh +#define TCollection_Sequence_hxx "SMDS_SequenceOfMesh.hxx" +#include + diff --git a/src/SMDS/SMDS_SequenceOfMesh.hxx b/src/SMDS/SMDS_SequenceOfMesh.hxx new file mode 100644 index 000000000..ba9910448 --- /dev/null +++ b/src/SMDS/SMDS_SequenceOfMesh.hxx @@ -0,0 +1,157 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMDS_SequenceOfMesh_HeaderFile +#define _SMDS_SequenceOfMesh_HeaderFile + +#ifndef _TCollection_BaseSequence_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _Handle_SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile +#include "Handle_SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class Standard_OutOfRange; +class SMDS_Mesh; +class SMDS_SequenceNodeOfSequenceOfMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMDS_SequenceOfMesh : public TCollection_BaseSequence { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_SequenceOfMesh(); +Standard_EXPORT void Clear() ; +~SMDS_SequenceOfMesh() +{ + Clear(); +} + +Standard_EXPORT const SMDS_SequenceOfMesh& Assign(const SMDS_SequenceOfMesh& Other) ; + const SMDS_SequenceOfMesh& operator =(const SMDS_SequenceOfMesh& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void Append(const Handle(SMDS_Mesh)& T) ; +Standard_EXPORT inline void Append(SMDS_SequenceOfMesh& S) ; +Standard_EXPORT void Prepend(const Handle(SMDS_Mesh)& T) ; +Standard_EXPORT inline void Prepend(SMDS_SequenceOfMesh& S) ; +Standard_EXPORT inline void InsertBefore(const Standard_Integer Index,const Handle(SMDS_Mesh)& T) ; +Standard_EXPORT inline void InsertBefore(const Standard_Integer Index,SMDS_SequenceOfMesh& S) ; +Standard_EXPORT void InsertAfter(const Standard_Integer Index,const Handle(SMDS_Mesh)& T) ; +Standard_EXPORT inline void InsertAfter(const Standard_Integer Index,SMDS_SequenceOfMesh& S) ; +Standard_EXPORT const Handle_SMDS_Mesh& First() const; +Standard_EXPORT const Handle_SMDS_Mesh& Last() const; +Standard_EXPORT inline void Split(const Standard_Integer Index,SMDS_SequenceOfMesh& Sub) ; +Standard_EXPORT const Handle_SMDS_Mesh& Value(const Standard_Integer Index) const; + const Handle_SMDS_Mesh& operator()(const Standard_Integer Index) const +{ + return Value(Index); +} + +Standard_EXPORT void SetValue(const Standard_Integer Index,const Handle(SMDS_Mesh)& I) ; +Standard_EXPORT Handle_SMDS_Mesh& ChangeValue(const Standard_Integer Index) ; + Handle_SMDS_Mesh& operator()(const Standard_Integer Index) +{ + return ChangeValue(Index); +} + +Standard_EXPORT void Remove(const Standard_Integer Index) ; +Standard_EXPORT void Remove(const Standard_Integer FromIndex,const Standard_Integer ToIndex) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMDS_SequenceOfMesh(const SMDS_SequenceOfMesh& Other); + + + // Fields PRIVATE + // + + +}; + +#define SeqItem Handle_SMDS_Mesh +#define SeqItem_hxx "SMDS_Mesh.hxx" +#define TCollection_SequenceNode SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_hxx "SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#define Handle_TCollection_SequenceNode Handle_SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_Type_() SMDS_SequenceNodeOfSequenceOfMesh_Type_() +#define TCollection_Sequence SMDS_SequenceOfMesh +#define TCollection_Sequence_hxx "SMDS_SequenceOfMesh.hxx" + +#include + +#undef SeqItem +#undef SeqItem_hxx +#undef TCollection_SequenceNode +#undef TCollection_SequenceNode_hxx +#undef Handle_TCollection_SequenceNode +#undef TCollection_SequenceNode_Type_ +#undef TCollection_Sequence +#undef TCollection_Sequence_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_SequenceOfMesh_0.cxx b/src/SMDS/SMDS_SequenceOfMesh_0.cxx new file mode 100644 index 000000000..01cc57301 --- /dev/null +++ b/src/SMDS/SMDS_SequenceOfMesh_0.cxx @@ -0,0 +1,41 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_SequenceOfMesh.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_SequenceNodeOfSequenceOfMesh_HeaderFile +#include "SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#endif + + +#define SeqItem Handle_SMDS_Mesh +#define SeqItem_hxx "SMDS_Mesh.hxx" +#define TCollection_SequenceNode SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_hxx "SMDS_SequenceNodeOfSequenceOfMesh.hxx" +#define Handle_TCollection_SequenceNode Handle_SMDS_SequenceNodeOfSequenceOfMesh +#define TCollection_SequenceNode_Type_() SMDS_SequenceNodeOfSequenceOfMesh_Type_() +#define TCollection_Sequence SMDS_SequenceOfMesh +#define TCollection_Sequence_hxx "SMDS_SequenceOfMesh.hxx" +#include + diff --git a/src/SMDS/SMDS_SpacePosition.cdl b/src/SMDS/SMDS_SpacePosition.cdl new file mode 100644 index 000000000..4ffa80f2c --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.cdl @@ -0,0 +1,38 @@ +-- File: SMDS_SpacePosition.cdl +-- Created: Mon May 13 14:06:42 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class SpacePosition from SMDS inherits Position from SMDS + + ---Purpose: used to characterize a MeshNode with a 3D point + -- in space not related to any underlying geometry (CAD) + +uses + Pnt from gp + +is + + Create returns mutable SpacePosition; + ---Purpose: empty constructor. the coords are not set + + Create(x, y, z : Real) returns mutable SpacePosition; + + Create(aCoords : Pnt from gp) returns mutable SpacePosition; + + Coords(me) returns Pnt from gp is redefined virtual; + ---Purpose: returns the resulting 3d point to be set + -- in the MeshNode instance + + SetCoords(me: mutable; x, y, z : Real); + ---C++: inline + + SetCoords(me: mutable; aCoords : Pnt from gp); + ---C++: inline + +fields + myCoords : Pnt from gp; + +end SpacePosition; diff --git a/src/SMDS/SMDS_SpacePosition.cxx b/src/SMDS/SMDS_SpacePosition.cxx new file mode 100644 index 000000000..9ecc496f5 --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File: SMDS_SpacePosition.cxx +// Created: Mon May 13 14:19:18 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_SpacePosition.ixx" + +//======================================================================= +//function : SMDS_SpacePosition +//purpose : +//======================================================================= + +SMDS_SpacePosition::SMDS_SpacePosition() + :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(0.,0.,0.) +{ +} + +//======================================================================= +//function : SMDS_SpacePosition +//purpose : +//======================================================================= + +SMDS_SpacePosition::SMDS_SpacePosition(const Standard_Real x, + const Standard_Real y, + const Standard_Real z) + :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(x,y,z) +{ +} + +//======================================================================= +//function : SMDS_SpacePosition +//purpose : +//======================================================================= + +SMDS_SpacePosition::SMDS_SpacePosition(const gp_Pnt& aCoords) + :SMDS_Position(0,SMDS_TOP_3DSPACE),myCoords(aCoords) +{ +} + +//======================================================================= +//function : Coords +//purpose : +//======================================================================= + +gp_Pnt SMDS_SpacePosition::Coords() const +{ + return myCoords; +} diff --git a/src/SMDS/SMDS_SpacePosition.hxx b/src/SMDS/SMDS_SpacePosition.hxx new file mode 100644 index 000000000..3965d12c8 --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.hxx @@ -0,0 +1,109 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_SpacePosition_HeaderFile +#define _SMDS_SpacePosition_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_SpacePosition_HeaderFile +#include "Handle_SMDS_SpacePosition.hxx" +#endif + +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +class gp_Pnt; + + +class SMDS_SpacePosition : public SMDS_Position { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_SpacePosition(); +Standard_EXPORT SMDS_SpacePosition(const Standard_Real x,const Standard_Real y,const Standard_Real z); +Standard_EXPORT SMDS_SpacePosition(const gp_Pnt& aCoords); +Standard_EXPORT virtual gp_Pnt Coords() const; +Standard_EXPORT inline void SetCoords(const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT inline void SetCoords(const gp_Pnt& aCoords) ; +Standard_EXPORT ~SMDS_SpacePosition(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_SpacePosition_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +gp_Pnt myCoords; + + +}; + + +#include "SMDS_SpacePosition.lxx" + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_SpacePosition.ixx b/src/SMDS/SMDS_SpacePosition.ixx new file mode 100644 index 000000000..81fd053d6 --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_SpacePosition.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_SpacePosition::~SMDS_SpacePosition() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_SpacePosition_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_Position); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_Position); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_SpacePosition", + sizeof(SMDS_SpacePosition), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_SpacePosition) Handle(SMDS_SpacePosition)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_SpacePosition) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_SpacePosition))) { + _anOtherObject = Handle(SMDS_SpacePosition)((Handle(SMDS_SpacePosition)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_SpacePosition::DynamicType() const +{ + return STANDARD_TYPE(SMDS_SpacePosition) ; +} +Standard_Boolean SMDS_SpacePosition::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_SpacePosition) == AType || SMDS_Position::IsKind(AType)); +} +Handle_SMDS_SpacePosition::~Handle_SMDS_SpacePosition() {} + diff --git a/src/SMDS/SMDS_SpacePosition.jxx b/src/SMDS/SMDS_SpacePosition.jxx new file mode 100644 index 000000000..1ccf0c675 --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_SpacePosition_HeaderFile +#include "SMDS_SpacePosition.hxx" +#endif diff --git a/src/SMDS/SMDS_SpacePosition.lxx b/src/SMDS/SMDS_SpacePosition.lxx new file mode 100644 index 000000000..8291ba4ff --- /dev/null +++ b/src/SMDS/SMDS_SpacePosition.lxx @@ -0,0 +1,26 @@ +// File: SMDS_SpacePosition.lxx +// Created: Mon May 13 14:24:22 2002 +// Author: Jean-Michel BOULCOURT +// + +//======================================================================= +//function : SetCoords +//purpose : +//======================================================================= + +inline void SMDS_SpacePosition::SetCoords(const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + myCoords.SetCoord(x,y,z); +} + +//======================================================================= +//function : SetCoords +//purpose : +//======================================================================= + +inline void SMDS_SpacePosition::SetCoords(const gp_Pnt& aCoords) +{ + myCoords = aCoords; +} diff --git a/src/SMDS/SMDS_StdMapNode.gxx b/src/SMDS/SMDS_StdMapNode.gxx new file mode 100644 index 000000000..0cd96506c --- /dev/null +++ b/src/SMDS/SMDS_StdMapNode.gxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_StdMapNode.gxx has disappeared diff --git a/src/SMDS/SMDS_StdMapNode.lxx b/src/SMDS/SMDS_StdMapNode.lxx new file mode 100644 index 000000000..8aa1d0246 --- /dev/null +++ b/src/SMDS/SMDS_StdMapNode.lxx @@ -0,0 +1 @@ +#error /adv_21/KAS/C40/jmbsmds/inc/SMDS_StdMapNode.lxx has disappeared diff --git a/src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx b/src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx new file mode 100644 index 000000000..a8993b489 --- /dev/null +++ b/src/SMDS/SMDS_StdMapNodeOfExtendedMap.hxx @@ -0,0 +1,132 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_StdMapNodeOfExtendedMap_HeaderFile +#define _SMDS_StdMapNodeOfExtendedMap_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedMap.hxx" +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_MeshElement; +class SMDS_MeshElementMapHasher; +class SMDS_ExtendedMap; +class SMDS_MapIteratorOfExtendedMap; + + +class SMDS_StdMapNodeOfExtendedMap : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_StdMapNodeOfExtendedMap(const Handle(SMDS_MeshElement)& K,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMDS_MeshElement& Key() const; +Standard_EXPORT ~SMDS_StdMapNodeOfExtendedMap(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_StdMapNodeOfExtendedMap_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_MeshElement myKey; + + +}; + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_() +#define TCollection_Map SMDS_ExtendedMap +#define TCollection_Map_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_StdMapNode +#undef TCollection_StdMapNode_hxx +#undef TCollection_MapIterator +#undef TCollection_MapIterator_hxx +#undef Handle_TCollection_StdMapNode +#undef TCollection_StdMapNode_Type_ +#undef TCollection_Map +#undef TCollection_Map_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx b/src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx new file mode 100644 index 000000000..dab0485a4 --- /dev/null +++ b/src/SMDS/SMDS_StdMapNodeOfExtendedMap_0.cxx @@ -0,0 +1,97 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_StdMapNodeOfExtendedMap.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshElementMapHasher_HeaderFile +#include "SMDS_MeshElementMapHasher.hxx" +#endif +#ifndef _SMDS_ExtendedMap_HeaderFile +#include "SMDS_ExtendedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedMap.hxx" +#endif +SMDS_StdMapNodeOfExtendedMap::~SMDS_StdMapNodeOfExtendedMap() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_StdMapNodeOfExtendedMap_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_StdMapNodeOfExtendedMap", + sizeof(SMDS_StdMapNodeOfExtendedMap), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_StdMapNodeOfExtendedMap) Handle(SMDS_StdMapNodeOfExtendedMap)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_StdMapNodeOfExtendedMap) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_StdMapNodeOfExtendedMap))) { + _anOtherObject = Handle(SMDS_StdMapNodeOfExtendedMap)((Handle(SMDS_StdMapNodeOfExtendedMap)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_StdMapNodeOfExtendedMap::DynamicType() const +{ + return STANDARD_TYPE(SMDS_StdMapNodeOfExtendedMap) ; +} +Standard_Boolean SMDS_StdMapNodeOfExtendedMap::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_StdMapNodeOfExtendedMap) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_StdMapNodeOfExtendedMap::~Handle_SMDS_StdMapNodeOfExtendedMap() {} +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_() +#define TCollection_Map SMDS_ExtendedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap.hxx b/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap.hxx new file mode 100644 index 000000000..f5965d243 --- /dev/null +++ b/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap.hxx @@ -0,0 +1,132 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#define _SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_StdMapNodeOfExtendedOrientedMap_HeaderFile +#include "Handle_SMDS_StdMapNodeOfExtendedOrientedMap.hxx" +#endif + +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMDS_MeshElement; +class SMDS_MeshOrientedElementMapHasher; +class SMDS_ExtendedOrientedMap; +class SMDS_MapIteratorOfExtendedOrientedMap; + + +class SMDS_StdMapNodeOfExtendedOrientedMap : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMDS_StdMapNodeOfExtendedOrientedMap(const Handle(SMDS_MeshElement)& K,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMDS_MeshElement& Key() const; +Standard_EXPORT ~SMDS_StdMapNodeOfExtendedOrientedMap(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_StdMapNodeOfExtendedOrientedMap_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_MeshElement myKey; + + +}; + +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshOrientedElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +#define TCollection_Map SMDS_ExtendedOrientedMap +#define TCollection_Map_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_StdMapNode +#undef TCollection_StdMapNode_hxx +#undef TCollection_MapIterator +#undef TCollection_MapIterator_hxx +#undef Handle_TCollection_StdMapNode +#undef TCollection_StdMapNode_Type_ +#undef TCollection_Map +#undef TCollection_Map_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx b/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx new file mode 100644 index 000000000..aa6ffc198 --- /dev/null +++ b/src/SMDS/SMDS_StdMapNodeOfExtendedOrientedMap_0.cxx @@ -0,0 +1,97 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_StdMapNodeOfExtendedOrientedMap.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshOrientedElementMapHasher_HeaderFile +#include "SMDS_MeshOrientedElementMapHasher.hxx" +#endif +#ifndef _SMDS_ExtendedOrientedMap_HeaderFile +#include "SMDS_ExtendedOrientedMap.hxx" +#endif +#ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile +#include "SMDS_MapIteratorOfExtendedOrientedMap.hxx" +#endif +SMDS_StdMapNodeOfExtendedOrientedMap::~SMDS_StdMapNodeOfExtendedOrientedMap() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_StdMapNodeOfExtendedOrientedMap", + sizeof(SMDS_StdMapNodeOfExtendedOrientedMap), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_StdMapNodeOfExtendedOrientedMap) Handle(SMDS_StdMapNodeOfExtendedOrientedMap)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_StdMapNodeOfExtendedOrientedMap) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_StdMapNodeOfExtendedOrientedMap))) { + _anOtherObject = Handle(SMDS_StdMapNodeOfExtendedOrientedMap)((Handle(SMDS_StdMapNodeOfExtendedOrientedMap)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_StdMapNodeOfExtendedOrientedMap::DynamicType() const +{ + return STANDARD_TYPE(SMDS_StdMapNodeOfExtendedOrientedMap) ; +} +Standard_Boolean SMDS_StdMapNodeOfExtendedOrientedMap::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_StdMapNodeOfExtendedOrientedMap) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMDS_StdMapNodeOfExtendedOrientedMap::~Handle_SMDS_StdMapNodeOfExtendedOrientedMap() {} +#define TheKey Handle_SMDS_MeshElement +#define TheKey_hxx +#define Hasher SMDS_MeshOrientedElementMapHasher +#define Hasher_hxx +#define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_hxx +#define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap +#define TCollection_MapIterator_hxx +#define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap +#define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_() +#define TCollection_Map SMDS_ExtendedOrientedMap +#define TCollection_Map_hxx +#include + diff --git a/src/SMDS/SMDS_TypeOfPosition.hxx b/src/SMDS/SMDS_TypeOfPosition.hxx new file mode 100644 index 000000000..ec2330dbf --- /dev/null +++ b/src/SMDS/SMDS_TypeOfPosition.hxx @@ -0,0 +1,31 @@ +// File generated by CPPExt (Enum) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_TypeOfPosition_HeaderFile +#define _SMDS_TypeOfPosition_HeaderFile + +enum SMDS_TypeOfPosition { + SMDS_TOP_UNSPEC, +SMDS_TOP_3DSPACE, +SMDS_TOP_VERTEX, +SMDS_TOP_EDGE, +SMDS_TOP_FACE +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/SMDS/SMDS_VertexPosition.cdl b/src/SMDS/SMDS_VertexPosition.cdl new file mode 100644 index 000000000..cace01059 --- /dev/null +++ b/src/SMDS/SMDS_VertexPosition.cdl @@ -0,0 +1,26 @@ +-- File: SMDS_VertexPosition.cdl +-- Created: Mon May 13 14:39:09 2002 +-- Author: Jean-Michel BOULCOURT +-- +---Copyright: Matra Datavision 2002 + + +class VertexPosition from SMDS inherits Position from SMDS + + ---Purpose: used to characterize a MeshNode with a CAD vertex + +uses + Pnt from gp + +is + + Create returns mutable VertexPosition; + ---Purpose: empty constructor. the vertex is not set + + Create(aVertexId : Integer) returns mutable VertexPosition; + + Coords(me) returns Pnt from gp is redefined virtual; + ---Purpose: returns the resulting 3d point to be set + -- in the MeshNode instance + +end VertexPosition; diff --git a/src/SMDS/SMDS_VertexPosition.cxx b/src/SMDS/SMDS_VertexPosition.cxx new file mode 100644 index 000000000..837e1140f --- /dev/null +++ b/src/SMDS/SMDS_VertexPosition.cxx @@ -0,0 +1,41 @@ +using namespace std; +// File: SMDS_VertexPosition.cxx +// Created: Mon May 13 14:41:57 2002 +// Author: Jean-Michel BOULCOURT +// + + +#include "SMDS_VertexPosition.ixx" +#include "utilities.h" + +//======================================================================= +//function : SMDS_VertexPosition +//purpose : +//======================================================================= + +SMDS_VertexPosition::SMDS_VertexPosition() + :SMDS_Position(0,SMDS_TOP_VERTEX) +{ +} + +//======================================================================= +//function : SMDS_VertexPosition +//purpose : +//======================================================================= + +SMDS_VertexPosition::SMDS_VertexPosition(const Standard_Integer aVertexId) + :SMDS_Position(aVertexId,SMDS_TOP_VERTEX) +{ +} + + +//======================================================================= +//function : Coords +//purpose : +//======================================================================= + +gp_Pnt SMDS_VertexPosition::Coords() const +{ + MESSAGE( "SMDS_VertexPosition::Coords not implemented" ); + return gp_Pnt(0,0,0); +} diff --git a/src/SMDS/SMDS_VertexPosition.hxx b/src/SMDS/SMDS_VertexPosition.hxx new file mode 100644 index 000000000..c63910952 --- /dev/null +++ b/src/SMDS/SMDS_VertexPosition.hxx @@ -0,0 +1,101 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMDS_VertexPosition_HeaderFile +#define _SMDS_VertexPosition_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_VertexPosition_HeaderFile +#include "Handle_SMDS_VertexPosition.hxx" +#endif + +#ifndef _SMDS_Position_HeaderFile +#include "SMDS_Position.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class gp_Pnt; + + +class SMDS_VertexPosition : public SMDS_Position { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMDS_VertexPosition(); +Standard_EXPORT SMDS_VertexPosition(const Standard_Integer aVertexId); +Standard_EXPORT virtual gp_Pnt Coords() const; +Standard_EXPORT ~SMDS_VertexPosition(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMDS_VertexPosition_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMDS/SMDS_VertexPosition.ixx b/src/SMDS/SMDS_VertexPosition.ixx new file mode 100644 index 000000000..2ecf51228 --- /dev/null +++ b/src/SMDS/SMDS_VertexPosition.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMDS_VertexPosition.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMDS_VertexPosition::~SMDS_VertexPosition() {} + + + +Standard_EXPORT Handle_Standard_Type& SMDS_VertexPosition_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_Position); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_Position); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMDS_VertexPosition", + sizeof(SMDS_VertexPosition), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMDS_VertexPosition) Handle(SMDS_VertexPosition)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMDS_VertexPosition) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMDS_VertexPosition))) { + _anOtherObject = Handle(SMDS_VertexPosition)((Handle(SMDS_VertexPosition)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMDS_VertexPosition::DynamicType() const +{ + return STANDARD_TYPE(SMDS_VertexPosition) ; +} +Standard_Boolean SMDS_VertexPosition::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMDS_VertexPosition) == AType || SMDS_Position::IsKind(AType)); +} +Handle_SMDS_VertexPosition::~Handle_SMDS_VertexPosition() {} + diff --git a/src/SMDS/SMDS_VertexPosition.jxx b/src/SMDS/SMDS_VertexPosition.jxx new file mode 100644 index 000000000..d05b7369e --- /dev/null +++ b/src/SMDS/SMDS_VertexPosition.jxx @@ -0,0 +1,6 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _SMDS_VertexPosition_HeaderFile +#include "SMDS_VertexPosition.hxx" +#endif diff --git a/src/SMESH/Makefile.in b/src/SMESH/Makefile.in new file mode 100644 index 000000000..cfad95772 --- /dev/null +++ b/src/SMESH/Makefile.in @@ -0,0 +1,81 @@ +#============================================================================== +# File : Makefile.in +# Created : lun mai 6 13:33:11 CEST 2002 +# Author : Paul RASCLE, EDF +# Project : SALOME +# Copyright : EDF 2002 +# $Header$ +#============================================================================== + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= \ + SMESH_Gen.hxx \ + SMESH_Mesh.hxx \ + SMESH_subMesh.hxx \ + SMESH_Hypothesis.hxx \ + SMESH_HypothesisFactory.hxx \ + SMESH_Algo.hxx \ + SMESH_1D_Algo.hxx \ + SMESH_2D_Algo.hxx \ + SMESH_3D_Algo.hxx \ + SMESH_NumberOfSegments.hxx \ + SMESH_LocalLength.hxx \ + SMESH_LengthFromEdges.hxx \ + SMESH_MaxElementArea.hxx \ + SMESH_MaxElementVolume.hxx \ + SMESH_Regular_1D.hxx \ + SMESH_Quadrangle_2D.hxx \ + SMESH_MEFISTO_2D.hxx \ + SMESH_Hexa_3D.hxx \ + SMESH_HypothesisCreator.hxx + +EXPORT_PYSCRIPTS = + +# Libraries targets + +LIB= libSMESHimpl.la + +LIB_SRC = SMESH_Gen.cxx SMESH_Mesh.cxx SMESH_subMesh.cxx \ + SMESH_Hypothesis.cxx \ + SMESH_HypothesisFactory.cxx \ + SMESH_Algo.cxx \ + SMESH_1D_Algo.cxx \ + SMESH_2D_Algo.cxx \ + SMESH_3D_Algo.cxx \ + SMESH_NumberOfSegments.cxx \ + SMESH_LocalLength.cxx \ + SMESH_LengthFromEdges.cxx \ + SMESH_MaxElementArea.cxx \ + SMESH_MaxElementVolume.cxx \ + SMESH_Regular_1D.cxx \ + SMESH_Quadrangle_2D.cxx \ + SMESH_MEFISTO_2D.cxx \ + SMESH_Hexa_3D.cxx + +LIB_SERVER_IDL = + +LIB_CLIENT_IDL = + +# Executables targets +BIN = +BIN_SRC = + +# additionnal information to compil and link file +CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) +CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) + +#IDLCXXFLAGS+= -Wbtp + +LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV + +@CONCLUDE@ + diff --git a/src/SMESH/SMESH_1D_Algo.cxx b/src/SMESH/SMESH_1D_Algo.cxx new file mode 100644 index 000000000..0ccd5c7ae --- /dev/null +++ b/src/SMESH/SMESH_1D_Algo.cxx @@ -0,0 +1,82 @@ +using namespace std; +//============================================================================= +// File : SMESH_1D_Algo.cxx +// Created : sam mai 18 09:22:56 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_1D_Algo.hxx" +#include "SMESH_Gen.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_1D_bidon"); + _type = ALGO_1D; + gen->_map1D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo::~SMESH_1D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_1D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_1D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_1D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_1D_Algo & hyp) +{ + return load; +} + diff --git a/src/SMESH/SMESH_1D_Algo.hxx b/src/SMESH/SMESH_1D_Algo.hxx new file mode 100644 index 000000000..ad8278107 --- /dev/null +++ b/src/SMESH/SMESH_1D_Algo.hxx @@ -0,0 +1,30 @@ +//============================================================================= +// File : SMESH_1D_Algo.hxx +// Created : sam mai 18 09:23:02 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_1D_ALGO_HXX_ +#define _SMESH_1D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" + +class SMESH_1D_Algo: + public SMESH_Algo +{ +public: + SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_1D_Algo(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_1D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_1D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_2D_Algo.cxx b/src/SMESH/SMESH_2D_Algo.cxx new file mode 100644 index 000000000..f42d78a6b --- /dev/null +++ b/src/SMESH/SMESH_2D_Algo.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_2D_Algo.cxx +// Created : sam mai 18 09:23:44 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_2D_bidon"); + _type = ALGO_2D; + gen->_map2D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo::~SMESH_2D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_2D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_2D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_2D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_2D_Algo & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S) +{ + int i = 0; + for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next()) + i++; + return i; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W) +{ + int nbPoints = 0; + for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nb); + nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?) + } + //SCRUTE(nbPoints); + return nbPoints; +} diff --git a/src/SMESH/SMESH_2D_Algo.hxx b/src/SMESH/SMESH_2D_Algo.hxx new file mode 100644 index 000000000..30bcc86ac --- /dev/null +++ b/src/SMESH/SMESH_2D_Algo.hxx @@ -0,0 +1,34 @@ +//============================================================================= +// File : SMESH_2D_Algo.hxx +// Created : sam mai 18 09:23:37 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_2D_ALGO_HXX_ +#define _SMESH_2D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" +#include + +class SMESH_2D_Algo: + public SMESH_Algo +{ +public: + SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_2D_Algo(); + + int NumberOfWires(const TopoDS_Shape& S); + int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_2D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_2D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_3D_Algo.cxx b/src/SMESH/SMESH_3D_Algo.cxx new file mode 100644 index 000000000..0ddc26b1f --- /dev/null +++ b/src/SMESH/SMESH_3D_Algo.cxx @@ -0,0 +1,83 @@ +using namespace std; +//============================================================================= +// File : SMESH_3D_Algo.cxx +// Created : sam mai 18 09:24:52 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_3D_bidon"); + _type = ALGO_3D; + gen->_map3D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo::~SMESH_3D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_3D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_3D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_3D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_3D_Algo & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_3D_Algo.hxx b/src/SMESH/SMESH_3D_Algo.hxx new file mode 100644 index 000000000..9b3ca0b06 --- /dev/null +++ b/src/SMESH/SMESH_3D_Algo.hxx @@ -0,0 +1,30 @@ +//============================================================================= +// File : SMESH_3D_Algo.hxx +// Created : sam mai 18 09:24:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_3D_ALGO_HXX_ +#define _SMESH_3D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" + +class SMESH_3D_Algo: + public SMESH_Algo +{ +public: + SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_3D_Algo(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_3D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_3D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx new file mode 100644 index 000000000..5fc603231 --- /dev/null +++ b/src/SMESH/SMESH_Algo.cxx @@ -0,0 +1,224 @@ +using namespace std; +//============================================================================= +// File : SMESH_Algo.cxx +// Created : sam mai 18 09:20:53 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Algo.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" + +#include +#include +#include + +#include "utilities.h" + +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo::SMESH_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_bidon"); + _type = ALGO; + gen->_mapAlgo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo::~SMESH_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const vector & SMESH_Algo::GetCompatibleHypothesis() +{ + return _compatibleHypothesis; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_Algo & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Algo::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Algo::CheckHypothesis"); + ASSERT(0); // use method from derived classes + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Algo::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Algo::Compute"); + ASSERT(0); // use method from derived classes + return false; +} + +//============================================================================= +/*! + * List the hypothesis used by the algorithm associated to the shape. + * Hypothesis associated to father shape -are- taken into account (see + * GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in + * the algorithm. This method could be surcharged by specific algorithms, in + * case of several hypothesis simultaneously applicable. + */ +//============================================================================= + +const list& +SMESH_Algo::GetUsedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + _usedHypList.clear(); + _usedHypList = GetAppliedHypothesis(aMesh, aShape); // copy + int nbHyp = _usedHypList.size(); + if (nbHyp == 0) + { + TopoDS_Shape mainShape = aMesh.GetMeshDS()->ShapeToMesh(); + if (!mainShape.IsSame(aShape)) + { + _usedHypList = GetAppliedHypothesis(aMesh, mainShape); // copy + nbHyp = _usedHypList.size(); + } + } + if (nbHyp > 1) _usedHypList.clear(); //only one compatible hypothesis allowed + return _usedHypList; +} + +//============================================================================= +/*! + * List the relevant hypothesis associated to the shape. Relevant hypothesis + * have a name (type) listed in the algorithm. Hypothesis associated to + * father shape -are not- taken into account (see GetUsedHypothesis) + */ +//============================================================================= + +const list& +SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + const SMESHDS_ListOfPtrHypothesis& listHyp = meshDS->GetHypothesis(aShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + + int hypType; + string hypName; + + _appliedHypList.clear(); + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + hypType = anHyp->GetType(); + //SCRUTE(hypType); + if (hypType == SMESHDS_Hypothesis::PARAM_ALGO) + { + hypName = anHyp->GetName(); + vector::iterator ith = find(_compatibleHypothesis.begin(), + _compatibleHypothesis.end(), + hypName); + if (ith != _compatibleHypothesis.end()) // count only relevant + { + _appliedHypList.push_back(anHyp); + //SCRUTE(hypName); + } + } + it.Next(); + } + return _appliedHypList; +} + + +//============================================================================= +/*! + * Compute length of an edge + */ +//============================================================================= + +double SMESH_Algo::EdgeLength(const TopoDS_Edge& E) +{ + double UMin = 0, UMax = 0; + TopLoc_Location L; + if (BRep_Tool::Degenerated(E)) return 0; + Handle (Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax); + GeomAdaptor_Curve AdaptCurve(C); + GCPnts_AbscissaPoint gabs; + double length = gabs.Length(AdaptCurve, UMin, UMax); + return length; +} + diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx new file mode 100644 index 000000000..de6c67162 --- /dev/null +++ b/src/SMESH/SMESH_Algo.hxx @@ -0,0 +1,60 @@ +//============================================================================= +// File : SMESH_Algo.hxx +// Created : sam mai 18 09:20:46 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_ALGO_HXX_ +#define _SMESH_ALGO_HXX_ + +#include "SMESH_Hypothesis.hxx" + +#include +#include + +#include +#include +#include + +class SMESH_gen; +class SMESH_Mesh; + +class SMESH_Algo: + public SMESH_Hypothesis +{ +public: + SMESH_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Algo(); + + const vector & GetCompatibleHypothesis(); + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual const list& + GetUsedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + const list& + GetAppliedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + static double EdgeLength(const TopoDS_Edge& E); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_Algo & hyp); + +protected: + vector _compatibleHypothesis; + list _appliedHypList; + list _usedHypList; +}; + +#endif diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx new file mode 100644 index 000000000..e6ed980b4 --- /dev/null +++ b/src/SMESH/SMESH_Gen.cxx @@ -0,0 +1,390 @@ +using namespace std; +//============================================================================= +// File : SMESH_Gen.cxx +// Created : sam mai 18 09:34:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Gen.hxx" + +#include "SMESH_subMesh.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" + +#include +#include + +#include "utilities.h" +#include "OpUtil.hxx" + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +SMESH_Gen::SMESH_Gen() +{ + MESSAGE("SMESH_Gen::SMESH_Gen"); + _localId = 0; + _hypothesisFactory.SetGen(this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Gen::~SMESH_Gen() +{ + MESSAGE("SMESH_Gen::~SMESH_Gen"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis* SMESH_Gen::CreateHypothesis(const char* anHyp, + int studyId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::CreateHypothesis"); + + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + StudyContextStruct* myStudyContext = GetStudyContext(studyId); + + // create a new hypothesis object, store its ref. in studyContext + + SMESH_Hypothesis* myHypothesis = _hypothesisFactory.Create(anHyp, studyId); + int hypId = myHypothesis->GetID(); + myStudyContext->mapHypothesis[hypId] = myHypothesis; + SCRUTE(studyId); + SCRUTE(hypId); + + // store hypothesis in SMESHDS document + + myStudyContext->myDocument->AddHypothesis(myHypothesis); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh* SMESH_Gen::Init(int studyId, const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::Init"); +// if (aShape.ShapeType() == TopAbs_COMPOUND) +// { +// INFOS("Mesh Compound not yet implemented!"); +// throw(SALOME_Exception(LOCALIZED("Mesh Compound not yet implemented!"))); +// } + + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + StudyContextStruct* myStudyContext = GetStudyContext(studyId); + + // create a new SMESH_mesh object + + SMESH_Mesh* mesh = new SMESH_Mesh(_localId++, + studyId, + this, + myStudyContext->myDocument); + myStudyContext->mapMesh[_localId] = mesh; + + // associate a TopoDS_Shape to the mesh + + mesh->ShapeToMesh(aShape); + return mesh; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Gen::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::Compute"); +// bool isDone = false; +/* +Algo : s'appuie ou non sur une geometrie +Si geometrie: +Vertex : rien à faire (range le point) +Edge, Wire, collection d'edge et wire : 1D +Face, Shell, collection de Face et Shells : 2D +Solid, Collection de Solid : 3D +*/ +// *** corriger commentaires + // check hypothesis associated to the mesh : + // - only one algo : type compatible with the type of the shape + // - hypothesis = compatible with algo + // - check if hypothesis are applicable to this algo + // - check contradictions within hypothesis + // (test if enough hypothesis is done further) + + bool ret = true; + + SMESH_subMesh* sm = aMesh.GetSubMesh(aShape); +// SCRUTE(sm); + SMESH_subMesh* smToCompute = sm->GetFirstToCompute(); + while (smToCompute) + { + TopoDS_Shape subShape = smToCompute->GetSubShape(); + int dim = GetShapeDim(subShape); + //SCRUTE(dim); + if (dim > 0) + { + bool ret1 = smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE); + ret = ret && ret1; + } + else + { + ASSERT(dim == 0); + ASSERT(smToCompute->_vertexSet == false); + TopoDS_Vertex V1 = TopoDS::Vertex(subShape); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + int nodeId = meshDS->AddNode(P1.X(), P1.Y(), P1.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnVertex(node, V1); + const Handle(SMESHDS_SubMesh)& subMeshDS + = smToCompute->GetSubMeshDS(); + smToCompute->_vertexSet = true; + bool ret1 = smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE); + } + smToCompute = sm->GetFirstToCompute(); + } + + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo* SMESH_Gen::GetAlgo(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Gen::GetAlgo"); + + SMESHDS_Hypothesis* theHyp = NULL; + SMESH_Algo* algo = NULL; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + int hypType; + int hypId; + int algoDim; + + // try shape first, then main shape + + TopoDS_Shape mainShape = meshDS->ShapeToMesh(); + const TopoDS_Shape* shapeToTry[2] = {&aShape, &mainShape}; + + for (int iShape=0; iShape<2; iShape++) + { + TopoDS_Shape tryShape = (*shapeToTry[iShape]); + + const SMESHDS_ListOfPtrHypothesis& listHyp + = meshDS->GetHypothesis(tryShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + + int nb_algo = 0; + int shapeDim = GetShapeDim(aShape); + int typeOfShape = aShape.ShapeType(); + + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + hypType = anHyp->GetType(); +// SCRUTE(hypType); + if (hypType > SMESHDS_Hypothesis::PARAM_ALGO) + { + switch (hypType) + { + case SMESHDS_Hypothesis::ALGO_1D: algoDim=1; break; + case SMESHDS_Hypothesis::ALGO_2D: algoDim=2; break; + case SMESHDS_Hypothesis::ALGO_3D: algoDim=3; break; + default: algoDim=0; break; + } +// SCRUTE(algoDim); +// SCRUTE(shapeDim); +// SCRUTE(typeOfShape); + if (shapeDim == algoDim) // count only algos of shape dim. + { // discard algos for subshapes + hypId = anHyp->GetID(); // (of lower dim.) + ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); + SMESH_Algo* anAlgo = _mapAlgo[hypId]; + //SCRUTE(anAlgo->GetShapeType()); +// if (anAlgo->GetShapeType() == typeOfShape) + if ((anAlgo->GetShapeType()) & (1 << typeOfShape)) + { // only specific TopoDS_Shape + nb_algo++; + theHyp = anHyp; + } + } + } + if (nb_algo > 1) return NULL; // more than one algo + it.Next(); + } + if (nb_algo == 1) // one algo found : OK + break; // do not try a parent shape + } + + if (!theHyp) return NULL; // no algo found + + hypType = theHyp->GetType(); + hypId = theHyp->GetID(); + + ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); + algo = _mapAlgo[hypId]; + const char* algoName = algo->GetName(); + //MESSAGE("Algo found " << algoName << " Id " << hypId); + return algo; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +StudyContextStruct* SMESH_Gen::GetStudyContext(int studyId) +{ + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) + { + _mapStudyContext[studyId] = new StudyContextStruct; + _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); + } + StudyContextStruct* myStudyContext = _mapStudyContext[studyId]; +// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end()); + return myStudyContext; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Save(int studyId, const char *aUrlOfFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Load(int studyId, const char *aUrlOfFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Close(int studyId) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::ComponentDataType() +{ +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::IORToLocalPersistentID(const char* IORString, + bool& IsAFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::LocalPersistentIDToIOR(const char* aLocalPersistentID) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Gen::GetShapeDim(const TopoDS_Shape& aShape) +{ + int shapeDim = -1; // Shape dimension: 0D, 1D, 2D, 3D + int type = aShape.ShapeType(); + switch (type) + { +// case TopAbs_COMPOUND: +// { +// break; +// } + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + case TopAbs_SOLID: + case TopAbs_SHELL: + { + shapeDim = 3; + break; + } + // case TopAbs_SHELL: + case TopAbs_FACE: + { + shapeDim = 2; + break; + } + case TopAbs_WIRE: + case TopAbs_EDGE: + { + shapeDim = 1; + break; + } + case TopAbs_VERTEX: + { + shapeDim = 0; + break; + } + } +// SCRUTE(shapeDim); + return shapeDim; +} diff --git a/src/SMESH/SMESH_Gen.hxx b/src/SMESH/SMESH_Gen.hxx new file mode 100644 index 000000000..c74d398bf --- /dev/null +++ b/src/SMESH/SMESH_Gen.hxx @@ -0,0 +1,76 @@ +//============================================================================= +// File : SMESH_Gen.hxx +// Created : jeu mai 16 22:53:13 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_GEN_HXX_ +#define _SMESH_GEN_HXX_ + +#include "Utils_SALOME_Exception.hxx" + +#include "SMESH_HypothesisFactory.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Algo.hxx" +#include "SMESH_1D_Algo.hxx" +#include "SMESH_2D_Algo.hxx" +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESHDS_Document.hxx" + +#include + +#include + +typedef struct studyContextStruct +{ + map mapHypothesis; + map mapMesh; + Handle (SMESHDS_Document) myDocument; +} StudyContextStruct ; + +class SMESH_Gen +{ +public: + SMESH_Gen(); + ~SMESH_Gen(); + + SMESH_Hypothesis* CreateHypothesis(const char* anHyp, int studyId) + throw (SALOME_Exception); + SMESH_Mesh* Init(int studyId, const TopoDS_Shape& aShape) + throw (SALOME_Exception); + bool Compute(::SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) + throw (SALOME_Exception); + StudyContextStruct* GetStudyContext(int studyId); + + static int GetShapeDim(const TopoDS_Shape& aShape); + SMESH_Algo* GetAlgo(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + // inherited methods from SALOMEDS::Driver + + void Save(int studyId, const char *aUrlOfFile); + void Load(int studyId, const char *aUrlOfFile); + void Close(int studyId); + const char* ComponentDataType(); + + const char* IORToLocalPersistentID(const char* IORString, bool& IsAFile); + const char* LocalPersistentIDToIOR(const char* aLocalPersistentID); + + SMESH_HypothesisFactory _hypothesisFactory; + + map _mapAlgo; + map _map1D_Algo; + map _map2D_Algo; + map _map3D_Algo; + +private: + int _localId; // unique Id of created objects, within SMESH_Gen entity + map _mapStudyContext; + map _mapHypothesis; +}; + +#endif diff --git a/src/SMESH/SMESH_Hexa_3D.cxx b/src/SMESH/SMESH_Hexa_3D.cxx new file mode 100644 index 000000000..fb4578780 --- /dev/null +++ b/src/SMESH/SMESH_Hexa_3D.cxx @@ -0,0 +1,960 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hexa_3D.cxx +// Created : sam mai 18 23:15:30 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hexa_3D.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_FacePosition.hxx" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D::SMESH_Hexa_3D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Hexa_3D::SMESH_Hexa_3D"); + _name = "Hexa_3D"; +// _shapeType = TopAbs_SOLID; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type +// MESSAGE("_shapeType octal " << oct << _shapeType); + for (int i=0; i<6; i++) _quads[i] = 0; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D::~SMESH_Hexa_3D() +{ + MESSAGE("SMESH_Hexa_3D::~SMESH_Hexa_3D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Hexa_3D::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Hexa_3D::CheckHypothesis"); + + bool isOk = true; + + // nothing to check + + return isOk; +} + +//============================================================================= +/*! + * Hexahedron mesh on hexaedron like form + * -0. - shape and face mesh verification + * -1. - identify faces and vertices of the "cube" + * -2. - Algorithm from: + * "Application de l'interpolation transfinie à la création de maillages + * C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres + * et hexaedres déformés." + * Alain PERONNET - 8 janvier 1999 + */ +//============================================================================= + +bool SMESH_Hexa_3D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Hexa_3D::Compute"); + + bool isOk = false; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS(); + + // 0. - shape and face mesh verification + // 0.1 - shape must be a solid (or a shell) with 6 faces + MESSAGE("---"); + + vector meshFaces; + for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) + { + SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); + ASSERT (aSubMesh); + meshFaces.push_back(aSubMesh); + } + if (meshFaces.size() != 6) + { + SCRUTE(meshFaces.size()); + ASSERT(0); + return false; + } + + // 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges) + MESSAGE("---"); + + for (int i=0; i<6; i++) + { + TopoDS_Shape aShape = meshFaces[i]->GetSubShape(); + SMESH_Algo* algo = _gen->GetAlgo(aMesh, aShape); + string algoName = algo->GetName(); + if (algoName != "Quadrangle_2D") + { + // *** delete _quads + SCRUTE(algoName); + ASSERT(0); + return false; + } + SMESH_Quadrangle_2D* quadAlgo =dynamic_cast (algo); + ASSERT(quadAlgo); + try + { + _quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aShape); + // *** to delete after usage + } + catch (SALOME_Exception& S_ex) + { + // *** delete _quads + // *** throw exception + ASSERT(0); + } + } + + // 1. - identify faces and vertices of the "cube" + // 1.1 - ancestor maps vertex->edges in the cube + MESSAGE("---"); + + TopTools_IndexedDataMapOfShapeListOfShape MS; + TopExp::MapShapesAndAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, MS); + + // 1.2 - first face is choosen as face Y=0 of the unit cube + MESSAGE("---"); + + const TopoDS_Shape& aFace = meshFaces[0]->GetSubShape(); + const TopoDS_Face& F = TopoDS::Face(aFace); + + // 1.3 - identify the 4 vertices of the face Y=0: V000, V100, V101, V001 + MESSAGE("---"); + + int i = 0; + TopoDS_Edge E = _quads[0]->edge[i]; //edge will be Y=0,Z=0 on unit cube + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + bool isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + + if (isForward) + { + _cube.V000 = VFirst; // will be (0,0,0) on the unit cube + _cube.V100 = VLast; // will be (1,0,0) on the unit cube + } + else + { + _cube.V000 = VLast; + _cube.V100 = VFirst; + } + + i = 1; + E = _quads[0]->edge[i]; + C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopExp::Vertices(E, VFirst, VLast); + isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + if (isForward) _cube.V101 = VLast; // will be (1,0,1) on the unit cube + else _cube.V101 = VFirst; + + i = 2; + E = _quads[0]->edge[i]; + C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopExp::Vertices(E, VFirst, VLast); + isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + if (isForward) _cube.V001 = VLast; // will be (0,0,1) on the unit cube + else _cube.V001 = VFirst; + + // 1.4 - find edge X=0, Z=0 (ancestor of V000 not in face Y=0) + // - find edge X=1, Z=0 (ancestor of V100 not in face Y=0) + // - find edge X=1, Z=1 (ancestor of V101 not in face Y=0) + // - find edge X=0, Z=1 (ancestor of V001 not in face Y=0) + MESSAGE("---"); + + TopoDS_Edge E_0Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V000, MS); + ASSERT(! E_0Y0.IsNull()); + + TopoDS_Edge E_1Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V100, MS); + ASSERT(! E_1Y0.IsNull()); + + TopoDS_Edge E_1Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V101, MS); + ASSERT(! E_1Y1.IsNull()); + + TopoDS_Edge E_0Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V001, MS); + ASSERT(! E_0Y1.IsNull()); + + // 1.5 - identify the 4 vertices in face Y=1: V010, V110, V111, V011 + MESSAGE("---"); + + TopExp::Vertices(E_0Y0, VFirst, VLast); + if (VFirst.IsSame(_cube.V000)) _cube.V010 = VLast; + else _cube.V010 = VFirst; + + TopExp::Vertices(E_1Y0, VFirst, VLast); + if (VFirst.IsSame(_cube.V100)) _cube.V110 = VLast; + else _cube.V110 = VFirst; + + TopExp::Vertices(E_1Y1, VFirst, VLast); + if (VFirst.IsSame(_cube.V101)) _cube.V111 = VLast; + else _cube.V111 = VFirst; + + TopExp::Vertices(E_0Y1, VFirst, VLast); + if (VFirst.IsSame(_cube.V001)) _cube.V011 = VLast; + else _cube.V011 = VFirst; + + // 1.6 - find remaining faces given 4 vertices + MESSAGE("---"); + + _indY0 = 0; + _cube.quad_Y0 = _quads[_indY0]; + + _indY1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V010,_cube.V011,_cube.V110,_cube.V111); + _cube.quad_Y1 = _quads[_indY1]; + + _indZ0 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V000,_cube.V010,_cube.V100,_cube.V110); + _cube.quad_Z0 = _quads[_indZ0]; + + _indZ1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V001,_cube.V011,_cube.V101,_cube.V111); + _cube.quad_Z1 = _quads[_indZ1]; + + _indX0 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V000,_cube.V001,_cube.V010,_cube.V011); + _cube.quad_X0 = _quads[_indX0]; + + _indX1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V100,_cube.V101,_cube.V110,_cube.V111); + _cube.quad_X1 = _quads[_indX1]; + + MESSAGE("---"); + + // 1.7 - get convertion coefs from face 2D normalized to 3D normalized + + Conv2DStruct cx0; // for face X=0 + Conv2DStruct cx1; // for face X=1 + Conv2DStruct cy0; + Conv2DStruct cy1; + Conv2DStruct cz0; + Conv2DStruct cz1; + + GetConv2DCoefs(*_cube.quad_X0, meshFaces[_indX0]->GetSubShape(), + _cube.V000,_cube.V010,_cube.V011,_cube.V001, + cx0); + GetConv2DCoefs(*_cube.quad_X1, meshFaces[_indX1]->GetSubShape(), + _cube.V100,_cube.V110,_cube.V111,_cube.V101, + cx1); + GetConv2DCoefs(*_cube.quad_Y0, meshFaces[_indY0]->GetSubShape(), + _cube.V000,_cube.V100,_cube.V101,_cube.V001, + cy0); + GetConv2DCoefs(*_cube.quad_Y1, meshFaces[_indY1]->GetSubShape(), + _cube.V010,_cube.V110,_cube.V111,_cube.V011, + cy1); + GetConv2DCoefs(*_cube.quad_Z0, meshFaces[_indZ0]->GetSubShape(), + _cube.V000,_cube.V100,_cube.V110,_cube.V010, + cz0); + GetConv2DCoefs(*_cube.quad_Z1, meshFaces[_indZ1]->GetSubShape(), + _cube.V001,_cube.V101,_cube.V111,_cube.V011, + cz1); + + // 1.8 - create a 3D structure for normalized values + + MESSAGE("---"); + int nbx = _cube.quad_Y0->nbPts[0]; + int nby = _cube.quad_Y0->nbPts[1]; + int nbz; + if (cx0.a1 != 0) nbz = _cube.quad_X0->nbPts[1]; + else nbz = _cube.quad_X0->nbPts[0]; + //SCRUTE(nbx); + //SCRUTE(nby); + //SCRUTE(nbz); + int nbxyz= nbx*nby*nbz; + Point3DStruct* np = new Point3DStruct[nbxyz]; + + // 1.9 - store node indexes of faces + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indX0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_X0; + int i=0; // j = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indX1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_X1; + int i=nbx-1; // j = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indY0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Y0; + int j=0; // i = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indY1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Y1; + int j=nby-1; // i = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indZ0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Z0; + int k=0; // i = x/face , j = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indZ1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Z1; + int k=nbz-1; // i = x/face , j = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + // 2.0 - for each node of the cube: + // - get the 8 points 3D = 8 vertices of the cube + // - get the 12 points 3D on the 12 edges of the cube + // - get the 6 points 3D on the 6 faces with their ID + // - compute the point 3D + // - store the point 3D in SMESHDS, store its ID in 3D structure + + TopoDS_Shell aShell; + TopExp_Explorer exp(aShape,TopAbs_SHELL); + if (exp.More()) + { + aShell = TopoDS::Shell(exp.Current()); + } + else + { + MESSAGE("no shell..."); + ASSERT(0); + } + + MESSAGE("---"); + Pt3 p000, p001, p010, p011, p100, p101, p110, p111; + Pt3 px00, px01, px10, px11; + Pt3 p0y0, p0y1, p1y0, p1y1; + Pt3 p00z, p01z, p10z, p11z; + Pt3 pxy0, pxy1, px0z, px1z, p0yz, p1yz; + + GetPoint(p000, 0, 0, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p001, 0, 0, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p010, 0, nby-1, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p011, 0, nby-1, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p100, nbx-1, 0, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p101, nbx-1, 0, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p110, nbx-1, nby-1, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p111, nbx-1, nby-1, nbz-1, nbx, nby, nbz, np, meshDS); + + for (int i=1; iAddNode(X[0],X[1],X[2]); + //MESSAGE("point "<FindNode(myNodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + + //meshDS->SetNodeInVolume(node, TopoDS::Solid(aShape)); + meshDS->SetNodeInVolume(node, aShell); + } + } + } + + //2.1 - for each node of the cube (less 3 *1 Faces): + // - store hexahedron in SMESHDS + + for (int i=0; iAddVolume(np[n1].nodeId, + np[n2].nodeId, + np[n3].nodeId, + np[n4].nodeId, + np[n5].nodeId, + np[n6].nodeId, + np[n7].nodeId, + np[n8].nodeId); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(hexa); + meshDS->SetMeshElementOnShape(elt, aShell); + + // *** 5 tetrahedres ... verifier orientations, + // mettre en coherence &vec quadrangles-> triangles + // choisir afficher 1 parmi edges, face et volumes +// int tetra1 = meshDS->AddVolume(np[n1].nodeId, +// np[n2].nodeId, +// np[n4].nodeId, +// np[n5].nodeId); +// int tetra2 = meshDS->AddVolume(np[n2].nodeId, +// np[n3].nodeId, +// np[n4].nodeId, +// np[n7].nodeId); +// int tetra3 = meshDS->AddVolume(np[n5].nodeId, +// np[n6].nodeId, +// np[n7].nodeId, +// np[n2].nodeId); +// int tetra4 = meshDS->AddVolume(np[n5].nodeId, +// np[n7].nodeId, +// np[n8].nodeId, +// np[n4].nodeId); +// int tetra5 = meshDS->AddVolume(np[n5].nodeId, +// np[n7].nodeId, +// np[n2].nodeId, +// np[n4].nodeId); + + } + + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Hexa_3D::GetPoint(Pt3 p, + int i, int j, int k, + int nbx, int nby, int nbz, + Point3DStruct *np, + const Handle(SMESHDS_Mesh)& meshDS) +{ + int ijk = k*nbx*nby + j*nbx + i; + int nodeId = np[ijk].nodeId; + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + p[0] = node->X(); + p[1] = node->Y(); + p[2] = node->Z(); + //MESSAGE(" "<& meshFaces, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3) +{ + MESSAGE("SMESH_Hexa_3D::GetFaceIndex"); + int faceIndex = -1; + for (int i=1; i<6; i++) + { + const TopoDS_Shape& aFace = meshFaces[i]->GetSubShape(); + //const TopoDS_Face& F = TopoDS::Face(aFace); + TopTools_IndexedMapOfShape M; + TopExp::MapShapes(aFace, TopAbs_VERTEX, M); + bool verticesInShape = false; + if (M.Contains(V0)) + if (M.Contains(V1)) + if (M.Contains(V2)) + if (M.Contains(V3)) verticesInShape = true; + if (verticesInShape) + { + faceIndex = i; + break; + } + } + ASSERT(faceIndex>0); + SCRUTE(faceIndex); + return faceIndex; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +TopoDS_Edge +SMESH_Hexa_3D::EdgeNotInFace(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const TopoDS_Face& aFace, + const TopoDS_Vertex& aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape& MS) +{ + MESSAGE("SMESH_Hexa_3D::EdgeNotInFace"); + TopTools_IndexedDataMapOfShapeListOfShape MF; + TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); + const TopTools_ListOfShape& ancestorsInSolid = MS.FindFromKey(aVertex); + const TopTools_ListOfShape& ancestorsInFace = MF.FindFromKey(aVertex); + SCRUTE(ancestorsInSolid.Extent()); + SCRUTE(ancestorsInFace.Extent()); + ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) + ASSERT(ancestorsInFace.Extent() == 2); + + TopoDS_Edge E; + E.Nullify(); + TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); + for ( ; its.More();its.Next()) + { + TopoDS_Shape ancestor = its.Value(); + TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); + bool isInFace = false; + for ( ; itf.More();itf.Next()) + { + TopoDS_Shape ancestorInFace = itf.Value(); + if (ancestorInFace.IsSame(ancestor)) + { + isInFace = true; + break; + } + } + if (! isInFace) + { + E = TopoDS::Edge(ancestor); + break; + } + } + return E; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + + void SMESH_Hexa_3D::GetConv2DCoefs(const faceQuadStruct& quad, + const TopoDS_Shape& aShape, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + Conv2DStruct& conv) +{ + MESSAGE("SMESH_Hexa_3D::GetConv2DCoefs"); + const TopoDS_Face& F = TopoDS::Face(aShape); + TopoDS_Edge E = quad.edge[0]; + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + bool isForward = (((l-f)*(quad.last[0] - quad.first[0])) > 0); + TopoDS_Vertex VA, VB; + if (isForward) + { + VA = VFirst; VB = VLast; + } + else + { + VA = VLast; VB = VFirst; + } + int a1,b1,c1,a2,b2,c2; + if (VA.IsSame(V0)) + if (VB.IsSame(V1)) + { + a1= 1; b1= 0; c1= 0; // x + a2= 0; b2= 1; c2= 0; // y + } + else + { + ASSERT(VB.IsSame(V3)); + a1= 0; b1= 1; c1= 0; // y + a2= 1; b2= 0; c2= 0; // x + } + if (VA.IsSame(V1)) + if (VB.IsSame(V2)) + { + a1= 0; b1=-1; c1= 1; // 1-y + a2= 1; b2= 0; c2= 0; // x + } + else + { + ASSERT(VB.IsSame(V0)); + a1=-1; b1= 0; c1= 1; // 1-x + a2= 0; b2= 1; c2= 0; // y + } + if (VA.IsSame(V2)) + if (VB.IsSame(V3)) + { + a1=-1; b1= 0; c1= 1; // 1-x + a2= 0; b2=-1; c2= 1; // 1-y + } + else + { + ASSERT(VB.IsSame(V1)); + a1= 0; b1=-1; c1= 1; // 1-y + a2=-1; b2= 0; c2= 1; // 1-x + } + if (VA.IsSame(V3)) + if (VB.IsSame(V0)) + { + a1= 0; b1= 1; c1= 0; // y + a2=-1; b2= 0; c2= 1; // 1-x + } + else + { + ASSERT(VB.IsSame(V2)); + a1= 1; b1= 0; c1= 0; // x + a2= 0; b2=-1; c2= 1; // 1-y + } + MESSAGE("X = "<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_Hexa_3D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_Hexa_3D & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_Hexa_3D.hxx b/src/SMESH/SMESH_Hexa_3D.hxx new file mode 100644 index 000000000..434ace0ea --- /dev/null +++ b/src/SMESH/SMESH_Hexa_3D.hxx @@ -0,0 +1,119 @@ +//============================================================================= +// File : SMESH_Hexa_3D.hxx +// Created : sam mai 18 23:15:26 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HEXA_3D_HXX_ +#define _SMESH_HEXA_3D_HXX_ + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "Utils_SALOME_Exception.hxx" + +typedef struct point3Dstruct +{ + int nodeId; +} Point3DStruct; + +typedef double Pt3[3]; + +typedef struct conv2dstruct +{ + double a1; // X = a1*x + b1*y + c1 + double b1; // Y = a2*x + b2*y + c2 + double c1; // a1, b1 a2, b2 in {-1,0,1} + double a2; // c1, c2 in {0,1} + double b2; + double c2; + int ia; // I = ia*i + ib*j + ic + int ib; + int ic; + int ja; // J = ja*i + jb*j + jc + int jb; + int jc; +} Conv2DStruct; + +typedef struct cubeStruct +{ + TopoDS_Vertex V000; + TopoDS_Vertex V001; + TopoDS_Vertex V010; + TopoDS_Vertex V011; + TopoDS_Vertex V100; + TopoDS_Vertex V101; + TopoDS_Vertex V110; + TopoDS_Vertex V111; + faceQuadStruct* quad_X0; + faceQuadStruct* quad_X1; + faceQuadStruct* quad_Y0; + faceQuadStruct* quad_Y1; + faceQuadStruct* quad_Z0; + faceQuadStruct* quad_Z1; + Point3DStruct* np; // normalised 3D coordinates +} CubeStruct; + +class SMESH_Hexa_3D: + public SMESH_3D_Algo +{ +public: + SMESH_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Hexa_3D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Hexa_3D & hyp); + friend istream & operator >> (istream & load, SMESH_Hexa_3D & hyp); + +protected: + TopoDS_Edge + EdgeNotInFace(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const TopoDS_Face& aFace, + const TopoDS_Vertex& aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape& MS); + + int GetFaceIndex(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const vector& meshFaces, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3); + + void GetConv2DCoefs(const faceQuadStruct& quad, + const TopoDS_Shape& aShape, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + Conv2DStruct& conv); + + void GetPoint(Pt3 p, + int i, int j, int k, + int nbx, int nby, int nbz, + Point3DStruct *np, + const Handle(SMESHDS_Mesh)& meshDS); + + CubeStruct _cube; + FaceQuadStruct* _quads[6]; + int _indX0; + int _indX1; + int _indY0; + int _indY1; + int _indZ0; + int _indZ1; +}; + +#endif diff --git a/src/SMESH/SMESH_Hypothesis.cxx b/src/SMESH/SMESH_Hypothesis.cxx new file mode 100644 index 000000000..fa092219f --- /dev/null +++ b/src/SMESH/SMESH_Hypothesis.cxx @@ -0,0 +1,116 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hypothesis.cxx +// Created : sam mai 18 08:08:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Gen.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis::SMESH_Hypothesis(int hypId, + int studyId, + SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId) +{ + //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis"); + _gen = gen; + _studyId = studyId; + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + myStudyContext->mapHypothesis[_hypId] = this; + _type = PARAM_ALGO; +// _shapeType = -1; // to be set by algo with TopAbs_Enum + _shapeType = 0; // to be set by algo with TopAbs_Enum +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis::~SMESH_Hypothesis() +{ + MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetDim() +{ + int dim = -1; + switch (_type) + { + case ALGO_1D: dim = 1; break; + case ALGO_2D: dim = 2; break; + case ALGO_3D: dim = 3; break; + } + return dim; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetShapeType() +{ + return _shapeType; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetStudyId() +{ + return _studyId; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Hypothesis::NotifySubMeshesHypothesisModification() +{ + MESSAGE("SMESH_Hypothesis::NotifySubMeshesHypothesisModification"); + + // for all meshes in study + + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + map::iterator itm; + for (itm = myStudyContext->mapMesh.begin(); + itm != myStudyContext->mapMesh.end(); + itm++) + { + SMESH_Mesh* mesh = (*itm).second; + const list& subMeshes = + mesh->GetSubMeshUsingHypothesis(this); + + //for all subMeshes using hypothesis + + list::const_iterator its; + for (its = subMeshes.begin(); its != subMeshes.end(); its++) + (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP); + } +} + diff --git a/src/SMESH/SMESH_Hypothesis.hxx b/src/SMESH/SMESH_Hypothesis.hxx new file mode 100644 index 000000000..03b50b972 --- /dev/null +++ b/src/SMESH/SMESH_Hypothesis.hxx @@ -0,0 +1,33 @@ +//============================================================================= +// File : SMESH_Hypothesis.hxx +// Created : sam mai 18 08:07:54 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESIS_HXX_ +#define _SMESH_HYPOTHESIS_HXX_ + +#include "SMESHDS_Hypothesis.hxx" + +class SMESH_Gen; + +class SMESH_Hypothesis: public SMESHDS_Hypothesis +{ +public: + SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Hypothesis(); + int GetDim(); + int GetStudyId(); + void NotifySubMeshesHypothesisModification(); + int GetShapeType(); + +protected: + SMESH_Gen* _gen; + int _studyId; + int _shapeType; +}; + +#endif diff --git a/src/SMESH/SMESH_HypothesisCreator.hxx b/src/SMESH/SMESH_HypothesisCreator.hxx new file mode 100644 index 000000000..e5a050cf1 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisCreator.hxx @@ -0,0 +1,49 @@ +//============================================================================= +// File : SMESH_HypothesisCreator.hxx +// Created : lun mai 27 15:28:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESISCREATOR_HXX_ +#define _SMESH_HYPOTHESISCREATOR_HXX_ + +#include "SMESH_HypothesisFactory.hxx" + +class SMESH_gen; + +//============================================================================= +/*! + * Specific Hypothesis Creators are generated with a template which inherits a + * generic hypothesis creator. Each creator returns an hypothesis of the type + * given in the template. + */ +//============================================================================= + +template class SMESH_HypothesisCreator + : public GenericHypothesisCreator +{ +public: +// map _instances; + +// virtual T* GetInstance(int hypId) +// { +// if (_instances.find(hypId) != _instances.end()) +// return _instances[hypId]; +// else +// return NULL; +// } + + virtual T* Create (int hypId, int studyId, SMESH_Gen* gen) + { + T* anInstance= new T(hypId, studyId, gen); +// _gen->StoreHypothesisInstance(anInstance); +// _instances[hypId] = anInstance; + return anInstance; + }; +}; + + +#endif diff --git a/src/SMESH/SMESH_HypothesisFactory.cxx b/src/SMESH/SMESH_HypothesisFactory.cxx new file mode 100644 index 000000000..afbcf37a6 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisFactory.cxx @@ -0,0 +1,154 @@ +using namespace std; +//============================================================================= +// File : SMESH_HypothesisFactory.cxx +// Created : mer mai 15 13:45:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_HypothesisFactory.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_HypothesisCreator.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +// Add new hypothesis here (include file) +//--------------------------------------- +#include "SMESH_LocalLength.hxx" +#include "SMESH_LengthFromEdges.hxx" +#include "SMESH_NumberOfSegments.hxx" +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_Regular_1D.hxx" +#include "SMESH_MEFISTO_2D.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Hexa_3D.hxx" + +//--------------------------------------- + +//============================================================================= +/*! + * Specific Hypothesis Creators are generated with a template which inherits a + * generic hypothesis creator. Each creator returns an hypothesis of the type + * given in the template. + */ +//============================================================================= + +// template class HypothesisCreator: public GenericHypothesisCreator +// { +// public: +// virtual T* Create (int hypId) +// { +// // return new T(hypId); +// }; + +// }; + +//============================================================================= +/*! + * Constructor: instanciate specific hypothesis creators, fill a private map + * indexed by hypothesis names. THIS METHOD MUST BE COMPLETED WHEN A NEW + * HYPOTHESIS IS ADDED. + * Specific hypothesis creator are defined with the above template. + * Hypothesis names are related to the corresponding class names: + * prefix = SMESH_ ; suffix = . + */ +//============================================================================= + +SMESH_HypothesisFactory::SMESH_HypothesisFactory() +{ + _hypId = 0; + +// Add new hypothesis here (creators) +//--------------------------------------- +_creatorMap["LocalLength"] = new SMESH_HypothesisCreator; +_creatorMap["NumberOfSegments"] = new SMESH_HypothesisCreator; +_creatorMap["LengthFromEdges"] = new SMESH_HypothesisCreator; +_creatorMap["MaxElementArea"] = new SMESH_HypothesisCreator; +_creatorMap["Regular_1D"] = new SMESH_HypothesisCreator; +_creatorMap["MEFISTO_2D"] = new SMESH_HypothesisCreator; +_creatorMap["Quadrangle_2D"] = new SMESH_HypothesisCreator; +_creatorMap["Hexa_3D"] = new SMESH_HypothesisCreator; + +//--------------------------------------- +} + +//============================================================================= +/*! + * Destructor: deletes specific hypothesis creators instanciated in the + * constructor. + */ +//============================================================================= + +SMESH_HypothesisFactory::~SMESH_HypothesisFactory() +{ + map::iterator it; + for (it = _creatorMap.begin(); it != _creatorMap.end(); it++) + { + delete (*it).second; + } + _creatorMap.clear(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis* SMESH_HypothesisFactory::Create(const char* anHypName, + int studyId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_HypothesisFactory::Create " << anHypName); + if (_creatorMap.find(anHypName) == _creatorMap.end()) + throw(SALOME_Exception(LOCALIZED("bad hypothesis type name"))); + SMESH_Hypothesis* myHyp = _creatorMap[anHypName]->Create(_hypId++, + studyId, + _gen); + return myHyp; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GenericHypothesisCreator* +SMESH_HypothesisFactory::GetCreator(const char* anHypName) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_HypothesisFactory::GetCreator " << anHypName); + if (_creatorMap.find(anHypName) == _creatorMap.end()) + throw(SALOME_Exception(LOCALIZED("bad hypothesis type name"))); + return _creatorMap[anHypName]; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_HypothesisFactory::GetANewId() +{ + //MESSAGE("SMESH_HypothesisFactory::GetANewId"); + return _hypId++; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_HypothesisFactory::SetGen(SMESH_Gen* gen) +{ + //MESSAGE("SMESH_HypothesisFactory::SetGen"); + _gen = gen; +} + diff --git a/src/SMESH/SMESH_HypothesisFactory.hxx b/src/SMESH/SMESH_HypothesisFactory.hxx new file mode 100644 index 000000000..7ade68122 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisFactory.hxx @@ -0,0 +1,50 @@ +//============================================================================= +// File : SMESH_HypothesisFactory.hxx +// Created : mer mai 15 13:45:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESISFACTORY_HXX_ +#define _SMESH_HYPOTHESISFACTORY_HXX_ + +#include "SMESH_Hypothesis.hxx" + +#include "Utils_SALOME_Exception.hxx" + +#include + +class SMESH_Gen; + +class GenericHypothesisCreator +{ +public: +// virtual SMESH_Hypothesis* GetInstance(int hypId) = 0; + virtual SMESH_Hypothesis* Create(int hypId, int studyId, SMESH_Gen* gen) = 0; +}; + +class SMESH_HypothesisFactory +{ +public: + SMESH_HypothesisFactory(); + virtual ~SMESH_HypothesisFactory(); + + void SetGen(SMESH_Gen* gen); + + SMESH_Hypothesis* Create(const char* anHypName, int studyId) + throw (SALOME_Exception); + + GenericHypothesisCreator* GetCreator(const char* anHypName) + throw (SALOME_Exception); + + int GetANewId(); + +private: + map _creatorMap; + int _hypId; + SMESH_Gen* _gen; +}; + +#endif diff --git a/src/SMESH/SMESH_LengthFromEdges.cxx b/src/SMESH/SMESH_LengthFromEdges.cxx new file mode 100644 index 000000000..191282813 --- /dev/null +++ b/src/SMESH/SMESH_LengthFromEdges.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_LengthFromEdges.cxx +// Created : mar jun 11 22:42:30 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_LengthFromEdges.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LengthFromEdges::SMESH_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _mode =1; + _name = "LengthFromEdges"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LengthFromEdges::~SMESH_LengthFromEdges() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_LengthFromEdges::SetMode(int mode) + throw (SALOME_Exception) +{ + int oldMode = _mode; + if (mode <= 0) + throw SALOME_Exception(LOCALIZED("mode must be positive")); + _mode = mode; + if (oldMode != _mode) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_LengthFromEdges::GetMode() +{ + return _mode; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_LengthFromEdges::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_LengthFromEdges::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_LengthFromEdges & hyp) +{ + save << hyp._mode; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_LengthFromEdges & hyp) +{ + bool isOK = true; + int a; + isOK = (load >> a); + if (isOK) hyp._mode = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_LengthFromEdges.hxx b/src/SMESH/SMESH_LengthFromEdges.hxx new file mode 100644 index 000000000..3afeb784e --- /dev/null +++ b/src/SMESH/SMESH_LengthFromEdges.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_LengthFromEdges.hxx +// Created : mar jun 11 22:42:20 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_LENGTHFROMEDGES_HXX_ +#define _SMESH_LENGTHFROMEDGES_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_LengthFromEdges: + public SMESH_Hypothesis +{ +public: + SMESH_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_LengthFromEdges(); + + void SetMode(int mode) + throw (SALOME_Exception); + + int GetMode(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_LengthFromEdges & hyp); + friend istream & operator >> (istream & load, SMESH_LengthFromEdges & hyp); + +protected: + int _mode; +}; + +#endif diff --git a/src/SMESH/SMESH_LocalLength.cxx b/src/SMESH/SMESH_LocalLength.cxx new file mode 100644 index 000000000..85f4fb7a8 --- /dev/null +++ b/src/SMESH/SMESH_LocalLength.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_LocalLength.cxx +// Created : sam mai 18 08:10:23 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_LocalLength.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LocalLength::SMESH_LocalLength(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _length =1.; + _name = "LocalLength"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LocalLength::~SMESH_LocalLength() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_LocalLength::SetLength(double length) + throw (SALOME_Exception) +{ + double oldLength = _length; + if (length <= 0) + throw SALOME_Exception(LOCALIZED("length must be positive")); + _length = length; + if (oldLength != _length) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_LocalLength::GetLength() +{ + return _length; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_LocalLength::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_LocalLength::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_LocalLength & hyp) +{ + save << hyp._length; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_LocalLength & hyp) +{ + bool isOK = true; + double a; + isOK = (load >> a); + if (isOK) hyp._length = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_LocalLength.hxx b/src/SMESH/SMESH_LocalLength.hxx new file mode 100644 index 000000000..120ce4291 --- /dev/null +++ b/src/SMESH/SMESH_LocalLength.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_LocalLength.hxx +// Created : sam mai 18 08:10:19 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_LOCALLENGTH_HXX_ +#define _SMESH_LOCALLENGTH_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_LocalLength: + public SMESH_Hypothesis +{ +public: + SMESH_LocalLength(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_LocalLength(); + + void SetLength(double length) + throw (SALOME_Exception); + + double GetLength(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_LocalLength & hyp); + friend istream & operator >> (istream & load, SMESH_LocalLength & hyp); + +protected: + double _length; +}; + +#endif diff --git a/src/SMESH/SMESH_MEFISTO_2D.cxx b/src/SMESH/SMESH_MEFISTO_2D.cxx new file mode 100644 index 000000000..f9d4fde0a --- /dev/null +++ b/src/SMESH/SMESH_MEFISTO_2D.cxx @@ -0,0 +1,631 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEFISTO_2D.cxx +// Created : sam mai 18 08:10:55 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MEFISTO_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_LengthFromEdges.hxx" + +#include "Rn.h" +#include "aptrte.h" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MEFISTO_2D::SMESH_MEFISTO_2D(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_MEFISTO_2D::SMESH_MEFISTO_2D"); + _name = "MEFISTO_2D"; +// _shapeType = TopAbs_FACE; + _shapeType = (1<::const_iterator itl; + SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (nbHyp != 1) return false; // only one compatible hypothesis allowed + + itl = hyps.begin(); + theHyp = (*itl); + + string hypName = theHyp->GetName(); + int hypId = theHyp->GetID(); + //SCRUTE(hypName); + + bool isOk = false; + + if (hypName == "MaxElementArea") + { + _hypMaxElementArea = dynamic_cast (theHyp); + ASSERT(_hypMaxElementArea); + _maxElementArea = _hypMaxElementArea->GetMaxArea(); + _edgeLength = 0; + isOk =true; + } + + if (hypName == "LengthFromEdges") + { + _hypLengthFromEdges = dynamic_cast (theHyp); + ASSERT(_hypLengthFromEdges); + _edgeLength = 0; + _maxElementArea = 0; + isOk =true; + } + + + if (isOk) + { + isOk = false; + if (_maxElementArea > 0) + { + _edgeLength = 2*sqrt(_maxElementArea); // triangles : minorant + isOk = true; + } + else isOk = (_hypLengthFromEdges != NULL); // **** check mode + } + + //SCRUTE(_edgeLength); + //SCRUTE(_maxElementArea); + return isOk; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_MEFISTO_2D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_MEFISTO_2D::Compute"); + + if (_hypLengthFromEdges) + _edgeLength = ComputeEdgeElementLength(aMesh, aShape); + + bool isOk = false; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + const TopoDS_Face& FF = TopoDS::Face(aShape); + bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + + Z nblf; //nombre de lignes fermees (enveloppe en tete) + Z *nudslf=NULL; //numero du dernier sommet de chaque ligne fermee + R2 *uvslf=NULL; + Z nbpti=0; //nombre points internes futurs sommets de la triangulation + R2 *uvpti=NULL; + + Z nbst; + R2 *uvst=NULL; + Z nbt; + Z *nust=NULL; + Z ierr=0; + + Z nutysu=1; // 1: il existe un fonction areteideale_() + // Z nutysu=0; // 0: on utilise aretmx + R aretmx=_edgeLength; // longueur max aretes future triangulation + //SCRUTE(aretmx); + + nblf = NumberOfWires(F); + //SCRUTE(nblf); + + nudslf = new Z[1+nblf]; + nudslf[0] = 0; + int iw = 1; + int nbpnt = 0; + + const TopoDS_Wire OW1 = BRepTools::OuterWire(F); + nbpnt += NumberOfPoints (aMesh, OW1); + nudslf [iw++] = nbpnt; + //SCRUTE(nbpnt); + + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + if (!OW1.IsSame(W)) + { + nbpnt += NumberOfPoints (aMesh, W); + nudslf [iw++] = nbpnt; + //SCRUTE(nbpnt); + } + } + + uvslf = new R2[nudslf[nblf]]; + //SCRUTE(nudslf[nblf]); + int m = 0; + + map mefistoToDS; // correspondence mefisto index--> points IDNodes + TopoDS_Wire OW = BRepTools::OuterWire(F); + LoadPoints (aMesh, F, OW, uvslf, m, mefistoToDS); + //SCRUTE(m); + + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + if (!OW.IsSame(W)) + { + LoadPoints (aMesh, F, W, uvslf, m, mefistoToDS); + //SCRUTE(m); + } + } +// SCRUTE(nudslf[nblf]); +// for (int i=0; i<=nblf; i++) +// { +// MESSAGE(" -+- " <& mefistoToDS) +{ + MESSAGE("SMESH_MEFISTO_2D::LoadPoints"); + + Handle (SMDS_Mesh) meshDS = aMesh.GetMeshDS(); + + double scalex; + double scaley; + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + ComputeScaleOnFace(aMesh, F, scalex, scaley); + + TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD)); + BRepTools_WireExplorer wexp(W,F); + for (wexp.Init(W,F);wexp.More(); wexp.Next()) + { + const TopoDS_Edge& E = wexp.Current(); + + // --- IDNodes of first and last Vertex + + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + + ASSERT(!VFirst.IsNull()); + SMESH_subMesh* firstSubMesh = aMesh.GetSubMesh(VFirst); + const TColStd_ListOfInteger& lidf + = firstSubMesh->GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); +// SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); +// SCRUTE(idLast); + + // --- edge internal IDNodes (relies on good order storage, not checked) + + int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nbPoints); + + Standard_Real f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + //SCRUTE(nbPoints); + //SCRUTE(indElt.Extent()); + ASSERT(nbPoints == indElt.Extent()); + bool isForward = (E.Orientation() == TopAbs_FORWARD); + map params; + for (; ite.More(); ite.Next()) + { + int nodeId = ite.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + double param = epos->GetUParameter(); + params[param] = nodeId; +// MESSAGE(" " << param << " " << params[param]); + } + + // --- load 2D values into MEFISTO structure, + // add IDNodes in mefistoToDS map + + if (E.Orientation() == TopAbs_FORWARD) + { + gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = idFirst; + //MESSAGE(" "<::iterator itp = params.begin(); + for (Standard_Integer i = 1; i<=nbPoints; i++) // nbPoints internal + { + double param = (*itp).first; + gp_Pnt2d p = C2d->Value(param); + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = (*itp).second; +// MESSAGE(" "<Value(l); // last point = Vertex Reversed + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = idLast; +// MESSAGE(" "<::reverse_iterator itp = params.rbegin(); + for (Standard_Integer i = nbPoints ; i >= 1; i--) + { + double param = (*itp).first; + gp_Pnt2d p = C2d->Value(param); + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = (*itp).second; +// MESSAGE(" "<Value(param); + if (p.X() < xmin) xmin = p.X(); + if (p.X() > xmax) xmax = p.X(); + if (p.Y() < ymin) ymin = p.Y(); + if (p.Y() > ymax) ymax = p.Y(); +// MESSAGE(" "<< f<<" "<Value(xmin, ymoy); + gp_Pnt PY0 = S->Value(xmoy, ymin); + for (Standard_Integer i = 1; i<= nbp; i++) + { + double x = xmin + (double(i)/double(nbp))*(xmax-xmin); + gp_Pnt PX = S->Value(x,ymoy); + double y = ymin + (double(i)/double(nbp))*(ymax-ymin); + gp_Pnt PY = S->Value(xmoy,y); + length_x += PX.Distance(PX0); + length_y += PY.Distance(PY0); + PX0.SetCoord(PX.X(),PX.Y(),PX.Z()); + PY0.SetCoord(PY.X(),PY.Y(),PY.Z()); + } +// SCRUTE(length_x); +// SCRUTE(length_y); + scalex = length_x/(xmax - xmin); + scaley = length_y/(ymax - ymin); +// SCRUTE(scalex); +// SCRUTE(scaley); + ASSERT(scalex); + ASSERT(scaley); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MEFISTO_2D::StoreResult (SMESH_Mesh& aMesh, + Z nbst, R2* uvst, Z nbt, Z* nust, + const TopoDS_Face& F, bool faceIsForward, + map& mefistoToDS) +{ + double scalex; + double scaley; + ComputeScaleOnFace(aMesh, F, scalex, scaley); + + Handle (SMESHDS_Mesh) meshDS = aMesh.GetMeshDS(); + + Z n,m; + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + + for ( n=0; nValue(u,v); + + if (mefistoToDS.find(n+1) == mefistoToDS.end()) + { + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnFace(node, F); + + //MESSAGE(nodeId<<" "<GetPosition()); + fpos->SetUParameter(u); + fpos->SetVParameter(v); + } + } + + m=0; + int mt=0; + + //SCRUTE(faceIsForward); + for ( n=1; n<=nbt; n++ ) + { + int inode1 = nust[m++]; + int inode2 = nust[m++]; + int inode3 = nust[m++]; + + int nodeId1 = mefistoToDS[inode1]; + int nodeId2 = mefistoToDS[inode2]; + int nodeId3 = mefistoToDS[inode3]; + //MESSAGE("-- "<AddFace(nodeId1, nodeId2, nodeId3); + } + else + { + faceId = meshDS->AddFace(nodeId1, nodeId3, nodeId2); + } + Handle (SMDS_MeshElement) elt = meshDS->FindElement(faceId); + meshDS->SetMeshElementOnShape(elt, F); + m++; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_MEFISTO_2D::ComputeEdgeElementLength"); + // **** a mettre dans SMESH_2D_Algo ? + + const TopoDS_Face& FF = TopoDS::Face(aShape); + bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + + double meanElementLength = 100; + double wireLength =0; + int wireElementsNumber =0; + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + for (TopExp_Explorer expe(W,TopAbs_EDGE); expe.More(); expe.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(expe.Current()); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + double length = EdgeLength(E); + wireLength += length; + wireElementsNumber += nb; + } + } + if (wireElementsNumber) + meanElementLength = wireLength/wireElementsNumber; + //SCRUTE(meanElementLength); + return meanElementLength; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_MEFISTO_2D::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_MEFISTO_2D::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_MEFISTO_2D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_MEFISTO_2D & hyp) +{ + return load; +} + diff --git a/src/SMESH/SMESH_MEFISTO_2D.hxx b/src/SMESH/SMESH_MEFISTO_2D.hxx new file mode 100644 index 000000000..dc631bda6 --- /dev/null +++ b/src/SMESH/SMESH_MEFISTO_2D.hxx @@ -0,0 +1,67 @@ +//============================================================================= +// File : SMESH_MEFISTO_2D.hxx +// Created : sam mai 18 08:10:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MEFISTO_2D_HXX_ +#define _SMESH_MEFISTO_2D_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_LengthFromEdges.hxx" +#include "Rn.h" + +#include + +#include + +class SMESH_MEFISTO_2D: + public SMESH_2D_Algo +{ +public: + SMESH_MEFISTO_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_MEFISTO_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + double ComputeEdgeElementLength(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + void LoadPoints(SMESH_Mesh& aMesh, + const TopoDS_Face& F, + const TopoDS_Wire& W, + R2* uvslf, + int& m, + map& mefistoToDS); + + void ComputeScaleOnFace(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace, + double& scalex, + double& scaley); + + void StoreResult (SMESH_Mesh& aMesh, + Z nbst, R2* uvst, Z nbt, Z* nust, + const TopoDS_Face& F, bool faceIsForward, + map& mefistoToDS); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_MEFISTO_2D & hyp); + friend istream & operator >> (istream & load, SMESH_MEFISTO_2D & hyp); + +protected: + double _edgeLength; + double _maxElementArea; + SMESH_MaxElementArea* _hypMaxElementArea; + SMESH_LengthFromEdges* _hypLengthFromEdges; +}; + +#endif diff --git a/src/SMESH/SMESH_MaxElementArea.cxx b/src/SMESH/SMESH_MaxElementArea.cxx new file mode 100644 index 000000000..9b4668ce2 --- /dev/null +++ b/src/SMESH/SMESH_MaxElementArea.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementArea.cxx +// Created : sam mai 18 23:14:08 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MaxElementArea.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MaxElementArea::SMESH_MaxElementArea(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _maxArea =1.; + _name = "MaxElementArea"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MaxElementArea::~SMESH_MaxElementArea() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MaxElementArea::SetMaxArea(double maxArea) + throw (SALOME_Exception) +{ + double oldArea = _maxArea; + if (maxArea <= 0) + throw SALOME_Exception(LOCALIZED("maxArea must be positive")); + _maxArea = maxArea; + if (_maxArea != oldArea) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_MaxElementArea::GetMaxArea() +{ + return _maxArea; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_MaxElementArea::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_MaxElementArea::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_MaxElementArea & hyp) +{ + save << hyp._maxArea; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_MaxElementArea & hyp) +{ + bool isOK = true; + double a; + isOK = (load >> a); + if (isOK) hyp._maxArea = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_MaxElementArea.hxx b/src/SMESH/SMESH_MaxElementArea.hxx new file mode 100644 index 000000000..f97040bdc --- /dev/null +++ b/src/SMESH/SMESH_MaxElementArea.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_MaxElementArea.hxx +// Created : sam mai 18 23:14:04 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MAXELEMENTAREA_HXX_ +#define _SMESH_MAXELEMENTAREA_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_MaxElementArea: + public SMESH_Hypothesis +{ +public: + SMESH_MaxElementArea(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_MaxElementArea(); + + void SetMaxArea(double maxArea) + throw (SALOME_Exception); + + double GetMaxArea(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_MaxElementArea & hyp); + friend istream & operator >> (istream & load, SMESH_MaxElementArea & hyp); + +protected: + double _maxArea; +}; + +#endif diff --git a/src/SMESH/SMESH_MaxElementVolume.cxx b/src/SMESH/SMESH_MaxElementVolume.cxx new file mode 100644 index 000000000..c46bed8c5 --- /dev/null +++ b/src/SMESH/SMESH_MaxElementVolume.cxx @@ -0,0 +1,9 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementVolume.cxx +// Created : sam mai 18 23:14:45 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH/SMESH_MaxElementVolume.hxx b/src/SMESH/SMESH_MaxElementVolume.hxx new file mode 100644 index 000000000..2cf3716be --- /dev/null +++ b/src/SMESH/SMESH_MaxElementVolume.hxx @@ -0,0 +1,8 @@ +//============================================================================= +// File : SMESH_MaxElementVolume.hxx +// Created : sam mai 18 23:14:41 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx new file mode 100644 index 000000000..1f00fe8c4 --- /dev/null +++ b/src/SMESH/SMESH_Mesh.cxx @@ -0,0 +1,572 @@ +using namespace std; +//============================================================================= +// File : SMESH_Mesh.cxx +// Created : sam mai 18 08:08:43 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Mesh.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESHDS_Script.hxx" +//#include "SMESHDS_ListOfAsciiString.hxx" +//#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" +#include "TCollection_AsciiString.hxx" + +#include "utilities.h" + +#include "Mesh_Writer.h" +#include "DriverMED_W_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverUNV_W_SMESHDS_Mesh.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::SMESH_Mesh() +{ + MESSAGE("SMESH_Mesh::SMESH_Mesh"); + _id = -1; + ASSERT(0); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::SMESH_Mesh(int localId, + int studyId, + SMESH_Gen* gen, + const Handle(SMESHDS_Document)& myDocument) +{ + MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); + _id = localId; + _studyId = studyId; + _gen = gen; + _myDocument = myDocument; + _idDoc = _myDocument->NewMesh(); + _myMeshDS = _myDocument->GetMesh(_idDoc); + _isShapeToMesh = false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::~SMESH_Mesh() +{ + MESSAGE("SMESH_Mesh::~SMESH_Mesh"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::ShapeToMesh"); + if (_isShapeToMesh) + throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined")); + _isShapeToMesh = true; + _myMeshDS->ShapeToMesh(aShape); + + // NRI : 24/02/03 + TopExp::MapShapes(aShape,_subShapes); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Mesh::AddHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::AddHypothesis"); + + StudyContextStruct* sc = _gen->GetStudyContext(_studyId); + if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) + { + MESSAGE("Hypothesis ID does not give an hypothesis"); + SCRUTE(_studyId); + SCRUTE(anHypId); + throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); + } + + SMESH_subMesh* subMesh = GetSubMesh(aSubShape); + SMESH_Hypothesis* anHyp = sc->mapHypothesis[anHypId]; + int event; + + // shape + + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::ADD_HYP; + else + event = SMESH_subMesh::ADD_ALGO; + int ret = subMesh->AlgoStateEngine(event, anHyp); + + // subShapes (only when shape is mainShape) + TopoDS_Shape mainShape = _myMeshDS->ShapeToMesh(); + if (aSubShape.IsSame(mainShape)) + { + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::ADD_FATHER_HYP; + else + event = SMESH_subMesh::ADD_FATHER_ALGO; + subMesh->SubMeshesAlgoStateEngine(event, anHyp); + } + + subMesh->DumpAlgoState(true); + //SCRUTE(ret); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::RemoveHypothesis"); + + StudyContextStruct* sc = _gen->GetStudyContext(_studyId); + if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) + throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); + + SMESH_subMesh* subMesh = GetSubMesh(aSubShape); + SMESH_Hypothesis* anHyp = sc->mapHypothesis[anHypId]; + int hypType = anHyp->GetType(); + SCRUTE(hypType); + int event; + + // shape + + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::REMOVE_HYP; + else + event = SMESH_subMesh::REMOVE_ALGO; + int ret = subMesh->AlgoStateEngine(event, anHyp); + + // subShapes (only when shape is mainShape) + + TopoDS_Shape mainShape = _myMeshDS->ShapeToMesh(); + if (aSubShape.IsSame(mainShape)) + { + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::REMOVE_FATHER_HYP; + else + event = SMESH_subMesh::REMOVE_FATHER_ALGO; + subMesh->SubMeshesAlgoStateEngine(event, anHyp); + } + + subMesh->DumpAlgoState(true); + SCRUTE(ret); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const Handle(SMESHDS_Mesh)& SMESH_Mesh::GetMeshDS() +{ + return _myMeshDS; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +const list& +SMESH_Mesh::GetHypothesisList(const TopoDS_Shape& aSubShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetHypothesisList"); + _subShapeHypothesisList.clear(); + const SMESHDS_ListOfPtrHypothesis& listHyp + = _myMeshDS->GetHypothesis(aSubShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + _subShapeHypothesisList.push_back(anHyp); + it.Next(); + } + return _subShapeHypothesisList; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const SMESHDS_ListOfCommand& SMESH_Mesh::GetLog() + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetLog"); + Handle (SMESHDS_Script) scriptDS = _myMeshDS->GetScript(); + const SMESHDS_ListOfCommand& logDS = scriptDS->GetCommands(); +// SMESHDS_ListIteratorOfListOfCommand its; +// const SMESHDS_ListOfAsciiString& logDS = scriptDS->GetCommands(); +// SMESHDS_ListIteratorOfListOfAsciiString its; +// for (its.Initialize(logDS); its.More(); its.Next()) +// { +// SCRUTE(its.Value().ToCString()); +// } + return logDS; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESH_Mesh::ClearLog() + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::ClearLog"); + Handle (SMESHDS_Script) scriptDS = _myMeshDS->GetScript(); + scriptDS->Clear(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Mesh::GetId() +{ + MESSAGE("SMESH_Mesh::GetId"); + return _id; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Gen* SMESH_Mesh::GetGen() +{ + return _gen; +} + +//============================================================================= +/*! + * Get or Create the SMESH_subMesh object implementation + */ +//============================================================================= + +SMESH_subMesh* SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Mesh::GetSubMesh"); + SMESH_subMesh* aSubMesh; + int index = _subShapes.FindIndex(aSubShape); + if ( _mapSubMesh.find(index) != _mapSubMesh.end() ) { + aSubMesh = _mapSubMesh[index]; + } else { + aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); + _mapSubMesh[index] = aSubMesh; + } + + /* NRI 24/02/2003 + int index = -1; + if (_subShapes.Contains(aSubShape)) + { + index = _subShapes.FindIndex(aSubShape); + ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end()); + aSubMesh = _mapSubMesh[index]; + //MESSAGE("found submesh " << index); + } + else + { + index = _subShapes.Add(aSubShape); + aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); + _mapSubMesh[index] = aSubMesh; + //MESSAGE("created submesh " << index); + } + */ + return aSubMesh; +} + +//============================================================================= +/*! + * Get the SMESH_subMesh object implementation. Dont create it, return null + * if it does not exist. + */ +//============================================================================= +// +// * Given a subShape, find if there is a subMesh associated to this subShape +// * or to a collection of shapes containing this subShape. Collection = +// * compsolid, shell, wire. +// * +// * WARNING : with arg = compsolid, shell or wire returns always NULL. +// * with a face inside a shell, and submesh created for both, if arg is face, +// * returns first created submesh of the two. +// * subMesh is not created, return may be NULL. + +SMESH_subMesh* SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Mesh::GetSubMeshContaining"); + bool isFound = false; + SMESH_subMesh* aSubMesh = NULL; + + int index = _subShapes.FindIndex(aSubShape); + if ( _mapSubMesh.find(index) != _mapSubMesh.end() ) { + aSubMesh = _mapSubMesh[index]; + isFound = true; + } + + /* NRI 24/02/2003 + int index = -1; + if (_subShapes.Contains(aSubShape)) + { + index = _subShapes.FindIndex(aSubShape); + ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end()); + aSubMesh = _mapSubMesh[index]; + isFound = true; + //MESSAGE("found submesh " << index); + } + */ + +// map::iterator itsm; +// for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++) +// { +// aSubMesh = (*itsm).second; +// isFound = aSubMesh->Contains(aSubShape); +// if (isFound) break; +// } + + if (! isFound) aSubMesh = NULL; + return aSubMesh; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const list & +SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis"); + map::iterator itsm; + _subMeshesUsingHypothesisList.clear(); + for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++) + { + SMESH_subMesh* aSubMesh = (*itsm).second; + bool usesHyp = false; + SMESH_Algo* algo = _gen->GetAlgo(*this, aSubMesh->GetSubShape()); + if (algo != NULL) + { + const list& usedHyps + = algo->GetUsedHypothesis(*this, aSubMesh->GetSubShape()); + list::const_iterator itl; + for(itl=usedHyps.begin(); itl != usedHyps.end(); itl++) + if (anHyp == (*itl)) + { + usesHyp = true; + break; + } + } + if (usesHyp) _subMeshesUsingHypothesisList.push_back(aSubMesh); + } + return _subMeshesUsingHypothesisList; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh::ExportMED( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverMED_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + MESSAGE ( " _idDoc " << _idDoc ) + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +void SMESH_Mesh::ExportDAT( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverDAT_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +void SMESH_Mesh::ExportUNV( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverUNV_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbNodes() + throw (SALOME_Exception) +{ + return _myMeshDS->NbNodes(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbEdges() + throw (SALOME_Exception) +{ + return _myMeshDS->NbEdges(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbFaces() + throw (SALOME_Exception) +{ + return _myMeshDS->NbFaces(); +} +int SMESH_Mesh::NbTriangles() + throw (SALOME_Exception) +{ + SMDS_MeshFacesIterator itFaces(_myMeshDS); + int Nb = 0; + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + Nb++; + break; + } + } + } + return Nb; +} +int SMESH_Mesh::NbQuadrangles() + throw (SALOME_Exception) +{ + SMDS_MeshFacesIterator itFaces(_myMeshDS); + int Nb = 0; + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 4 : { + Nb++; + break; + } + } + } + return Nb; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbVolumes() + throw (SALOME_Exception) +{ + return _myMeshDS->NbVolumes(); +} +int SMESH_Mesh::NbTetras() + throw (SALOME_Exception) +{ + int Nb = 0; + SMDS_MeshVolumesIterator itVolumes(_myMeshDS); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : { + Nb++; + break; + } + } + } + return Nb; +} +int SMESH_Mesh::NbHexas() + throw (SALOME_Exception) +{ + int Nb = 0; + SMDS_MeshVolumesIterator itVolumes(_myMeshDS); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + Nb++; + break; + } + } + } + return Nb; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbSubMesh() + throw (SALOME_Exception) +{ + return _myMeshDS->NbSubMesh(); +} diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx new file mode 100644 index 000000000..d677b4837 --- /dev/null +++ b/src/SMESH/SMESH_Mesh.hxx @@ -0,0 +1,146 @@ +//============================================================================= +// File : SMESH_Mesh.hxx +// Created : sam mai 18 08:07:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MESH_HXX_ +#define _SMESH_MESH_HXX_ + +#include "SMESHDS_Document.hxx" +#include "SMESHDS_Mesh.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESHDS_ListOfCommand.hxx" +//#include "SMESHDS_ListOfAsciiString.hxx" +//#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" + + +#include "Utils_SALOME_Exception.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class SMESH_Gen; + +class SMESH_Mesh +{ +public: + SMESH_Mesh(); + SMESH_Mesh(int localId, + int studyId, + SMESH_Gen* gen, + const Handle(SMESHDS_Document)& myDocument); + + virtual ~SMESH_Mesh(); + + void ShapeToMesh(const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + bool AddHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception); + + bool RemoveHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception); + + const list& + GetHypothesisList(const TopoDS_Shape& aSubShape) + throw (SALOME_Exception); + + const SMESHDS_ListOfCommand& GetLog() + throw (SALOME_Exception); + +// const SMESHDS_ListOfAsciiString& GetLog() +// throw (SALOME_Exception); + + void ClearLog() + throw (SALOME_Exception); + + int GetId(); + + const Handle(SMESHDS_Mesh)& GetMeshDS(); + + SMESH_Gen* GetGen(); + + SMESH_subMesh* GetSubMesh(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception); + + SMESH_subMesh* GetSubMeshContaining(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception); + + const list & + GetSubMeshUsingHypothesis(SMESHDS_Hypothesis* anHyp) + throw (SALOME_Exception); + + void ExportDAT( const char* file ) + throw (SALOME_Exception); + void ExportMED( const char* file ) + throw (SALOME_Exception); + void ExportUNV( const char* file ) + throw (SALOME_Exception); + + int NbNodes() + throw (SALOME_Exception); + + int NbEdges() + throw (SALOME_Exception); + + int NbFaces() + throw (SALOME_Exception); + + int NbTriangles() + throw (SALOME_Exception); + + int NbQuadrangles() + throw (SALOME_Exception); + + int NbVolumes() + throw (SALOME_Exception); + + int NbTetras() + throw (SALOME_Exception); + + int NbHexas() + throw (SALOME_Exception); + + int NbSubMesh() + throw (SALOME_Exception); + + +private: + + int _id; // id given by creator (unique within the creator instance) + int _studyId; + int _idDoc; // id given by SMESHDS_Document + bool _isShapeToMesh; // set to true when a shape is given (only once) + list _subShapeHypothesisList; + list _subMeshesUsingHypothesisList; + Handle (SMESHDS_Document) _myDocument; + Handle (SMESHDS_Mesh) _myMeshDS; + TopTools_IndexedMapOfShape _subShapes; + map _mapSubMesh; + SMESH_Gen* _gen; +}; + +#endif diff --git a/src/SMESH/SMESH_NumberOfSegments.cxx b/src/SMESH/SMESH_NumberOfSegments.cxx new file mode 100644 index 000000000..2a2ae6b3e --- /dev/null +++ b/src/SMESH/SMESH_NumberOfSegments.cxx @@ -0,0 +1,115 @@ +using namespace std; +//============================================================================= +// File : SMESH_NumberOfSegments.cxx +// Created : sam mai 18 08:11:15 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_NumberOfSegments.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _numberOfSegments = 1; + _name = "NumberOfSegments"; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NumberOfSegments::~SMESH_NumberOfSegments() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber) + throw (SALOME_Exception) +{ + int oldNumberOfSegments = _numberOfSegments; + if (segmentsNumber <= 0) + throw SALOME_Exception(LOCALIZED("number of segments must be positive")); + _numberOfSegments = segmentsNumber; + + if (oldNumberOfSegments != _numberOfSegments) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_NumberOfSegments::GetNumberOfSegments() +{ + return _numberOfSegments; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_NumberOfSegments::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_NumberOfSegments::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_NumberOfSegments & hyp) +{ + save << hyp._numberOfSegments; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_NumberOfSegments & hyp) +{ + bool isOK = true; + int a; + isOK = (load >> a); + if (isOK) hyp._numberOfSegments = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_NumberOfSegments.hxx b/src/SMESH/SMESH_NumberOfSegments.hxx new file mode 100644 index 000000000..c053211ef --- /dev/null +++ b/src/SMESH/SMESH_NumberOfSegments.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_NumberOfSegments.hxx +// Created : sam mai 18 08:11:20 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_NUMBEROFSEGMENTS_HXX_ +#define _SMESH_NUMBEROFSEGMENTS_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_NumberOfSegments: + public SMESH_Hypothesis +{ +public: + SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_NumberOfSegments(); + + void SetNumberOfSegments(int segmentsNumber) + throw (SALOME_Exception); + + int GetNumberOfSegments(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_NumberOfSegments & hyp); + friend istream& operator >> (istream & load, SMESH_NumberOfSegments & hyp); + +protected: + int _numberOfSegments; +}; + +#endif diff --git a/src/SMESH/SMESH_Quadrangle_2D.cxx b/src/SMESH/SMESH_Quadrangle_2D.cxx new file mode 100644 index 000000000..11d86c82f --- /dev/null +++ b/src/SMESH/SMESH_Quadrangle_2D.cxx @@ -0,0 +1,650 @@ +using namespace std; +//============================================================================= +// File : SMESH_Quadrangle_2D.cxx +// Created : sam mai 18 08:11:32 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Quadrangle_2D::SMESH_Quadrangle_2D(int hypId, + int studyId, + SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Quadrangle_2D::SMESH_Quadrangle_2D"); + _name = "Quadrangle_2D"; + // _shapeType = TopAbs_FACE; + _shapeType = (1<nbPts[0]; + int nbright = quad->nbPts[1]; + int nbVertices = nbdown*nbright; + int nbQuad = (nbdown-1)*(nbright-1); + //SCRUTE(nbVertices); + //SCRUTE(nbQuad); + + // const TopoDS_Face& FF = TopoDS::Face(aShape); + // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + const TopoDS_Face& F = TopoDS::Face(aShape); + bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + + for (int i=1; iuv_grid[ij].u; + double v = quad->uv_grid[ij].v; + gp_Pnt P = S->Value(u,v); + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<< nodeId<<" "<<" "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnFace(node, F); + quad->uv_grid[ij].nodeId = nodeId; +// Handle (SMDS_FacePosition) fpos +// = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v +// node->SetPosition(fpos); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + fpos->SetUParameter(i); + fpos->SetVParameter(j); + } + + // bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]); + for (int i=0; iuv_grid[ j *nbdown +i ].nodeId; + int b = quad->uv_grid[ j *nbdown +i+1].nodeId; + int c = quad->uv_grid[(j+1)*nbdown +i+1].nodeId; + int d = quad->uv_grid[(j+1)*nbdown +i ].nodeId; + int faceId; + // if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d); + // else faceId = meshDS->AddFace(a,d,c,b); + faceId = meshDS->AddFace(a,b,c,d); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(faceId); + meshDS->SetMeshElementOnShape(elt, F); + } + + QuadDelete(quad); + bool isOk = true; + return isOk; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +FaceQuadStruct* +SMESH_Quadrangle_2D::CheckAnd2Dcompute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Quadrangle_2D::ComputeWithoutStore"); + + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + // const TopoDS_Face& FF = TopoDS::Face(aShape); + // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + const TopoDS_Face& F = TopoDS::Face(aShape); + bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + + // verify 1 wire only, with 4 edges, same number of points on opposite edges + + if (NumberOfWires (F) != 1) + { + MESSAGE("only 1 wire by face (quadrangles)"); + return 0; + //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)")); + } + // const TopoDS_Wire WW = BRepTools::OuterWire(F); + // TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD)); + const TopoDS_Wire& W = BRepTools::OuterWire(F); + BRepTools_WireExplorer wexp(W,F); + + FaceQuadStruct* quad = new FaceQuadStruct; + for (int i=0; i<4; i++) quad->uv_edges[i] = 0; + quad->uv_grid = 0; + + int nbEdges = 0; + for (wexp.Init(W,F);wexp.More(); wexp.Next()) + { + // const TopoDS_Edge& EE = wexp.Current(); + // TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); + const TopoDS_Edge& E = wexp.Current(); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + if (nbEdges < 4) + { + quad->edge[nbEdges] = E; + quad->nbPts[nbEdges] = nb +2; // internal points + 2 extrema + } + nbEdges++; + } + + if (nbEdges != 4) + { + MESSAGE("face must have 4 edges /quadrangles"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles")); + } + + if (quad->nbPts[0] != quad->nbPts[2]) + { + MESSAGE("different point number-opposed edge"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("different point number-opposed edge")); + } + + if (quad->nbPts[1] != quad->nbPts[3]) + { + MESSAGE("different point number-opposed edge"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("different point number-opposed edge")); + } + + // set normalized grid on unit square in parametric domain + + SetNormalizedGrid(aMesh, F, quad); + + return quad; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + + void SMESH_Quadrangle_2D::QuadDelete(FaceQuadStruct* quad) +{ + //MESSAGE("SMESH_Quadrangle_2D::QuadDelete"); + if (quad) + { + for (int i=0; i<4; i++) + { + if (quad->uv_edges[i]) delete [] quad->uv_edges[i]; + quad->edge[i].Nullify(); + } + if (quad->uv_grid) delete [] quad->uv_grid; + delete quad; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + FaceQuadStruct* quad) + throw (SALOME_Exception) +{ + // Algorithme décrit dans "Génération automatique de maillages" + // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85 + // traitement dans le domaine paramétrique 2d u,v + // transport - projection sur le carré unité + + const TopoDS_Face& F = TopoDS::Face(aShape); + + // 1 --- find orientation of the 4 edges, by test on extrema + + // max min 0 x1 1 + // |<----north-2-------^ a3 -------------> a2 + // | | ^1 1^ + // west-3 east-1 =right | | + // | | ==> | | + // y0 | | y1 | | + // | | |0 0| + // v----south-0--------> a0 -------------> a1 + // min max 0 x0 1 + // =down + // + + Handle (Geom2d_Curve) c2d[4]; + gp_Pnt2d pf[4]; + gp_Pnt2d pl[4]; + for (int i=0; i<4; i++) + { + c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i], + F, + quad->first[i], + quad->last[i]); + pf[i] = c2d[i]->Value(quad->first[i]); + pl[i] = c2d[i]->Value(quad->last[i]); + quad->isEdgeForward[i] = false; + } + + double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis + // distances si piece fausse + int i=0; + if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d)) + { + quad->isEdgeForward[0] = true; + } + else + { + double tmp =quad->first[0]; + quad->first[0] = quad->last[0]; + quad->last[0] = tmp; + pf[0] = c2d[0]->Value(quad->first[0]); + pl[0] = c2d[0]->Value(quad->last[0]); + } + for (int i=1; i<4; i++) + { + quad->isEdgeForward[i] = (pf[i].Distance(pl[i-1]) < eps2d); + if (! quad->isEdgeForward[i]) + { + double tmp =quad->first[i]; + quad->first[i] = quad->last[i]; + quad->last[i] = tmp; + pf[i] = c2d[i]->Value(quad->first[i]); + pl[i] = c2d[i]->Value(quad->last[i]); + //SCRUTE(pf[i].Distance(pl[i-1])); + ASSERT(pf[i].Distance(pl[i-1]) < eps2d); + } + } + //SCRUTE(pf[0].Distance(pl[3])); + ASSERT(pf[0].Distance(pl[3]) < eps2d); + +// for (int i=0; i<4; i++) +// { +// SCRUTE(quad->isEdgeForward[i]); +// MESSAGE(" -first "<uv_edges[i] = LoadEdgePoints(aMesh, F, + quad->edge[i], + quad->first[i], + quad->last[i]); + + // quad->isEdgeForward[i]); + } + for (int i=2; i<4; i++) + { + quad->uv_edges[i] = LoadEdgePoints(aMesh, F, + quad->edge[i], + quad->last[i], + quad->first[i]); + + // !quad->isEdgeForward[i]); + } + + // 3 --- 2D normalized values on unit square [0..1][0..1] + + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + quad->uv_grid = new UVPtStruct[nbright*nbdown]; + + UVPtStruct* uv_grid = quad->uv_grid; + UVPtStruct* uv_e0 = quad->uv_edges[0]; + UVPtStruct* uv_e1 = quad->uv_edges[1]; + UVPtStruct* uv_e2 = quad->uv_edges[2]; + UVPtStruct* uv_e3 = quad->uv_edges[3]; + gp_Pnt2d a0 = pf[0]; + gp_Pnt2d a1 = pf[1]; + gp_Pnt2d a2 = pf[2]; + gp_Pnt2d a3 = pf[3]; + + // nodes Id on edges + + int j = 0; + for (int i=0; iValue(param_0); + gp_Pnt2d p1 = c2d[1]->Value(param_1); + gp_Pnt2d p2 = c2d[2]->Value(param_2); + gp_Pnt2d p3 = c2d[3]->Value(param_3); + + double u = (1-y)*p0.X() + x*p1.X() + y*p2.X() + (1-x)*p3.X(); + double v = (1-y)*p0.Y() + x*p1.Y() + y*p2.Y() + (1-x)*p3.Y(); + + u -= (1-x)*(1-y)*a0.X() + x*(1-y)*a1.X() + x*y*a2.X() + (1-x)*y*a3.X(); + v -= (1-x)*(1-y)*a0.Y() + x*(1-y)*a1.Y() + x*y*a2.Y() + (1-x)*y*a3.Y(); + + uv_grid[ij].u = u; + uv_grid[ij].v = v; + + //MESSAGE("-uv- "<GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); + //SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); + //SCRUTE(idLast); + + // --- edge internal IDNodes (relies on good order storage, not checked) + + int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nbPoints); + UVPtStruct * uvslf = new UVPtStruct[nbPoints+2]; + + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + //SCRUTE(nbPoints); + //SCRUTE(indElt.Extent()); + ASSERT(nbPoints == indElt.Extent()); + + map params; + for (; ite.More(); ite.Next()) + { + int nodeId = ite.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + double param = epos->GetUParameter(); + params[param] = nodeId; + } + + bool isForward = (((l-f)*(last-first)) > 0); + double paramin = 0; + double paramax = 0; + if (isForward) + { + paramin = f; + paramax = l; + gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward + uvslf [0].x = p.X(); + uvslf [0].y = p.Y(); + uvslf [0].param = f; + uvslf [0].nodeId = idFirst; + //MESSAGE("__ f "<::iterator itp = params.begin(); + for (int i = 1; i <= nbPoints; i++) // nbPoints internal + { + double param = (*itp).first; + int nodeId = (*itp).second; + gp_Pnt2d p = C2d->Value(param); + uvslf [i].x = p.X(); + uvslf [i].y = p.Y(); + uvslf[i].param = param; + uvslf[i].nodeId = nodeId; + //MESSAGE("__ "<Value(l); // last point = Vertex Reversed + uvslf [nbPoints+1].x = p.X(); + uvslf [nbPoints+1].y = p.Y(); + uvslf [nbPoints+1].param = l; + uvslf [nbPoints+1].nodeId = idLast; + //MESSAGE("__ l "<Value(l); // first point = Vertex Reversed + uvslf [0].x = p.X(); + uvslf [0].y = p.Y(); + uvslf [0].param = l; + uvslf [0].nodeId = idLast; + //MESSAGE("__ l "<::reverse_iterator itp = params.rbegin(); + for (int j = nbPoints; j >= 1; j--) // nbPoints internal + { + double param = (*itp).first; + int nodeId = (*itp).second; + int i = nbPoints +1 -j; + gp_Pnt2d p = C2d->Value(param); + uvslf [i].x = p.X(); + uvslf [i].y = p.Y(); + uvslf[i].param = param; + uvslf[i].nodeId = nodeId; + //MESSAGE("__ "<Value(f); // last point = Vertex Forward + uvslf [nbPoints+1].x = p.X(); + uvslf [nbPoints+1].y = p.Y(); + uvslf [nbPoints+1].param = f; + uvslf [nbPoints+1].nodeId = idFirst; + //MESSAGE("__ f "<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_Quadrangle_2D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_Quadrangle_2D & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_Quadrangle_2D.hxx b/src/SMESH/SMESH_Quadrangle_2D.hxx new file mode 100644 index 000000000..9487f20c6 --- /dev/null +++ b/src/SMESH/SMESH_Quadrangle_2D.hxx @@ -0,0 +1,81 @@ +//============================================================================= +// File : SMESH_Quadrangle_2D.hxx +// Created : sam mai 18 08:11:36 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_QUADRANGLE_2D_HXX_ +#define _SMESH_QUADRANGLE_2D_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "Utils_SALOME_Exception.hxx" + +typedef struct uvPtStruct +{ + double param; + double normParam; + double u; // original 2d parameter + double v; + double x; // 2d parameter, normalized [0,1] + double y; + int nodeId; +} UVPtStruct; + +typedef struct faceQuadStruct +{ + int nbPts[4]; + TopoDS_Edge edge[4]; + double first[4]; + double last[4]; + bool isEdgeForward[4]; + UVPtStruct* uv_edges[4]; + UVPtStruct* uv_grid; +} FaceQuadStruct; + +class SMESH_Quadrangle_2D: + public SMESH_2D_Algo +{ +public: + SMESH_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Quadrangle_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + void QuadDelete(FaceQuadStruct* quad); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Quadrangle_2D & hyp); + friend istream & operator >> (istream & load, SMESH_Quadrangle_2D & hyp); + +protected: + + void SetNormalizedGrid(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + FaceQuadStruct* quad) + throw (SALOME_Exception); + + UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh, + const TopoDS_Face& F, + const TopoDS_Edge& E, + double first, + double last); +// bool isForward); + +// FaceQuadStruct _quadDesc; +}; + +#endif diff --git a/src/SMESH/SMESH_Regular_1D.cxx b/src/SMESH/SMESH_Regular_1D.cxx new file mode 100644 index 000000000..aec7b5367 --- /dev/null +++ b/src/SMESH/SMESH_Regular_1D.cxx @@ -0,0 +1,305 @@ +using namespace std; +//============================================================================= +// File : SMESH_Regular_1D.cxx +// Created : sam mai 18 08:11:58 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Regular_1D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESH_LocalLength.hxx" +#include "SMESH_NumberOfSegments.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Regular_1D::SMESH_Regular_1D(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_1D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Regular_1D::SMESH_Regular_1D"); + _name = "Regular_1D"; + // _shapeType = TopAbs_EDGE; + _shapeType = (1<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_Regular_1D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_Regular_1D & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Regular_1D::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Regular_1D::CheckHypothesis"); + + list::const_iterator itl; + SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (nbHyp != 1) return false; // only one compatible hypothesis allowed + + itl = hyps.begin(); + theHyp = (*itl); + + string hypName = theHyp->GetName(); + int hypId = theHyp->GetID(); + //SCRUTE(hypName); + + bool isOk = false; + + if (hypName == "LocalLength") + { + _hypLocalLength = dynamic_cast (theHyp); + ASSERT(_hypLocalLength); + _localLength = _hypLocalLength->GetLength(); + _numberOfSegments = 0; + isOk =true; + } + + if (hypName == "NumberOfSegments") + { + _hypNumberOfSegments = dynamic_cast (theHyp); + ASSERT(_hypNumberOfSegments); + _numberOfSegments = _hypNumberOfSegments->GetNumberOfSegments(); + _localLength = 0; + isOk = true; + } + + //SCRUTE(_localLength); + //SCRUTE(_numberOfSegments); + + return isOk; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Regular_1D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Regular_1D::Compute"); + + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + const TopoDS_Edge& EE = TopoDS::Edge(aShape); + TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); + + double f,l; + Handle(Geom_Curve) Curve = BRep_Tool::Curve(E,f,l); + + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l + + double length = EdgeLength(E); + //SCRUTE(length); + + double eltSize = 1; +// if (_localLength > 0) eltSize = _localLength; + if (_localLength > 0) + { + double nbseg = ceil(length/_localLength); // integer sup + if (nbseg <=0) nbseg = 1; // degenerated edge + eltSize = length/nbseg; + } + else + { + ASSERT(_numberOfSegments> 0); + eltSize = length/_numberOfSegments; + } + + ASSERT(!VFirst.IsNull()); + SMESH_subMesh* firstSubMesh = aMesh.GetSubMesh(VFirst); + const TColStd_ListOfInteger& lidf + = firstSubMesh->GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); + //SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); + //SCRUTE(idLast); + + if (!Curve.IsNull()) + { + GeomAdaptor_Curve C3d(Curve); + GCPnts_UniformAbscissa Discret(C3d,eltSize,f,l); + int NbPoints = Discret.NbPoints(); + //MESSAGE("nb points on edge : "<Value(param); + + //Add the Node in the DataStructure + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnEdge(node, E); + + // **** edgePosition associe au point = param. +// Handle (SMDS_EdgePosition) epos +// = new SMDS_EdgePosition(theSubMesh->GetId(),param); // non, deja cree +// node->SetPosition(epos); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + epos->SetUParameter(param); + + int edgeId = meshDS->AddEdge(idPrev, nodeId); + elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + idPrev = nodeId; + } + int edgeId = meshDS->AddEdge(idPrev, idLast); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + } + else + { +// MESSAGE ("Edge Degeneree non traitee --- arret"); +// ASSERT(0); + if (BRep_Tool::Degenerated(E)) + { + // Edge is a degenerated Edge : We put n = 5 points on the edge. + int NbPoints = 5; + BRep_Tool::Range(E,f,l); + double du = (l-f)/(NbPoints-1); + MESSAGE("************* Degenerated edge! *****************"); + + TopoDS_Vertex V1,V2; + TopExp::Vertices (E,V1,V2); + gp_Pnt P = BRep_Tool::Pnt(V1); + + int idPrev = idFirst; + for (int i=2; iAddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnEdge(node, E); + +// Handle (SMDS_EdgePosition) epos +// = new SMDS_EdgePosition(theSubMesh->GetId(),param); +// node->SetPosition(epos); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + epos->SetUParameter(param); + + int edgeId = meshDS->AddEdge(idPrev, nodeId); + elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + idPrev = nodeId; + } + int edgeId = meshDS->AddEdge(idPrev, idLast); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + } + else ASSERT(0); + } + return true; +} diff --git a/src/SMESH/SMESH_Regular_1D.hxx b/src/SMESH/SMESH_Regular_1D.hxx new file mode 100644 index 000000000..7188e7447 --- /dev/null +++ b/src/SMESH/SMESH_Regular_1D.hxx @@ -0,0 +1,43 @@ +//============================================================================= +// File : SMESH_Regular_1D.hxx +// Created : sam mai 18 08:11:54 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_REGULAR_1D_HXX_ +#define _SMESH_REGULAR_1D_HXX_ + +#include "SMESH_1D_Algo.hxx" + +class SMESH_LocalLength; +class SMESH_NumberOfSegments; + +class SMESH_Regular_1D: + public SMESH_1D_Algo +{ +public: + SMESH_Regular_1D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Regular_1D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Regular_1D & hyp); + friend istream & operator >> (istream & load, SMESH_Regular_1D & hyp); + +protected: + double _localLength; + int _numberOfSegments; + SMESH_LocalLength* _hypLocalLength; + SMESH_NumberOfSegments* _hypNumberOfSegments; +}; + +#endif diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx new file mode 100644 index 000000000..1273bce7a --- /dev/null +++ b/src/SMESH/SMESH_subMesh.cxx @@ -0,0 +1,1397 @@ +using namespace std; +//============================================================================= +// File : SMESH_subMesh.cxx +// Created : jeu mai 30 13:28:32 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +using namespace std; + +#include "SMESH_subMesh.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Algo.hxx" +#include "utilities.h" +#include "OpUtil.hxx" + +#include +#include +#include +#include +#include + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +SMESH_subMesh::SMESH_subMesh(int Id, + SMESH_Mesh* father, + const Handle(SMESHDS_Mesh)& meshDS, + const TopoDS_Shape & aSubShape) +{ + //MESSAGE("SMESH_subMesh::SMESH_subMesh"); + _subShape = aSubShape; + _meshDS = meshDS; + _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... + _father = father; + _Id = Id; + _vertexSet = false; // only for Vertex subMesh + _dependenceAnalysed = false; + _dependantsFound = false; + + if (_subShape.ShapeType() == TopAbs_VERTEX) + { + _algoState = HYP_OK; + _computeState = READY_TO_COMPUTE; + } + else + { + _algoState = NO_ALGO; + _computeState = NOT_READY; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh::~SMESH_subMesh() +{ + MESSAGE("SMESH_subMesh::~SMESH_subMesh"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_subMesh::GetId() +{ + //MESSAGE("SMESH_subMesh::GetId"); + return _Id; +} + +//============================================================================= +/*! + * Given a subShape, find the subMesh is associated to this subShape or + * to a collection of shapes containing this subShape. Collection = compsolid, + * shell, wire + */ +//============================================================================= + +// bool SMESH_subMesh::Contains(const TopoDS_Shape & aSubShape) +// throw (SALOME_Exception) +// { +// //MESSAGE("SMESH_subMesh::Contains"); +// bool contains = false; +// int type = _subShape.ShapeType(); +// int typesub = aSubShape.ShapeType(); +// //SCRUTE(type) +// //SCRUTE(typesub) +// switch (type) +// { +// // case TopAbs_COMPOUND: +// // { +// // //MESSAGE("---"); +// // throw SALOME_Exception(LOCALIZED("Compound not yet treated")); +// // break; +// // } +// case TopAbs_COMPSOLID: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_SOLID);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_SHELL: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_FACE);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_WIRE: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_EDGE);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_COMPOUND: +// case TopAbs_SOLID: +// case TopAbs_FACE: +// case TopAbs_EDGE: +// case TopAbs_VERTEX: +// { +// //MESSAGE("---"); +// contains = _subShape.IsSame(aSubShape); +// break; +// } +// default: +// { +// break; +// } +// } +// //SCRUTE(contains); +// return contains; +// } + +//============================================================================= +/*! + * + */ +//============================================================================= + +const Handle(SMESHDS_SubMesh)& SMESH_subMesh::GetSubMeshDS() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::GetSubMeshDS"); + if (_subMeshDS.IsNull()) + { + //MESSAGE("subMesh pointer still null, trying to get it..."); + _subMeshDS = _meshDS->MeshElements(_subShape); // may be null ... + if (_subMeshDS.IsNull()) + { + MESSAGE("problem... subMesh still empty"); + //NRI ASSERT(0); + //NRI throw SALOME_Exception(LOCALIZED(subMesh still empty)); + } + } + return _subMeshDS; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh* SMESH_subMesh::GetFirstToCompute() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::GetFirstToCompute"); + const map& subMeshes = DependsOn(); + SMESH_subMesh* firstToCompute = 0; + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool readyToCompute = (sm->GetComputeState() == READY_TO_COMPUTE); + if (readyToCompute) + { + firstToCompute = sm; + //SCRUTE(sm->GetId()); + break; + } + } + if (firstToCompute) + { + //MESSAGE("--- submesh to compute"); + return firstToCompute; // a subMesh of this + } + if (_computeState == READY_TO_COMPUTE) + { + //MESSAGE("--- this to compute"); + return this; // this + } + //MESSAGE("--- nothing to compute"); + return 0; // nothing to compute +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::SubMeshesComputed() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::SubMeshesComputed"); + const map& subMeshes = DependsOn(); + + bool subMeshesComputed = true; + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool computeOk = (sm->GetComputeState() == COMPUTE_OK); + if (! computeOk) + { + subMeshesComputed = false; + SCRUTE(sm->GetId()); + break; + } + } + return subMeshesComputed; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::SubMeshesReady() +{ + MESSAGE("SMESH_subMesh::SubMeshesReady"); + const map& subMeshes = DependsOn(); + + bool subMeshesReady = true; + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool computeOk = ( (sm->GetComputeState() == COMPUTE_OK) + || (sm->GetComputeState() == READY_TO_COMPUTE)) ; + if (! computeOk) + { + subMeshesReady = false; + SCRUTE(sm->GetId()); + break; + } + } + return subMeshesReady; +} + +//============================================================================= +/*! + * Construct dependence on first level subMeshes. complex shapes (compsolid, + * shell, wire) are not analysed the same way as simple shapes (solid, face, + * edge). + * For collection shapes (compsolid, shell, wire) prepare a list of submeshes + * with possible multiples occurences. Multiples occurences corresponds to + * internal frontiers within shapes of the collection and must not be keeped. + * See FinalizeDependence. + */ +//============================================================================= + +const map& SMESH_subMesh::DependsOn() +{ + if (_dependenceAnalysed) return _mapDepend; + + //MESSAGE("SMESH_subMesh::DependsOn"); + + int type = _subShape.ShapeType(); + //SCRUTE(type); + switch (type) + { + case TopAbs_COMPOUND: + { + //MESSAGE("compound"); + list shellInSolid; + for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + for (TopExp_Explorer + exp2(exp.Current(),TopAbs_SHELL);exp2.More();exp2.Next()) + { + shellInSolid.push_back(exp2.Current()); + } + } + for (TopExp_Explorer exp(_subShape,TopAbs_SHELL);exp.More();exp.Next()) + { + list::iterator it1; + bool isInSolid = false; + for (it1 = shellInSolid.begin(); it1 != shellInSolid.end(); it1++) + { + TopoDS_Shape aShape = (*it1); + if (aShape.IsSame(exp.Current())) + { + isInSolid = true; + break; + } + } + if (!isInSolid) + InsertDependence(exp.Current()); //only shell not in solid + } + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_COMPSOLID: + { + //MESSAGE("compsolid"); + for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_FACE);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_SHELL: + { + //MESSAGE("shell"); + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_EDGE);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_WIRE: + { + //MESSAGE("wire"); + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_VERTEX);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_SOLID: + { + //MESSAGE("solid"); +// for (TopExp_Explorer exp(_subShape,TopAbs_SHELL);exp.More();exp.Next()) +// { +// InsertDependence(exp.Current()); +// } + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_FACE: + { + //MESSAGE("face"); +// for (TopExp_Explorer exp(_subShape,TopAbs_WIRE);exp.More();exp.Next()) +// { +// InsertDependence(exp.Current()); +// } + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_EDGE: + { + //MESSAGE("edge"); + for (TopExp_Explorer exp(_subShape,TopAbs_VERTEX);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_VERTEX: + { + break; + } + default: + { + break; + } + } + _dependenceAnalysed = true; + return _mapDepend; +} + +//============================================================================= +/*! + * For simple Shapes (solid, face, edge): add subMesh into dependence list. + */ +//============================================================================= + +void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape) +{ + //MESSAGE("SMESH_subMesh::InsertDependence"); + //SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(aSubShape); + //SCRUTE(aSubMesh); + //if (! aSubMesh) aSubMesh = _father->GetSubMesh(aSubShape); + + SMESH_subMesh* aSubMesh = _father->GetSubMesh(aSubShape); + int type = aSubShape.ShapeType(); + int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid + int cle = aSubMesh->GetId(); + cle += 10000000 * ordType; // sort map by ordType then index + if (_mapDepend.find(cle) == _mapDepend.end()) + { + _mapDepend[cle] = aSubMesh; + const map& subMap = aSubMesh->DependsOn(); + map::const_iterator im; + for (im = subMap.begin(); im != subMap.end(); im++) + { + int clesub = (*im).first; + SMESH_subMesh* sm = (*im).second; + if (_mapDepend.find(clesub) == _mapDepend.end()) + _mapDepend[clesub] = sm; + } + } + +} + +//============================================================================= +/*! + * For collection shapes (compsolid, shell, wire). + * Add only subMesh figuring only once in multiset to dependence list + */ +//============================================================================= + +// void SMESH_subMesh::FinalizeDependence(list& shapeList) +// { +// //MESSAGE("SMESH_subMesh::FinalizeDependence"); +// list::iterator it1, it2; +// for(it1 = shapeList.begin(); it1 != shapeList.end(); it1++) +// { +// TopoDS_Shape aSubShape = (*it1); +// int count = 0; +// for(it2 = shapeList.begin(); it2 != shapeList.end(); it2++) +// { +// TopoDS_Shape other = (*it2); +// if (other.IsSame(aSubShape)) count++; +// } +// if (count == 1) InsertDependence(aSubShape); +// SCRUTE(count); +// } +// } + +//============================================================================= +/*! + * + */ +//============================================================================= + + const TopoDS_Shape& SMESH_subMesh::GetSubShape() +{ + //MESSAGE("SMESH_subMesh::GetSubShape"); + return _subShape; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::AlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + // MESSAGE("SMESH_subMesh::AlgoStateEngine"); + //SCRUTE(_algoState); + //SCRUTE(event); + + // **** les retour des evenement shape sont significatifs + // (add ou remove fait ou non) + // le retour des evenement father n'indiquent pas que add ou remove fait + int dim = SMESH_Gen::GetShapeDim(_subShape); + + if (dim < 1) + { + _algoState = HYP_OK; + //SCRUTE(_algoState); + return true; + } + + SMESH_Gen* gen =_father->GetGen(); + bool ret; + _oldAlgoState = _algoState; + bool modifiedHyp = false; // if set to true, force event MODIF_ALGO_STATE + // in ComputeStateEngine + + switch (_algoState) + { + + // ---------------------------------------------------------------------- + + case NO_ALGO: + switch (event) + { + case ADD_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->AddHypothesis(_subShape, anHyp); + break; + case ADD_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case REMOVE_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case ADD_FATHER_HYP: // nothing to do + break; + case ADD_FATHER_ALGO: // Algo just added in father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case REMOVE_FATHER_HYP: // nothing to do + break; + case REMOVE_FATHER_ALGO: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case MISSING_HYP: + switch (event) + { + case ADD_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->AddHypothesis(_subShape, anHyp); + if (ret) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_ALGO: //already existing algo : on father ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two algo on the same subShape... + { + MESSAGE("two algo on the same subshape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case REMOVE_ALGO: // perhaps a father algo applies ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<<_subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more algo applying on subShape... + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case ADD_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_FATHER_ALGO: // detect if two algo of same dim on father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two applying algo on father + { + MESSAGE("two applying algo on fatherShape..."); + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_FATHER_HYP: // nothing to do + break; + case REMOVE_FATHER_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more applying algo on father + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case HYP_OK: + switch (event) + { + case ADD_HYP: + { + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + list originalUsedHyps + = algo->GetUsedHypothesis((*_father), _subShape); // copy + + ret = _meshDS->AddHypothesis(_subShape, anHyp); + if (ret) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (! ret) + { + INFOS("two applying algo on the same shape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else // compare SMESHDS_Hypothesis* lists (order important) + { + MESSAGE("---"); + const list& newUsedHyps + = algo->GetUsedHypothesis((*_father), _subShape); + modifiedHyp = (originalUsedHyps != newUsedHyps); + } + } + } + break; + case ADD_ALGO: //already existing algo : on father ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two algo on the same subShape... + { + INFOS("two algo on the same subshape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + if (ret) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + modifiedHyp = true; + } + break; + case REMOVE_ALGO: // perhaps a father algo applies ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more algo applying on subShape... + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case ADD_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_FATHER_ALGO: // detect if two algo of same dim on father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two applying algo on father + { + MESSAGE("two applying algo on fatherShape..."); + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case REMOVE_FATHER_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more applying algo on father + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + default: + ASSERT(0); + break; + } + //SCRUTE(_algoState); + if ((_algoState != _oldAlgoState) || modifiedHyp) + int retc = ComputeStateEngine(MODIF_ALGO_STATE); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::SetAlgoState(int state) +{ + if (state != _oldAlgoState) +// int retc = ComputeStateEngine(MODIF_ALGO_STATE); + _algoState = state; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::SubMeshesAlgoStateEngine(int event, + SMESH_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::SubMeshesAlgoStateEngine"); + int dim = SMESH_Gen::GetShapeDim(_subShape); + if (dim > 1) + { + const map& subMeshes = DependsOn(); + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; + sm->AlgoStateEngine(event, anHyp); + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::DumpAlgoState(bool isMain) +{ + int dim = SMESH_Gen::GetShapeDim(_subShape); +// if (dim < 1) return; + if (isMain) + { + const map& subMeshes = DependsOn(); + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; + sm->DumpAlgoState(false); + } + } + int type = _subShape.ShapeType(); + MESSAGE("dim = " << dim << " type of shape " << type); + switch(_algoState) + { + case NO_ALGO: MESSAGE(" AlgoState = NO_ALGO"); break; + case MISSING_HYP: MESSAGE(" AlgoState = MISSING_HYP"); break; + case HYP_OK: MESSAGE(" AlgoState = HYP_OK"); break; + } + switch (_computeState) + { + case NOT_READY: MESSAGE(" ComputeState = NOT_READY"); break; + case READY_TO_COMPUTE: MESSAGE(" ComputeState = READY_TO_COMPUTE"); break; + case COMPUTE_OK: MESSAGE(" ComputeState = COMPUTE_OK"); break; + case FAILED_TO_COMPUTE: MESSAGE(" ComputeState = FAILED_TO_COMPUTE");break; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::ComputeStateEngine(int event) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::ComputeStateEngine"); + //SCRUTE(_computeState); + //SCRUTE(event); + + int dim = SMESH_Gen::GetShapeDim(_subShape); + + if (dim < 1) + { + if (_vertexSet) _computeState = COMPUTE_OK; + else _computeState = READY_TO_COMPUTE; + //SCRUTE(_computeState); + return true; + } + SMESH_Gen* gen =_father->GetGen(); + SMESH_Algo* algo = 0; + bool ret; + + switch(_computeState) + { + + // ---------------------------------------------------------------------- + + case NOT_READY: + switch (event) + { + case MODIF_HYP: // nothing to do + break; + case MODIF_ALGO_STATE: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + break; + case COMPUTE: // nothing to do + break; + case CLEAN: // nothing to do + break; + case CLEANDEP: // nothing to do + RemoveSubMeshElementsAndNodes(); // recursive call... + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case READY_TO_COMPUTE: + switch (event) + { + case MODIF_HYP: // nothing to do + break; + case MODIF_ALGO_STATE: + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case COMPUTE: + { + algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (! ret) + { + MESSAGE("***** verify compute state *****"); + _computeState = NOT_READY; + break; + } + ret = SubMeshesComputed(); + if (!ret) + { + MESSAGE("Some SubMeshes not computed"); + _computeState = FAILED_TO_COMPUTE; + break; + } + ret = algo->Compute((*_father),_subShape); + if (!ret) + { + MESSAGE("problem in algo execution: failed to compute"); + _computeState = FAILED_TO_COMPUTE; + break; + } + else + { + _computeState = COMPUTE_OK; + UpdateDependantsState(); // send event SUBMESH_COMPUTED + } + } + break; + case CLEAN: + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case COMPUTE_OK: + switch (event) + { + case MODIF_HYP: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case MODIF_ALGO_STATE: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case COMPUTE: // nothing to do + break; + case CLEAN: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case FAILED_TO_COMPUTE: + switch (event) + { + case MODIF_HYP: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case MODIF_ALGO_STATE: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case COMPUTE: // nothing to do + break; + case CLEAN: + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case SUBMESH_COMPUTED: // allow retry compute + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + default: + ASSERT(0); + break; + } + + //SCRUTE(_computeState); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::UpdateDependantsState() +{ + //MESSAGE("SMESH_subMesh::UpdateDependantsState"); + + const map& dependants = Dependants(); + map::const_iterator its; + for (its = dependants.begin(); its != dependants.end(); its++) + { + SMESH_subMesh* sm = (*its).second; + //SCRUTE((*its).first); + sm->ComputeStateEngine(SUBMESH_COMPUTED); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::CleanDependants() +{ + MESSAGE("SMESH_subMesh::CleanDependants"); + // **** parcourir les ancetres dans l'ordre de dépendance + + const map& dependants = Dependants(); + map::const_iterator its; + for (its = dependants.begin(); its != dependants.end(); its++) + { + SMESH_subMesh* sm = (*its).second; + SCRUTE((*its).first); + sm->ComputeStateEngine(CLEANDEP); + } + ComputeStateEngine(CLEANDEP); +} +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::RemoveSubMeshElementsAndNodes() +{ + MESSAGE("SMESH_subMesh::RemoveSubMeshElementsAndNodes"); + SCRUTE(_subShape.ShapeType()); + SCRUTE(_Id); + + _subMeshDS = _meshDS->MeshElements(_subShape); + if (!_subMeshDS.IsNull()) + { + const TColStd_ListOfInteger& indElt + = _subMeshDS->GetIDElements(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + for (; ite.More(); ite.Next()) + { + int eltId = ite.Value(); + SCRUTE(eltId); + Handle (SMDS_MeshElement) elt = _meshDS->FindElement(eltId); + _subMeshDS->RemoveElement(elt); + _meshDS->RemoveElement(eltId); + } + + const TColStd_ListOfInteger& indNodes + = _subMeshDS->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itn(indNodes); + for (; itn.More(); itn.Next()) + { + int nodeId = itn.Value(); + SCRUTE(nodeId); + Handle (SMDS_MeshElement) elt = _meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = _meshDS->GetNode(1, elt); + _subMeshDS->RemoveNode(node); + _meshDS->RemoveNode(nodeId); + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const map& SMESH_subMesh::Dependants() +{ + if (_dependantsFound) return _mapDependants; + + //MESSAGE("SMESH_subMesh::Dependants"); + + int shapeType = _subShape.ShapeType(); + //SCRUTE(shapeType); + TopTools_IndexedDataMapOfShapeListOfShape M; + TopoDS_Shape mainShape = _meshDS->ShapeToMesh(); + + switch (shapeType) + { + case TopAbs_VERTEX: + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_WIRE, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_FACE, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_SHELL, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_SOLID, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_EDGE); + break; + case TopAbs_FACE: + case TopAbs_SHELL: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_SHELL, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_SOLID, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_FACE); + break; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_SOLID, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_SOLID); + break; + case TopAbs_COMPOUND: + break; + } + + _dependantsFound = true; + return _mapDependants; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M, + const TopAbs_ShapeEnum etype) +{ + //MESSAGE("SMESH_subMesh::ExtractDependants"); + + TopoDS_Shape mainShape = _meshDS->ShapeToMesh(); + int lg = M.Extent(); + //SCRUTE(lg); + + int shapeType = _subShape.ShapeType(); + switch (shapeType) + { + case TopAbs_VERTEX: + break; + case TopAbs_EDGE: + case TopAbs_FACE: + case TopAbs_SOLID: + { + const TopTools_ListOfShape& ancestors = M.FindFromKey(_subShape); + TopTools_ListIteratorOfListOfShape it(ancestors); + for ( ; it.More();it.Next()) + { + TopoDS_Shape ancestor = it.Value(); + SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(ancestor); + // if (! aSubMesh) aSubMesh = _father->GetSubMesh(ancestor); + if (aSubMesh) + { + int type = aSubMesh->_subShape.ShapeType(); + int cle = aSubMesh->GetId(); + cle += 10000000 * type; // sort map by ordType then index + if (_mapDependants.find(cle) == _mapDependants.end()) + { + _mapDependants[cle] = aSubMesh; + //SCRUTE(cle); + } + } + } + } + break; + case TopAbs_WIRE: + case TopAbs_SHELL: + case TopAbs_COMPSOLID: + for (TopExp_Explorer expE(_subShape, etype); expE.More(); expE.Next()) + { + TopoDS_Shape aShape = expE.Current(); + const TopTools_ListOfShape& ancestors = M.FindFromKey( aShape); + TopTools_ListIteratorOfListOfShape it(ancestors); + for ( ; it.More();it.Next()) + { + MESSAGE("---"); + TopoDS_Shape ancestor = it.Value(); + SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(ancestor); + if (! aSubMesh) aSubMesh = _father->GetSubMesh(ancestor); + int type = aSubMesh->_subShape.ShapeType(); + int cle = aSubMesh->GetId(); + cle += 10000000 * type; // sort map by ordType then index + if (_mapDependants.find(cle) == _mapDependants.end()) + { + _mapDependants[cle] = aSubMesh; + SCRUTE(cle); + } + } + } + break; + case TopAbs_COMPOUND: + break; + } +} + diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx new file mode 100644 index 000000000..ab53a115c --- /dev/null +++ b/src/SMESH/SMESH_subMesh.hxx @@ -0,0 +1,109 @@ +//============================================================================= +// File : SMESH_subMesh.hxx +// Created : jeu mai 30 13:28:36 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_SUBMESH_HXX_ +#define _SMESH_SUBMESH_HXX_ + +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" +#include "Utils_SALOME_Exception.hxx" +#include +#include +#include + +#include +#include +#include + +class SMESH_Mesh; +class SMESH_Hypothesis; + +class SMESH_subMesh +{ +public: + SMESH_subMesh(int Id, + SMESH_Mesh* father, + const Handle(SMESHDS_Mesh)& meshDS, + const TopoDS_Shape & aSubShape); + virtual ~SMESH_subMesh(); + + int GetId(); + +// bool Contains(const TopoDS_Shape & aSubShape) +// throw (SALOME_Exception); + + const Handle(SMESHDS_SubMesh)& GetSubMeshDS() + throw (SALOME_Exception); + + SMESH_subMesh* GetFirstToCompute() + throw (SALOME_Exception); + + const map& DependsOn(); + const map& Dependants(); + + const TopoDS_Shape& GetSubShape(); + + bool _vertexSet; // only for vertex subMesh, set to false for dim > 0 + + enum compute_state { NOT_READY, READY_TO_COMPUTE, + COMPUTE_OK, FAILED_TO_COMPUTE }; + enum algo_state { NO_ALGO, MISSING_HYP, HYP_OK }; + enum algo_event {ADD_HYP, ADD_ALGO, + REMOVE_HYP, REMOVE_ALGO, + ADD_FATHER_HYP, ADD_FATHER_ALGO, + REMOVE_FATHER_HYP, REMOVE_FATHER_ALGO}; + enum compute_event {MODIF_HYP, MODIF_ALGO_STATE, COMPUTE, + CLEAN, CLEANDEP, SUBMESH_COMPUTED}; + + bool AlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception); + + void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception); + + void DumpAlgoState(bool isMain); + + bool ComputeStateEngine(int event) + throw (SALOME_Exception); + + int GetComputeState() {return _computeState;}; + +protected: + void InsertDependence(const TopoDS_Shape aSubShape); +// void FinalizeDependence(list& shapeList); + + bool SubMeshesComputed() + throw (SALOME_Exception); + + bool SubMeshesReady(); + + void RemoveSubMeshElementsAndNodes(); + void UpdateDependantsState(); + void CleanDependants(); + void ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M, + const TopAbs_ShapeEnum etype); + void SetAlgoState(int state); + + TopoDS_Shape _subShape; + Handle (SMESHDS_Mesh) _meshDS; + Handle (SMESHDS_SubMesh) _subMeshDS; + int _Id; + SMESH_Mesh* _father; + map _mapDepend; + map _mapDependants; + bool _dependenceAnalysed; + bool _dependantsFound; + + int _algoState; + int _oldAlgoState; + int _computeState; + +}; + +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_Command.hxx b/src/SMESHDS/Handle_SMESHDS_Command.hxx new file mode 100644 index 000000000..96129808e --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_Command.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_Command_HeaderFile +#define _Handle_SMESHDS_Command_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMESHDS_Command; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_Command); + +class Handle(SMESHDS_Command) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_Command)():Handle(MMgt_TShared)() {} + Handle(SMESHDS_Command)(const Handle(SMESHDS_Command)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMESHDS_Command)(const SMESHDS_Command* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMESHDS_Command)& operator=(const Handle(SMESHDS_Command)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_Command)& operator=(const SMESHDS_Command* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_Command* operator->() + { + return (SMESHDS_Command *)ControlAccess(); + } + + SMESHDS_Command* operator->() const + { + return (SMESHDS_Command *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_Command)(); + + Standard_EXPORT static const Handle(SMESHDS_Command) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx new file mode 100644 index 000000000..4bd66ea8a --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#define _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_DataMapNodeOfDataMapOfIntegerMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh); + +class Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)(const SMESHDS_DataMapNodeOfDataMapOfIntegerMesh* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)& operator=(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)& operator=(const SMESHDS_DataMapNodeOfDataMapOfIntegerMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh* operator->() + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerMesh *)ControlAccess(); + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh* operator->() const + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)(); + + Standard_EXPORT static const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx new file mode 100644 index 000000000..044b55ea7 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#define _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis); + +class Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)(const SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)& operator=(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)& operator=(const SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis* operator->() + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis *)ControlAccess(); + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis* operator->() const + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)(); + + Standard_EXPORT static const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx new file mode 100644 index 000000000..80bd0dcbe --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#define _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh); + +class Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)(const SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)& operator=(const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)& operator=(const SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh* operator->() + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh *)ControlAccess(); + } + + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh* operator->() const + { + return (SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)(); + + Standard_EXPORT static const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx new file mode 100644 index 000000000..ce8e276ed --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#define _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis); + +class Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)(const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)(const SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)& operator=(const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)& operator=(const SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis* operator->() + { + return (SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis *)ControlAccess(); + } + + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis* operator->() const + { + return (SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)(); + + Standard_EXPORT static const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx new file mode 100644 index 000000000..3b056b925 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#define _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh); + +class Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)(const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)(const SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)& operator=(const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)& operator=(const SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh* operator->() + { + return (SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh *)ControlAccess(); + } + + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh* operator->() const + { + return (SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)(); + + Standard_EXPORT static const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_Document.hxx b/src/SMESHDS/Handle_SMESHDS_Document.hxx new file mode 100644 index 000000000..253c8fe8d --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_Document.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_Document_HeaderFile +#define _Handle_SMESHDS_Document_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMESHDS_Document; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_Document); + +class Handle(SMESHDS_Document) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_Document)():Handle(MMgt_TShared)() {} + Handle(SMESHDS_Document)(const Handle(SMESHDS_Document)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMESHDS_Document)(const SMESHDS_Document* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMESHDS_Document)& operator=(const Handle(SMESHDS_Document)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_Document)& operator=(const SMESHDS_Document* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_Document* operator->() + { + return (SMESHDS_Document *)ControlAccess(); + } + + SMESHDS_Document* operator->() const + { + return (SMESHDS_Document *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_Document)(); + + Standard_EXPORT static const Handle(SMESHDS_Document) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx new file mode 100644 index 000000000..b0a1a78c6 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#define _Handle_SMESHDS_ListNodeOfListOfAsciiString_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_ListNodeOfListOfAsciiString; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_ListNodeOfListOfAsciiString); + +class Handle(SMESHDS_ListNodeOfListOfAsciiString) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_ListNodeOfListOfAsciiString)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_ListNodeOfListOfAsciiString)(const Handle(SMESHDS_ListNodeOfListOfAsciiString)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_ListNodeOfListOfAsciiString)(const SMESHDS_ListNodeOfListOfAsciiString* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_ListNodeOfListOfAsciiString)& operator=(const Handle(SMESHDS_ListNodeOfListOfAsciiString)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_ListNodeOfListOfAsciiString)& operator=(const SMESHDS_ListNodeOfListOfAsciiString* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_ListNodeOfListOfAsciiString* operator->() + { + return (SMESHDS_ListNodeOfListOfAsciiString *)ControlAccess(); + } + + SMESHDS_ListNodeOfListOfAsciiString* operator->() const + { + return (SMESHDS_ListNodeOfListOfAsciiString *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_ListNodeOfListOfAsciiString)(); + + Standard_EXPORT static const Handle(SMESHDS_ListNodeOfListOfAsciiString) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfCommand.hxx b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfCommand.hxx new file mode 100644 index 000000000..35ffd9f74 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfCommand.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_ListNodeOfListOfCommand_HeaderFile +#define _Handle_SMESHDS_ListNodeOfListOfCommand_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_ListNodeOfListOfCommand; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_ListNodeOfListOfCommand); + +class Handle(SMESHDS_ListNodeOfListOfCommand) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_ListNodeOfListOfCommand)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_ListNodeOfListOfCommand)(const Handle(SMESHDS_ListNodeOfListOfCommand)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_ListNodeOfListOfCommand)(const SMESHDS_ListNodeOfListOfCommand* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_ListNodeOfListOfCommand)& operator=(const Handle(SMESHDS_ListNodeOfListOfCommand)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_ListNodeOfListOfCommand)& operator=(const SMESHDS_ListNodeOfListOfCommand* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_ListNodeOfListOfCommand* operator->() + { + return (SMESHDS_ListNodeOfListOfCommand *)ControlAccess(); + } + + SMESHDS_ListNodeOfListOfCommand* operator->() const + { + return (SMESHDS_ListNodeOfListOfCommand *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_ListNodeOfListOfCommand)(); + + Standard_EXPORT static const Handle(SMESHDS_ListNodeOfListOfCommand) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx new file mode 100644 index 000000000..215a8c5c6 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#define _Handle_SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class SMESHDS_ListNodeOfListOfPtrHypothesis; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_ListNodeOfListOfPtrHypothesis); + +class Handle(SMESHDS_ListNodeOfListOfPtrHypothesis) : public Handle(TCollection_MapNode) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)():Handle(TCollection_MapNode)() {} + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)(const Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)(const SMESHDS_ListNodeOfListOfPtrHypothesis* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)& operator=(const Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)& operator=(const SMESHDS_ListNodeOfListOfPtrHypothesis* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_ListNodeOfListOfPtrHypothesis* operator->() + { + return (SMESHDS_ListNodeOfListOfPtrHypothesis *)ControlAccess(); + } + + SMESHDS_ListNodeOfListOfPtrHypothesis* operator->() const + { + return (SMESHDS_ListNodeOfListOfPtrHypothesis *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)(); + + Standard_EXPORT static const Handle(SMESHDS_ListNodeOfListOfPtrHypothesis) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_Mesh.hxx b/src/SMESHDS/Handle_SMESHDS_Mesh.hxx new file mode 100644 index 000000000..af2e5779e --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_Mesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#define _Handle_SMESHDS_Mesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SMDS_Mesh); +class SMESHDS_Mesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_Mesh); + +class Handle(SMESHDS_Mesh) : public Handle(SMDS_Mesh) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_Mesh)():Handle(SMDS_Mesh)() {} + Handle(SMESHDS_Mesh)(const Handle(SMESHDS_Mesh)& aHandle) : Handle(SMDS_Mesh)(aHandle) + { + } + + Handle(SMESHDS_Mesh)(const SMESHDS_Mesh* anItem) : Handle(SMDS_Mesh)((SMDS_Mesh *)anItem) + { + } + + Handle(SMESHDS_Mesh)& operator=(const Handle(SMESHDS_Mesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_Mesh)& operator=(const SMESHDS_Mesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_Mesh* operator->() + { + return (SMESHDS_Mesh *)ControlAccess(); + } + + SMESHDS_Mesh* operator->() const + { + return (SMESHDS_Mesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_Mesh)(); + + Standard_EXPORT static const Handle(SMESHDS_Mesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_Script.hxx b/src/SMESHDS/Handle_SMESHDS_Script.hxx new file mode 100644 index 000000000..e7486e138 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_Script.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_Script_HeaderFile +#define _Handle_SMESHDS_Script_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMESHDS_Script; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_Script); + +class Handle(SMESHDS_Script) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_Script)():Handle(MMgt_TShared)() {} + Handle(SMESHDS_Script)(const Handle(SMESHDS_Script)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMESHDS_Script)(const SMESHDS_Script* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMESHDS_Script)& operator=(const Handle(SMESHDS_Script)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_Script)& operator=(const SMESHDS_Script* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_Script* operator->() + { + return (SMESHDS_Script *)ControlAccess(); + } + + SMESHDS_Script* operator->() const + { + return (SMESHDS_Script *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_Script)(); + + Standard_EXPORT static const Handle(SMESHDS_Script) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Handle_SMESHDS_SubMesh.hxx b/src/SMESHDS/Handle_SMESHDS_SubMesh.hxx new file mode 100644 index 000000000..0c1dd4890 --- /dev/null +++ b/src/SMESHDS/Handle_SMESHDS_SubMesh.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#define _Handle_SMESHDS_SubMesh_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_MMgt_TShared_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(MMgt_TShared); +class SMESHDS_SubMesh; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESHDS_SubMesh); + +class Handle(SMESHDS_SubMesh) : public Handle(MMgt_TShared) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESHDS_SubMesh)():Handle(MMgt_TShared)() {} + Handle(SMESHDS_SubMesh)(const Handle(SMESHDS_SubMesh)& aHandle) : Handle(MMgt_TShared)(aHandle) + { + } + + Handle(SMESHDS_SubMesh)(const SMESHDS_SubMesh* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) + { + } + + Handle(SMESHDS_SubMesh)& operator=(const Handle(SMESHDS_SubMesh)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESHDS_SubMesh)& operator=(const SMESHDS_SubMesh* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESHDS_SubMesh* operator->() + { + return (SMESHDS_SubMesh *)ControlAccess(); + } + + SMESHDS_SubMesh* operator->() const + { + return (SMESHDS_SubMesh *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESHDS_SubMesh)(); + + Standard_EXPORT static const Handle(SMESHDS_SubMesh) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHDS/Makefile.in b/src/SMESHDS/Makefile.in new file mode 100644 index 000000000..386f31ee7 --- /dev/null +++ b/src/SMESHDS/Makefile.in @@ -0,0 +1,117 @@ +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 29/06/2001 +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets + +LIB = libSMESHDS.la +LIB_SRC = SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx \ + SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx \ + SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx \ + SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx \ + SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx \ + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx \ + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx \ + SMESHDS_DataMapOfIntegerMesh_0.cxx \ + SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx \ + SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx \ + SMESHDS_DataMapOfShapeSubMesh_0.cxx \ + SMESHDS_DataMapOfIntegerSubMesh_0.cxx \ + SMESHDS_Document.cxx \ + SMESHDS_Hypothesis.cxx \ + SMESHDS_ListIteratorOfListOfAsciiString_0.cxx \ + SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx \ + SMESHDS_ListIteratorOfListOfCommand_0.cxx \ + SMESHDS_ListNodeOfListOfAsciiString_0.cxx \ + SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx \ + SMESHDS_ListNodeOfListOfCommand_0.cxx \ + SMESHDS_ListOfAsciiString_0.cxx \ + SMESHDS_ListOfPtrHypothesis_0.cxx \ + SMESHDS_ListOfCommand_0.cxx \ + SMESHDS_Mesh.cxx \ + SMESHDS_Script.cxx \ + SMESHDS_Command.cxx \ + SMESHDS_SubMesh.cxx + +LIB_CLIENT_IDL = +LIB_SERVER_IDL = + +# Executables targets +BIN = +BIN_SRC = +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +# header files +EXPORT_HEADERS= Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \ + Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx \ + Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx \ + Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx \ + Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx \ + Handle_SMESHDS_Document.hxx \ + Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx \ + Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx \ + Handle_SMESHDS_ListNodeOfListOfCommand.hxx \ + Handle_SMESHDS_Mesh.hxx \ + Handle_SMESHDS_Script.hxx \ + Handle_SMESHDS_Command.hxx \ + Handle_SMESHDS_SubMesh.hxx \ + SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx \ + SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx \ + SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx \ + SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx \ + SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx \ + SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx \ + SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx \ + SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx \ + SMESHDS_DataMapOfIntegerMesh.hxx \ + SMESHDS_DataMapOfIntegerPtrHypothesis.hxx \ + SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx \ + SMESHDS_DataMapOfShapeSubMesh.hxx \ + SMESHDS_DataMapOfIntegerSubMesh.hxx \ + SMESHDS_Document.hxx \ + SMESHDS_Hypothesis.hxx \ + SMESHDS_ListIteratorOfListOfAsciiString.hxx \ + SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx \ + SMESHDS_ListIteratorOfListOfCommand.hxx \ + SMESHDS_ListNodeOfListOfAsciiString.hxx \ + SMESHDS_ListNodeOfListOfPtrHypothesis.hxx \ + SMESHDS_ListNodeOfListOfCommand.hxx \ + SMESHDS_ListOfAsciiString.hxx \ + SMESHDS_ListOfPtrHypothesis.hxx \ + SMESHDS_ListOfCommand.hxx \ + SMESHDS_Mesh.hxx \ + SMESHDS_PtrHypothesis.hxx \ + SMESHDS_Script.hxx \ + SMESHDS_Command.hxx \ + SMESHDS_CommandType.hxx \ + SMESHDS_SubMesh.hxx + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) +LDFLAGS += $(OCC_LIBS) + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ + diff --git a/src/SMESHDS/SMESHDS.cdl b/src/SMESHDS/SMESHDS.cdl new file mode 100644 index 000000000..0b6d48aec --- /dev/null +++ b/src/SMESHDS/SMESHDS.cdl @@ -0,0 +1,70 @@ +-- File : SMESHDS.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + + +package SMESHDS + +uses + Standard, + TColStd, + SMDS, + TCollection, + TopoDS, + TopTools + +is + + enumeration + CommandType is AddNode, AddEdge, AddTriangle, AddQuadrangle, AddTetrahedron, AddPyramid, + AddPrism, AddHexahedron, RemoveNode, RemoveElement, MoveNode + end CommandType; + + class Document; + + class Mesh; + + class SubMesh; + + imported Hypothesis; + + pointer PtrHypothesis to Hypothesis from SMESHDS; + + class Script; + + class Command; + + + + class DataMapOfShapeSubMesh instantiates DataMap from TCollection (Shape from TopoDS, + SubMesh from SMESHDS, + ShapeMapHasher from TopTools); + + class DataMapOfIntegerSubMesh instantiates DataMap from TCollection (Integer from Standard, + SubMesh from SMESHDS, + MapIntegerHasher from TColStd); + + + class DataMapOfIntegerPtrHypothesis instantiates DataMap from TCollection (Integer from Standard, + PtrHypothesis from SMESHDS, + MapIntegerHasher from TColStd); + + class DataMapOfIntegerMesh instantiates DataMap from TCollection (Integer from Standard, + Mesh from SMESHDS, + MapIntegerHasher from TColStd); + + class ListOfPtrHypothesis instantiates List from TCollection (PtrHypothesis from SMESHDS); + + + class DataMapOfShapeListOfPtrHypothesis instantiates DataMap from TCollection (Shape from TopoDS, + ListOfPtrHypothesis from SMESHDS, + ShapeMapHasher from TopTools); + + class ListOfAsciiString instantiates List from TCollection (AsciiString from TCollection); + + class ListOfCommand instantiates List from TCollection (Command from SMESHDS); + + +end SMESHDS; \ No newline at end of file diff --git a/src/SMESHDS/SMESHDS_Command.cdl b/src/SMESHDS/SMESHDS_Command.cdl new file mode 100644 index 000000000..1291a5e48 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Command.cdl @@ -0,0 +1,62 @@ +-- File : SMESHDS_Script.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + +class Command from SMESHDS inherits TShared from MMgt + +uses + + Integer from Standard, + Real from Standard, + CommandType from SMESHDS, + ListOfReal from TColStd, + ListOfInteger from TColStd + +is + + Create (aType : CommandType from SMESHDS) returns Command from SMESHDS; + + AddNode(me: mutable; NewNodeID : Integer; x,y,z : Real); + + AddEdge(me: mutable; NewEdgeID : Integer; idnode1, idnode2 : Integer); + + AddFace(me: mutable; NewFaceID : Integer; idnode1, idnode2, idnode3 : Integer); + + AddFace(me: mutable; NewFaceID : Integer; idnode1, idnode2, idnode3, idnode4 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer); + + MoveNode(me: mutable; NewNodeID : Integer; x,y,z : Real); + + RemoveNode (me: mutable; NodeID : Integer); + + RemoveElement(me: mutable; ElementID : Integer); + + GetType (me: mutable) returns CommandType from SMESHDS; + + GetNumber (me: mutable) returns Integer from Standard; + + GetIndexes (me: mutable) + ---C++ :return const & + returns ListOfInteger from TColStd; + + GetCoords (me: mutable) + ---C++ :return const & + returns ListOfReal from TColStd; + + + +fields + myType : CommandType from SMESHDS; + myNumber : Integer from Standard; + myReals : ListOfReal from TColStd; + myIntegers : ListOfInteger from TColStd; +end Script; diff --git a/src/SMESHDS/SMESHDS_Command.cxx b/src/SMESHDS/SMESHDS_Command.cxx new file mode 100644 index 000000000..1f59cd502 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Command.cxx @@ -0,0 +1,287 @@ +using namespace std; +//============================================================================= +// File : SMESH_Command.cxx +// Created : +// Author : Yves FRICAUD, OCC +// Project : SALOME +// Copyright : OCC 2002 +// $Header: +//============================================================================= + +#include "SMESHDS_Command.ixx" +#include "SMESHDS_CommandType.hxx" +#include "utilities.h" + +//======================================================================= +//function : +//purpose : +//======================================================================= +SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType) + : myType(aType), myNumber(0) +{} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddNode(const Standard_Integer NewNodeID, + const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + if (!myType == SMESHDS_AddNode) { + MESSAGE("SMESHDS_Command::AddNode : Bad Type"); + return; + } + myIntegers.Append(NewNodeID); + myReals.Append(x); + myReals.Append(y); + myReals.Append(z); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::MoveNode(const Standard_Integer NodeID, + const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + if (!myType == SMESHDS_MoveNode) { + MESSAGE("SMESHDS_Command::MoveNode : Bad Type"); + return; + } + myIntegers.Append(NodeID); + myReals.Append(x); + myReals.Append(y); + myReals.Append(z); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddEdge(const Standard_Integer NewEdgeID, + const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + if (!myType == SMESHDS_AddEdge) { + MESSAGE("SMESHDS_Command::AddEdge : Bad Type"); + return; + } + myIntegers.Append(NewEdgeID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + if (!myType == SMESHDS_AddTriangle) { + MESSAGE("SMESHDS_Command::AddFace : Bad Type"); + return; + } + myIntegers.Append(NewFaceID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddFace(const Standard_Integer NewFaceID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + if (!myType == SMESHDS_AddQuadrangle) { + MESSAGE("SMESHDS_Command::AddFace : Bad Type"); + return; + } + myIntegers.Append(NewFaceID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myIntegers.Append(idnode4); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + if (!myType == SMESHDS_AddTetrahedron) { + MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); + return; + } + myIntegers.Append(NewVolID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myIntegers.Append(idnode4); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) +{ + if (!myType == SMESHDS_AddPyramid) { + MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); + return; + } + myIntegers.Append(NewVolID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myIntegers.Append(idnode4); + myIntegers.Append(idnode5); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) +{ + if (!myType == SMESHDS_AddPrism) { + MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); + return; + } + myIntegers.Append(NewVolID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myIntegers.Append(idnode4); + myIntegers.Append(idnode5); + myIntegers.Append(idnode6); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::AddVolume(const Standard_Integer NewVolID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) +{ + if (!myType == SMESHDS_AddHexahedron) { + MESSAGE("SMESHDS_Command::AddVolume : Bad Type"); + return; + } + myIntegers.Append(NewVolID); + myIntegers.Append(idnode1); + myIntegers.Append(idnode2); + myIntegers.Append(idnode3); + myIntegers.Append(idnode4); + myIntegers.Append(idnode5); + myIntegers.Append(idnode6); + myIntegers.Append(idnode7); + myIntegers.Append(idnode8); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::RemoveNode(const Standard_Integer NodeID) +{ + if (!myType == SMESHDS_RemoveNode) { + MESSAGE("SMESHDS_Command::RemoveNode : Bad Type"); + return; + } + myIntegers.Append(NodeID); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Command::RemoveElement(const Standard_Integer ElementID) +{ + if (!myType == SMESHDS_RemoveElement) { + MESSAGE("SMESHDS_Command::RemoveElement : Bad Type"); + return; + } + myIntegers.Append(ElementID); + myNumber++; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +SMESHDS_CommandType SMESHDS_Command::GetType() +{ + return myType; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Command::GetNumber() +{ + return myNumber; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +const TColStd_ListOfInteger& SMESHDS_Command::GetIndexes() +{ + return myIntegers; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +const TColStd_ListOfReal& SMESHDS_Command::GetCoords() +{ + return myReals; +} diff --git a/src/SMESHDS/SMESHDS_Command.hxx b/src/SMESHDS/SMESHDS_Command.hxx new file mode 100644 index 000000000..edfe89a2b --- /dev/null +++ b/src/SMESHDS/SMESHDS_Command.hxx @@ -0,0 +1,131 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_Command_HeaderFile +#define _SMESHDS_Command_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Command_HeaderFile +#include "Handle_SMESHDS_Command.hxx" +#endif + +#ifndef _SMESHDS_CommandType_HeaderFile +#include "SMESHDS_CommandType.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfReal_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +class TColStd_ListOfInteger; +class TColStd_ListOfReal; + + +class SMESHDS_Command : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_Command(const SMESHDS_CommandType aType); +Standard_EXPORT void AddNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT void AddEdge(const Standard_Integer NewEdgeID,const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ; +Standard_EXPORT void MoveNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT void RemoveNode(const Standard_Integer NodeID) ; +Standard_EXPORT void RemoveElement(const Standard_Integer ElementID) ; +Standard_EXPORT SMESHDS_CommandType GetType() ; +Standard_EXPORT Standard_Integer GetNumber() ; +Standard_EXPORT const TColStd_ListOfInteger& GetIndexes() ; +Standard_EXPORT const TColStd_ListOfReal& GetCoords() ; +Standard_EXPORT ~SMESHDS_Command(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Command_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMESHDS_CommandType myType; +Standard_Integer myNumber; +TColStd_ListOfReal myReals; +TColStd_ListOfInteger myIntegers; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_Command.ixx b/src/SMESHDS/SMESHDS_Command.ixx new file mode 100644 index 000000000..b3a2f6558 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Command.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_Command.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESHDS_Command::~SMESHDS_Command() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_Command_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_Command", + sizeof(SMESHDS_Command), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_Command) Handle(SMESHDS_Command)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_Command) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_Command))) { + _anOtherObject = Handle(SMESHDS_Command)((Handle(SMESHDS_Command)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_Command::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_Command) ; +} +Standard_Boolean SMESHDS_Command::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_Command) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMESHDS_Command::~Handle_SMESHDS_Command() {} + diff --git a/src/SMESHDS/SMESHDS_Command.jxx b/src/SMESHDS/SMESHDS_Command.jxx new file mode 100644 index 000000000..0c3f436e3 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Command.jxx @@ -0,0 +1,9 @@ +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfReal_HeaderFile +#include +#endif +#ifndef _SMESHDS_Command_HeaderFile +#include "SMESHDS_Command.hxx" +#endif diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx new file mode 100644 index 000000000..2cd0c2e70 --- /dev/null +++ b/src/SMESHDS/SMESHDS_CommandType.hxx @@ -0,0 +1,37 @@ +// File generated by CPPExt (Enum) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_CommandType_HeaderFile +#define _SMESHDS_CommandType_HeaderFile + +enum SMESHDS_CommandType { + SMESHDS_AddNode, +SMESHDS_AddEdge, +SMESHDS_AddTriangle, +SMESHDS_AddQuadrangle, +SMESHDS_AddTetrahedron, +SMESHDS_AddPyramid, +SMESHDS_AddPrism, +SMESHDS_AddHexahedron, +SMESHDS_RemoveNode, +SMESHDS_RemoveElement, +SMESHDS_MoveNode +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx new file mode 100644 index 000000000..4f55b0e99 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx @@ -0,0 +1,106 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile +#define _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#include "Handle_SMESHDS_Mesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" +#endif +class Standard_NoSuchObject; +class SMESHDS_Mesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerMesh; +class SMESHDS_DataMapNodeOfDataMapOfIntegerMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh(); +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh(const SMESHDS_DataMapOfIntegerMesh& aMap); +Standard_EXPORT void Initialize(const SMESHDS_DataMapOfIntegerMesh& aMap) ; +Standard_EXPORT const Standard_Integer& Key() const; +Standard_EXPORT const Handle_SMESHDS_Mesh& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx new file mode 100644 index 000000000..ae6f33089 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_0.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_Mesh_HeaderFile +#include "SMESHDS_Mesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_Mesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx new file mode 100644 index 000000000..381bffad8 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx @@ -0,0 +1,105 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" +#endif +class Standard_NoSuchObject; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerPtrHypothesis; +class SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis(); +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis(const SMESHDS_DataMapOfIntegerPtrHypothesis& aMap); +Standard_EXPORT void Initialize(const SMESHDS_DataMapOfIntegerPtrHypothesis& aMap) ; +Standard_EXPORT const Standard_Integer& Key() const; +Standard_EXPORT const SMESHDS_PtrHypothesis& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx new file mode 100644 index 000000000..9075c9e0c --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_0.cxx @@ -0,0 +1,47 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem SMESHDS_PtrHypothesis +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx new file mode 100644 index 000000000..9aad9ddf1 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx @@ -0,0 +1,106 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_HeaderFile +#define _SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" +#endif +class Standard_NoSuchObject; +class SMESHDS_SubMesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerSubMesh; +class SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh(); +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh(const SMESHDS_DataMapOfIntegerSubMesh& aMap); +Standard_EXPORT void Initialize(const SMESHDS_DataMapOfIntegerSubMesh& aMap) ; +Standard_EXPORT const Standard_Integer& Key() const; +Standard_EXPORT const Handle_SMESHDS_SubMesh& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx new file mode 100644 index 000000000..d1b37e769 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_0.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include "TColStd_MapIntegerHasher.hxx" +#endif +#ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx new file mode 100644 index 000000000..1f4168f5c --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx @@ -0,0 +1,101 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif +class Standard_NoSuchObject; +class TopoDS_Shape; +class SMESHDS_ListOfPtrHypothesis; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapOfShapeListOfPtrHypothesis; +class SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis(); +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis(const SMESHDS_DataMapOfShapeListOfPtrHypothesis& aMap); +Standard_EXPORT void Initialize(const SMESHDS_DataMapOfShapeListOfPtrHypothesis& aMap) ; +Standard_EXPORT const TopoDS_Shape& Key() const; +Standard_EXPORT const SMESHDS_ListOfPtrHypothesis& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..84c6da0f4 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem SMESHDS_ListOfPtrHypothesis +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx new file mode 100644 index 000000000..97f76a5ee --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx @@ -0,0 +1,104 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_HeaderFile +#define _SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" +#endif +class Standard_NoSuchObject; +class TopoDS_Shape; +class SMESHDS_SubMesh; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapOfShapeSubMesh; +class SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh : public TCollection_BasicMapIterator { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh(); +Standard_EXPORT SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh(const SMESHDS_DataMapOfShapeSubMesh& aMap); +Standard_EXPORT void Initialize(const SMESHDS_DataMapOfShapeSubMesh& aMap) ; +Standard_EXPORT const TopoDS_Shape& Key() const; +Standard_EXPORT const Handle_SMESHDS_SubMesh& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx new file mode 100644 index 000000000..7bc734d56 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapOfShapeSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx new file mode 100644 index 000000000..7dfbaf970 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#define _SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#include "Handle_SMESHDS_Mesh.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMESHDS_Mesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerMesh; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh; + + +class SMESHDS_DataMapNodeOfDataMapOfIntegerMesh : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_DataMapNodeOfDataMapOfIntegerMesh(const Standard_Integer& K,const Handle(SMESHDS_Mesh)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Standard_Integer& Key() const; +Standard_EXPORT inline Handle_SMESHDS_Mesh& Value() const; +Standard_EXPORT ~SMESHDS_DataMapNodeOfDataMapOfIntegerMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +Handle_SMESHDS_Mesh myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_Mesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerMesh +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx new file mode 100644 index 000000000..adf13258f --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_0.cxx @@ -0,0 +1,99 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_Mesh_HeaderFile +#include "SMESHDS_Mesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx" +#endif +SMESHDS_DataMapNodeOfDataMapOfIntegerMesh::~SMESHDS_DataMapNodeOfDataMapOfIntegerMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_DataMapNodeOfDataMapOfIntegerMesh", + sizeof(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh))) { + _anOtherObject = Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)((Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_DataMapNodeOfDataMapOfIntegerMesh::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) ; +} +Standard_Boolean SMESHDS_DataMapNodeOfDataMapOfIntegerMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerMesh) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh::~Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_Mesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx new file mode 100644 index 000000000..b767527ab --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx @@ -0,0 +1,140 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerPtrHypothesis; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis; + + +class SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis(const Standard_Integer& K,const SMESHDS_PtrHypothesis& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Standard_Integer& Key() const; +Standard_EXPORT inline SMESHDS_PtrHypothesis& Value() const; +Standard_EXPORT ~SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +SMESHDS_PtrHypothesis myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem SMESHDS_PtrHypothesis +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerPtrHypothesis +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx new file mode 100644 index 000000000..5d89d1b8e --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_0.cxx @@ -0,0 +1,96 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx" +#endif +SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis::~SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis", + sizeof(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis))) { + _anOtherObject = Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)((Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) ; +} +Standard_Boolean SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis::~Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem SMESHDS_PtrHypothesis +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx new file mode 100644 index 000000000..ad80d4535 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#define _SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMESHDS_SubMesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapOfIntegerSubMesh; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh; + + +class SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh(const Standard_Integer& K,const Handle(SMESHDS_SubMesh)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Standard_Integer& Key() const; +Standard_EXPORT inline Handle_SMESHDS_SubMesh& Value() const; +Standard_EXPORT ~SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myKey; +Handle_SMESHDS_SubMesh myValue; + + +}; + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerSubMesh +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx new file mode 100644 index 000000000..eb70cce88 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_0.cxx @@ -0,0 +1,99 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx" +#endif +SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh::~SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh", + sizeof(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh))) { + _anOtherObject = Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)((Handle(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) ; +} +Standard_Boolean SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh::~Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh() {} +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx new file mode 100644 index 000000000..3830a5669 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx @@ -0,0 +1,142 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class TopoDS_Shape; +class SMESHDS_ListOfPtrHypothesis; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapOfShapeListOfPtrHypothesis; +class SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis; + + +class SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis(const TopoDS_Shape& K,const SMESHDS_ListOfPtrHypothesis& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline TopoDS_Shape& Key() const; +Standard_EXPORT inline SMESHDS_ListOfPtrHypothesis& Value() const; +Standard_EXPORT ~SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TopoDS_Shape myKey; +SMESHDS_ListOfPtrHypothesis myValue; + + +}; + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem SMESHDS_ListOfPtrHypothesis +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..1d1e94509 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_0.cxx @@ -0,0 +1,102 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif +SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis::~SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis", + sizeof(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis))) { + _anOtherObject = Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)((Handle(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) ; +} +Standard_Boolean SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis::~Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis() {} +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem SMESHDS_ListOfPtrHypothesis +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx new file mode 100644 index 000000000..037d8212b --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx @@ -0,0 +1,142 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#define _SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMESHDS_SubMesh; +class TopoDS_Shape; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapOfShapeSubMesh; +class SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh; + + +class SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh(const TopoDS_Shape& K,const Handle(SMESHDS_SubMesh)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline TopoDS_Shape& Key() const; +Standard_EXPORT inline Handle_SMESHDS_SubMesh& Value() const; +Standard_EXPORT ~SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TopoDS_Shape myKey; +Handle_SMESHDS_SubMesh myValue; + + +}; + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeSubMesh +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx new file mode 100644 index 000000000..2fd79b987 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_0.cxx @@ -0,0 +1,102 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapOfShapeSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx" +#endif +SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh::~SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh", + sizeof(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh))) { + _anOtherObject = Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)((Handle(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) ; +} +Standard_Boolean SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh::~Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh() {} +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx new file mode 100644 index 000000000..a2be5aa8f --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh.hxx @@ -0,0 +1,135 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapOfIntegerMesh_HeaderFile +#define _SMESHDS_DataMapOfIntegerMesh_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#include "Handle_SMESHDS_Mesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class SMESHDS_Mesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapNodeOfDataMapOfIntegerMesh; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapOfIntegerMesh : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapOfIntegerMesh(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMESHDS_DataMapOfIntegerMesh& Assign(const SMESHDS_DataMapOfIntegerMesh& Other) ; + SMESHDS_DataMapOfIntegerMesh& operator =(const SMESHDS_DataMapOfIntegerMesh& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMESHDS_DataMapOfIntegerMesh() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const Handle(SMESHDS_Mesh)& I) ; +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +Standard_EXPORT const Handle_SMESHDS_Mesh& Find(const Standard_Integer& K) const; + const Handle_SMESHDS_Mesh& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMESHDS_Mesh& ChangeFind(const Standard_Integer& K) ; + Handle_SMESHDS_Mesh& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_DataMapOfIntegerMesh(const SMESHDS_DataMapOfIntegerMesh& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh_0.cxx new file mode 100644 index 000000000..f32f16850 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerMesh_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapOfIntegerMesh.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_Mesh_HeaderFile +#include "SMESHDS_Mesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_Mesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis.hxx new file mode 100644 index 000000000..35cfbe72b --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis.hxx @@ -0,0 +1,134 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapOfIntegerPtrHypothesis : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapOfIntegerPtrHypothesis(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMESHDS_DataMapOfIntegerPtrHypothesis& Assign(const SMESHDS_DataMapOfIntegerPtrHypothesis& Other) ; + SMESHDS_DataMapOfIntegerPtrHypothesis& operator =(const SMESHDS_DataMapOfIntegerPtrHypothesis& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMESHDS_DataMapOfIntegerPtrHypothesis() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const SMESHDS_PtrHypothesis& I) ; +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +Standard_EXPORT const SMESHDS_PtrHypothesis& Find(const Standard_Integer& K) const; + const SMESHDS_PtrHypothesis& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + +Standard_EXPORT SMESHDS_PtrHypothesis& ChangeFind(const Standard_Integer& K) ; + SMESHDS_PtrHypothesis& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_DataMapOfIntegerPtrHypothesis(const SMESHDS_DataMapOfIntegerPtrHypothesis& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx new file mode 100644 index 000000000..3d0619e64 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerPtrHypothesis_0.cxx @@ -0,0 +1,50 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapOfIntegerPtrHypothesis.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem SMESHDS_PtrHypothesis +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh.hxx new file mode 100644 index 000000000..b9d0c5763 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh.hxx @@ -0,0 +1,135 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile +#define _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class SMESHDS_SubMesh; +class TColStd_MapIntegerHasher; +class SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh; +class SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapOfIntegerSubMesh : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapOfIntegerSubMesh(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMESHDS_DataMapOfIntegerSubMesh& Assign(const SMESHDS_DataMapOfIntegerSubMesh& Other) ; + SMESHDS_DataMapOfIntegerSubMesh& operator =(const SMESHDS_DataMapOfIntegerSubMesh& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMESHDS_DataMapOfIntegerSubMesh() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const Standard_Integer& K,const Handle(SMESHDS_SubMesh)& I) ; +Standard_EXPORT Standard_Boolean IsBound(const Standard_Integer& K) const; +Standard_EXPORT Standard_Boolean UnBind(const Standard_Integer& K) ; +Standard_EXPORT const Handle_SMESHDS_SubMesh& Find(const Standard_Integer& K) const; + const Handle_SMESHDS_SubMesh& operator()(const Standard_Integer& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMESHDS_SubMesh& ChangeFind(const Standard_Integer& K) ; + Handle_SMESHDS_SubMesh& operator()(const Standard_Integer& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_DataMapOfIntegerSubMesh(const SMESHDS_DataMapOfIntegerSubMesh& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh_0.cxx new file mode 100644 index 000000000..c6ea23569 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfIntegerSubMesh_0.cxx @@ -0,0 +1,53 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapOfIntegerSubMesh.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TColStd_MapIntegerHasher_HeaderFile +#include "TColStd_MapIntegerHasher.hxx" +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh.hxx" +#endif + + +#define TheKey Standard_Integer +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TColStd_MapIntegerHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfIntegerSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfIntegerSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfIntegerSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx new file mode 100644 index 000000000..ea840f863 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx @@ -0,0 +1,133 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile +#define _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TopoDS_Shape; +class SMESHDS_ListOfPtrHypothesis; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis; +class SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapOfShapeListOfPtrHypothesis : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapOfShapeListOfPtrHypothesis(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMESHDS_DataMapOfShapeListOfPtrHypothesis& Assign(const SMESHDS_DataMapOfShapeListOfPtrHypothesis& Other) ; + SMESHDS_DataMapOfShapeListOfPtrHypothesis& operator =(const SMESHDS_DataMapOfShapeListOfPtrHypothesis& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMESHDS_DataMapOfShapeListOfPtrHypothesis() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const TopoDS_Shape& K,const SMESHDS_ListOfPtrHypothesis& I) ; +Standard_EXPORT Standard_Boolean IsBound(const TopoDS_Shape& K) const; +Standard_EXPORT Standard_Boolean UnBind(const TopoDS_Shape& K) ; +Standard_EXPORT const SMESHDS_ListOfPtrHypothesis& Find(const TopoDS_Shape& K) const; + const SMESHDS_ListOfPtrHypothesis& operator()(const TopoDS_Shape& K) const +{ + return Find(K); +} + +Standard_EXPORT SMESHDS_ListOfPtrHypothesis& ChangeFind(const TopoDS_Shape& K) ; + SMESHDS_ListOfPtrHypothesis& operator()(const TopoDS_Shape& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_DataMapOfShapeListOfPtrHypothesis(const SMESHDS_DataMapOfShapeListOfPtrHypothesis& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..b14000b33 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfShapeListOfPtrHypothesis_0.cxx @@ -0,0 +1,56 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis.hxx" +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem SMESHDS_ListOfPtrHypothesis +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeListOfPtrHypothesis_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeListOfPtrHypothesis +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx b/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx new file mode 100644 index 000000000..4de040e1e --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh.hxx @@ -0,0 +1,136 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_DataMapOfShapeSubMesh_HeaderFile +#define _SMESHDS_DataMapOfShapeSubMesh_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +#ifndef _Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#include "Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class TopoDS_Shape; +class SMESHDS_SubMesh; +class TopTools_ShapeMapHasher; +class SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh; +class SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_DataMapOfShapeSubMesh : public TCollection_BasicMap { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_DataMapOfShapeSubMesh(const Standard_Integer NbBuckets = 1); +Standard_EXPORT SMESHDS_DataMapOfShapeSubMesh& Assign(const SMESHDS_DataMapOfShapeSubMesh& Other) ; + SMESHDS_DataMapOfShapeSubMesh& operator =(const SMESHDS_DataMapOfShapeSubMesh& Other) +{ + return Assign(Other); +} + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; +Standard_EXPORT void Clear() ; +~SMESHDS_DataMapOfShapeSubMesh() +{ + Clear(); +} + +Standard_EXPORT Standard_Boolean Bind(const TopoDS_Shape& K,const Handle(SMESHDS_SubMesh)& I) ; +Standard_EXPORT Standard_Boolean IsBound(const TopoDS_Shape& K) const; +Standard_EXPORT Standard_Boolean UnBind(const TopoDS_Shape& K) ; +Standard_EXPORT const Handle_SMESHDS_SubMesh& Find(const TopoDS_Shape& K) const; + const Handle_SMESHDS_SubMesh& operator()(const TopoDS_Shape& K) const +{ + return Find(K); +} + +Standard_EXPORT Handle_SMESHDS_SubMesh& ChangeFind(const TopoDS_Shape& K) ; + Handle_SMESHDS_SubMesh& operator()(const TopoDS_Shape& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_DataMapOfShapeSubMesh(const SMESHDS_DataMapOfShapeSubMesh& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh_0.cxx b/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh_0.cxx new file mode 100644 index 000000000..cbde82037 --- /dev/null +++ b/src/SMESHDS/SMESHDS_DataMapOfShapeSubMesh_0.cxx @@ -0,0 +1,56 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_DataMapOfShapeSubMesh.hxx" + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh.hxx" +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem Handle_SMESHDS_SubMesh +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator SMESHDS_DataMapIteratorOfDataMapOfShapeSubMesh +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh +#define TCollection_DataMapNode_Type_() SMESHDS_DataMapNodeOfDataMapOfShapeSubMesh_Type_() +#define TCollection_DataMap SMESHDS_DataMapOfShapeSubMesh +#define TCollection_DataMap_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_Document.cdl b/src/SMESHDS/SMESHDS_Document.cdl new file mode 100644 index 000000000..d40ff4de0 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Document.cdl @@ -0,0 +1,66 @@ +-- File : SMESHDS_Document.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + +class Document from SMESHDS inherits TShared from MMgt + +uses + Integer from Standard, + Mesh from SMESHDS, + PtrHypothesis from SMESHDS, + DataMapOfIntegerMesh from SMESHDS, + DataMapOfIntegerPtrHypothesis from SMESHDS, + DataMapIteratorOfDataMapOfIntegerMesh from SMESHDS, + DataMapIteratorOfDataMapOfIntegerPtrHypothesis from SMESHDS +is + + Create (UserID : Integer from Standard) returns mutable Document; + + NewMesh (me : mutable) returns Integer from Standard; + + RemoveMesh (me : mutable; MeshID : Integer from Standard); + + GetMesh (me : mutable; MeshID : Integer from Standard) returns Mesh from SMESHDS; + + + AddHypothesis (me : mutable; H : PtrHypothesis from SMESHDS); + + RemoveHypothesis (me : mutable; HypID : Integer from Standard); + + GetHypothesis (me : mutable; HypID : Integer from Standard) returns PtrHypothesis from SMESHDS; + + NbMeshes (me : mutable) returns Integer from Standard; + + NbHypothesis (me : mutable) returns Integer from Standard; + + -- Iterator on Meshes + InitMeshesIterator(me : mutable); + + NextMesh (me : mutable); + + MoreMesh (me : mutable) returns Boolean from Standard; + + CurrentMesh (me : mutable ) returns Mesh from SMESHDS; + + + --Iterator on Hypothesis + InitHypothesisIterator (me : mutable ); + + NextHypothesis (me : mutable ); + + MoreHypothesis (me : mutable ) returns Boolean from Standard; + + CurrentHypothesis (me : mutable) returns PtrHypothesis from SMESHDS; + +fields + myUserID : Integer from Standard; + myMeshes : DataMapOfIntegerMesh from SMESHDS; + myHypothesis : DataMapOfIntegerPtrHypothesis from SMESHDS; + + myMeshesIt : DataMapIteratorOfDataMapOfIntegerMesh from SMESHDS; + myHypothesisIt : DataMapIteratorOfDataMapOfIntegerPtrHypothesis from SMESHDS; + +end Document; + diff --git a/src/SMESHDS/SMESHDS_Document.cxx b/src/SMESHDS/SMESHDS_Document.cxx new file mode 100644 index 000000000..4b47835e4 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Document.cxx @@ -0,0 +1,173 @@ +using namespace std; +//============================================================================= +// File : SMESHDS_Document.cxx +// Created : +// Author : Yves FRICAUD, OCC +// Project : SALOME +// Copyright : OCC 2002 +// $Header: +//============================================================================= + +#include "SMESHDS_Document.ixx" +#include "SMESHDS_Hypothesis.hxx" + +#include + +//======================================================================= +//function : Create +//purpose : +//======================================================================= +SMESHDS_Document::SMESHDS_Document(const Standard_Integer UserID): myUserID(UserID) +{} + +//======================================================================= +//function : NewMesh +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Document::NewMesh() +{ + static Standard_Integer NewMeshID = 0; + NewMeshID++; + Handle (SMESHDS_Mesh) aNewMesh = new SMESHDS_Mesh (NewMeshID); + myMeshes.Bind(NewMeshID ,aNewMesh); + return NewMeshID; +} + +//======================================================================= +//function : GetMesh +//purpose : +//======================================================================= +Handle(SMESHDS_Mesh) SMESHDS_Document::GetMesh(const Standard_Integer MeshID) +{ + if (!myMeshes.IsBound(MeshID)) + Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh"); + return myMeshes.Find(MeshID); +} + +//======================================================================= +//function : RemoveMesh +//purpose : +//======================================================================= +void SMESHDS_Document::RemoveMesh(const Standard_Integer MeshID) +{ + if (!myMeshes.IsBound(MeshID)) + Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh"); + myMeshes.UnBind(MeshID); +} + +//======================================================================= +//function : AddHypothesis +//purpose : +//======================================================================= +void SMESHDS_Document::AddHypothesis(const SMESHDS_PtrHypothesis& H) +{ + myHypothesis.Bind (H->GetID(), H); +} + +//======================================================================= +//function : GetHypothesis +//purpose : +//======================================================================= +SMESHDS_PtrHypothesis SMESHDS_Document::GetHypothesis(const Standard_Integer HypID) +{ + if (!myHypothesis.IsBound(HypID)) + Standard_OutOfRange::Raise("SMESHDS_Document::GetHypothesis"); + return myHypothesis.Find(HypID); +} + +//======================================================================= +//function : RemoveHypothesis +//purpose : +//======================================================================= +void SMESHDS_Document::RemoveHypothesis(const Standard_Integer HypID) +{ + if (!myHypothesis.IsBound(HypID)) + Standard_OutOfRange::Raise("SMESHDS_Document::RemoveHypothesis"); + myMeshes.UnBind(HypID); +} + +//======================================================================= +//function : NbMeshes +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Document::NbMeshes() +{ + return myMeshes.Extent(); +} + +//======================================================================= +//function : NbHypothesis +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Document::NbHypothesis() +{ + return myHypothesis.Extent(); +} + +//======================================================================= +//function : InitMeshesIterator +//purpose : +//======================================================================= +void SMESHDS_Document::InitMeshesIterator() +{ + myMeshesIt.Initialize(myMeshes); +} +//======================================================================= +//function : NextMesh +//purpose : +//======================================================================= +void SMESHDS_Document::NextMesh() +{ + myMeshesIt.Next(); +} +//======================================================================= +//function : MoreMesh +//purpose : +//======================================================================= +Standard_Boolean SMESHDS_Document::MoreMesh() +{ + return myMeshesIt.More(); +} +//======================================================================= +//function : CurrentMesh +//purpose : +//======================================================================= +Handle_SMESHDS_Mesh SMESHDS_Document::CurrentMesh() +{ + return myMeshesIt.Value(); +} + +//======================================================================= +//function : InitHypothesisIterator +//purpose : +//======================================================================= +void SMESHDS_Document::InitHypothesisIterator() +{ + myHypothesisIt.Initialize(myHypothesis); +} +//======================================================================= +//function : NextMesh +//purpose : +//======================================================================= +void SMESHDS_Document::NextHypothesis() +{ + myHypothesisIt.Next(); +} +//======================================================================= +//function : MoreMesh +//purpose : +//======================================================================= +Standard_Boolean SMESHDS_Document::MoreHypothesis() +{ + return myHypothesisIt.More(); +} +//======================================================================= +//function : CurrentMesh +//purpose : +//======================================================================= +SMESHDS_PtrHypothesis SMESHDS_Document::CurrentHypothesis() +{ + return myHypothesisIt.Value(); +} + + diff --git a/src/SMESHDS/SMESHDS_Document.hxx b/src/SMESHDS/SMESHDS_Document.hxx new file mode 100644 index 000000000..3b1e79d01 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Document.hxx @@ -0,0 +1,141 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_Document_HeaderFile +#define _SMESHDS_Document_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Document_HeaderFile +#include "Handle_SMESHDS_Document.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis.hxx" +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#include "Handle_SMESHDS_Mesh.hxx" +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class SMESHDS_Mesh; + + +class SMESHDS_Document : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_Document(const Standard_Integer UserID); +Standard_EXPORT Standard_Integer NewMesh() ; +Standard_EXPORT void RemoveMesh(const Standard_Integer MeshID) ; +Standard_EXPORT Handle_SMESHDS_Mesh GetMesh(const Standard_Integer MeshID) ; +Standard_EXPORT void AddHypothesis(const SMESHDS_PtrHypothesis& H) ; +Standard_EXPORT void RemoveHypothesis(const Standard_Integer HypID) ; +Standard_EXPORT SMESHDS_PtrHypothesis GetHypothesis(const Standard_Integer HypID) ; +Standard_EXPORT Standard_Integer NbMeshes() ; +Standard_EXPORT Standard_Integer NbHypothesis() ; +Standard_EXPORT void InitMeshesIterator() ; +Standard_EXPORT void NextMesh() ; +Standard_EXPORT Standard_Boolean MoreMesh() ; +Standard_EXPORT Handle_SMESHDS_Mesh CurrentMesh() ; +Standard_EXPORT void InitHypothesisIterator() ; +Standard_EXPORT void NextHypothesis() ; +Standard_EXPORT Standard_Boolean MoreHypothesis() ; +Standard_EXPORT SMESHDS_PtrHypothesis CurrentHypothesis() ; +Standard_EXPORT ~SMESHDS_Document(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Document_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myUserID; +SMESHDS_DataMapOfIntegerMesh myMeshes; +SMESHDS_DataMapOfIntegerPtrHypothesis myHypothesis; +SMESHDS_DataMapIteratorOfDataMapOfIntegerMesh myMeshesIt; +SMESHDS_DataMapIteratorOfDataMapOfIntegerPtrHypothesis myHypothesisIt; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_Document.ixx b/src/SMESHDS/SMESHDS_Document.ixx new file mode 100644 index 000000000..6f3088618 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Document.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_Document.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESHDS_Document::~SMESHDS_Document() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_Document_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_Document", + sizeof(SMESHDS_Document), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_Document) Handle(SMESHDS_Document)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_Document) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_Document))) { + _anOtherObject = Handle(SMESHDS_Document)((Handle(SMESHDS_Document)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_Document::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_Document) ; +} +Standard_Boolean SMESHDS_Document::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_Document) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMESHDS_Document::~Handle_SMESHDS_Document() {} + diff --git a/src/SMESHDS/SMESHDS_Document.jxx b/src/SMESHDS/SMESHDS_Document.jxx new file mode 100644 index 000000000..b95b653ef --- /dev/null +++ b/src/SMESHDS/SMESHDS_Document.jxx @@ -0,0 +1,6 @@ +#ifndef _SMESHDS_Mesh_HeaderFile +#include "SMESHDS_Mesh.hxx" +#endif +#ifndef _SMESHDS_Document_HeaderFile +#include "SMESHDS_Document.hxx" +#endif diff --git a/src/SMESHDS/SMESHDS_Hypothesis.cxx b/src/SMESHDS/SMESHDS_Hypothesis.cxx new file mode 100644 index 000000000..ac186cb10 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Hypothesis.cxx @@ -0,0 +1,80 @@ +using namespace std; +//============================================================================= +// File : SMESHDS_Hypothesis.cxx +// Created : sam mai 18 08:08:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESHDS_Hypothesis.hxx" + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESHDS_Hypothesis::SMESHDS_Hypothesis(int hypId) +{ +// MESSAGE("SMESHDS_Hypothesis::SMESHDS_Hypothesis"); + _hypId = hypId; + _name = "generic"; +// SCRUTE(_name); +// SCRUTE(_hypId); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESHDS_Hypothesis::~SMESHDS_Hypothesis() +{ +// MESSAGE("SMESHDS_Hypothesis::~SMESHDS_Hypothesis"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESHDS_Hypothesis::GetName() +{ +// MESSAGE("SMESHDS_Hypothesis::GetName"); +// SCRUTE(_name); +// SCRUTE(&_name); + return _name.c_str(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESHDS_Hypothesis::GetID() +{ +// MESSAGE("SMESHDS_Hypothesis::GetId"); +// SCRUTE(_hypId); + return _hypId; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESHDS_Hypothesis::GetType() +{ +// MESSAGE("SMESHDS_Hypothesis::GetType"); +// SCRUTE(_type); + return _type; +} + diff --git a/src/SMESHDS/SMESHDS_Hypothesis.hxx b/src/SMESHDS/SMESHDS_Hypothesis.hxx new file mode 100644 index 000000000..878eb5468 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Hypothesis.hxx @@ -0,0 +1,47 @@ +//============================================================================= +// File : SMESHDS_Hypothesis.hxx +// Created : sam mai 18 08:07:54 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESHDS_HYPOTHESIS_HXX_ +#define _SMESHDS_HYPOTHESIS_HXX_ + +#if (__GNUC__>2) +#include +#include +#include +#else +#include +#include +#include +#endif + +// class istream; +// class ostream; + +class SMESHDS_Hypothesis +{ +public: + SMESHDS_Hypothesis(int hypId); + virtual ~SMESHDS_Hypothesis(); + + const char* GetName(); + int GetID(); + int GetType(); + + virtual ostream & SaveTo(ostream & save)=0; + virtual istream & LoadFrom(istream & load)=0; + +enum hypothesis_type {PARAM_ALGO, ALGO, ALGO_1D, ALGO_2D, ALGO_3D}; + +protected: + string _name; + int _hypId; + int _type; +}; + +#endif diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString.hxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString.hxx new file mode 100644 index 000000000..a55f538f3 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString.hxx @@ -0,0 +1,128 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListIteratorOfListOfAsciiString_HeaderFile +#define _SMESHDS_ListIteratorOfListOfAsciiString_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMESHDS_ListOfAsciiString; +class TCollection_AsciiString; +class SMESHDS_ListNodeOfListOfAsciiString; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListIteratorOfListOfAsciiString { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListIteratorOfListOfAsciiString(); +Standard_EXPORT SMESHDS_ListIteratorOfListOfAsciiString(const SMESHDS_ListOfAsciiString& L); +Standard_EXPORT void Initialize(const SMESHDS_ListOfAsciiString& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT TCollection_AsciiString& Value() const; + + +friend class SMESHDS_ListOfAsciiString; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString_0.cxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString_0.cxx new file mode 100644 index 000000000..bcdb4ce3c --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfAsciiString_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfAsciiString_HeaderFile +#include "SMESHDS_ListOfAsciiString.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#include "SMESHDS_ListNodeOfListOfAsciiString.hxx" +#endif + + +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand.hxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand.hxx new file mode 100644 index 000000000..4653e4abf --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand.hxx @@ -0,0 +1,131 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListIteratorOfListOfCommand_HeaderFile +#define _SMESHDS_ListIteratorOfListOfCommand_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Command_HeaderFile +#include "Handle_SMESHDS_Command.hxx" +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfCommand_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfCommand.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMESHDS_ListOfCommand; +class SMESHDS_Command; +class SMESHDS_ListNodeOfListOfCommand; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListIteratorOfListOfCommand { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListIteratorOfListOfCommand(); +Standard_EXPORT SMESHDS_ListIteratorOfListOfCommand(const SMESHDS_ListOfCommand& L); +Standard_EXPORT void Initialize(const SMESHDS_ListOfCommand& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT Handle_SMESHDS_Command& Value() const; + + +friend class SMESHDS_ListOfCommand; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand_0.cxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand_0.cxx new file mode 100644 index 000000000..d8c6e5873 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfCommand_0.cxx @@ -0,0 +1,46 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListIteratorOfListOfCommand.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfCommand_HeaderFile +#include "SMESHDS_ListOfCommand.hxx" +#endif +#ifndef _SMESHDS_Command_HeaderFile +#include "SMESHDS_Command.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfCommand_HeaderFile +#include "SMESHDS_ListNodeOfListOfCommand.hxx" +#endif + + +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx new file mode 100644 index 000000000..78ce7f62e --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx @@ -0,0 +1,130 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListIteratorOfListOfPtrHypothesis_HeaderFile +#define _SMESHDS_ListIteratorOfListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoMoreObject; +class Standard_NoSuchObject; +class SMESHDS_ListOfPtrHypothesis; +class SMESHDS_ListNodeOfListOfPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListIteratorOfListOfPtrHypothesis { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListIteratorOfListOfPtrHypothesis(); +Standard_EXPORT SMESHDS_ListIteratorOfListOfPtrHypothesis(const SMESHDS_ListOfPtrHypothesis& L); +Standard_EXPORT void Initialize(const SMESHDS_ListOfPtrHypothesis& L) ; +Standard_EXPORT inline Standard_Boolean More() const; +Standard_EXPORT void Next() ; +Standard_EXPORT SMESHDS_PtrHypothesis& Value() const; + + +friend class SMESHDS_ListOfPtrHypothesis; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Address current; +Standard_Address previous; + + +}; + +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..4fef95c17 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListIteratorOfListOfPtrHypothesis_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" + +#ifndef _Standard_NoMoreObject_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" +#endif + + +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString.hxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString.hxx new file mode 100644 index 000000000..c7faa8e8e --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString.hxx @@ -0,0 +1,127 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#define _SMESHDS_ListNodeOfListOfAsciiString_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx" +#endif + +#ifndef _TCollection_AsciiString_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class TCollection_AsciiString; +class SMESHDS_ListOfAsciiString; +class SMESHDS_ListIteratorOfListOfAsciiString; + + +class SMESHDS_ListNodeOfListOfAsciiString : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_ListNodeOfListOfAsciiString(const TCollection_AsciiString& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline TCollection_AsciiString& Value() const; +Standard_EXPORT ~SMESHDS_ListNodeOfListOfAsciiString(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_ListNodeOfListOfAsciiString_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TCollection_AsciiString myValue; + + +}; + +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString_0.cxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString_0.cxx new file mode 100644 index 000000000..be1d06ce7 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfAsciiString_0.cxx @@ -0,0 +1,89 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListNodeOfListOfAsciiString.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_ListOfAsciiString_HeaderFile +#include "SMESHDS_ListOfAsciiString.hxx" +#endif +#ifndef _SMESHDS_ListIteratorOfListOfAsciiString_HeaderFile +#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" +#endif +SMESHDS_ListNodeOfListOfAsciiString::~SMESHDS_ListNodeOfListOfAsciiString() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_ListNodeOfListOfAsciiString_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_ListNodeOfListOfAsciiString", + sizeof(SMESHDS_ListNodeOfListOfAsciiString), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_ListNodeOfListOfAsciiString) Handle(SMESHDS_ListNodeOfListOfAsciiString)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_ListNodeOfListOfAsciiString) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_ListNodeOfListOfAsciiString))) { + _anOtherObject = Handle(SMESHDS_ListNodeOfListOfAsciiString)((Handle(SMESHDS_ListNodeOfListOfAsciiString)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_ListNodeOfListOfAsciiString::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_ListNodeOfListOfAsciiString) ; +} +Standard_Boolean SMESHDS_ListNodeOfListOfAsciiString::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_ListNodeOfListOfAsciiString) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_ListNodeOfListOfAsciiString::~Handle_SMESHDS_ListNodeOfListOfAsciiString() {} +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand.hxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand.hxx new file mode 100644 index 000000000..5b8101b40 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand.hxx @@ -0,0 +1,127 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_ListNodeOfListOfCommand_HeaderFile +#define _SMESHDS_ListNodeOfListOfCommand_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfCommand_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfCommand.hxx" +#endif + +#ifndef _Handle_SMESHDS_Command_HeaderFile +#include "Handle_SMESHDS_Command.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMESHDS_Command; +class SMESHDS_ListOfCommand; +class SMESHDS_ListIteratorOfListOfCommand; + + +class SMESHDS_ListNodeOfListOfCommand : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_ListNodeOfListOfCommand(const Handle(SMESHDS_Command)& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline Handle_SMESHDS_Command& Value() const; +Standard_EXPORT ~SMESHDS_ListNodeOfListOfCommand(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_ListNodeOfListOfCommand_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMESHDS_Command myValue; + + +}; + +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand_0.cxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand_0.cxx new file mode 100644 index 000000000..087b064cf --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfCommand_0.cxx @@ -0,0 +1,92 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListNodeOfListOfCommand.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_Command_HeaderFile +#include "SMESHDS_Command.hxx" +#endif +#ifndef _SMESHDS_ListOfCommand_HeaderFile +#include "SMESHDS_ListOfCommand.hxx" +#endif +#ifndef _SMESHDS_ListIteratorOfListOfCommand_HeaderFile +#include "SMESHDS_ListIteratorOfListOfCommand.hxx" +#endif +SMESHDS_ListNodeOfListOfCommand::~SMESHDS_ListNodeOfListOfCommand() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_ListNodeOfListOfCommand_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_ListNodeOfListOfCommand", + sizeof(SMESHDS_ListNodeOfListOfCommand), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_ListNodeOfListOfCommand) Handle(SMESHDS_ListNodeOfListOfCommand)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_ListNodeOfListOfCommand) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_ListNodeOfListOfCommand))) { + _anOtherObject = Handle(SMESHDS_ListNodeOfListOfCommand)((Handle(SMESHDS_ListNodeOfListOfCommand)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_ListNodeOfListOfCommand::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_ListNodeOfListOfCommand) ; +} +Standard_Boolean SMESHDS_ListNodeOfListOfCommand::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_ListNodeOfListOfCommand) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_ListNodeOfListOfCommand::~Handle_SMESHDS_ListNodeOfListOfCommand() {} +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis.hxx new file mode 100644 index 000000000..032c27848 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis.hxx @@ -0,0 +1,126 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#define _SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" +#endif + +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class SMESHDS_ListOfPtrHypothesis; +class SMESHDS_ListIteratorOfListOfPtrHypothesis; + + +class SMESHDS_ListNodeOfListOfPtrHypothesis : public TCollection_MapNode { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT inline SMESHDS_ListNodeOfListOfPtrHypothesis(const SMESHDS_PtrHypothesis& I,const TCollection_MapNodePtr& n); +Standard_EXPORT inline SMESHDS_PtrHypothesis& Value() const; +Standard_EXPORT ~SMESHDS_ListNodeOfListOfPtrHypothesis(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_ListNodeOfListOfPtrHypothesis_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMESHDS_PtrHypothesis myValue; + + +}; + +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..4d47be60f --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListNodeOfListOfPtrHypothesis_0.cxx @@ -0,0 +1,89 @@ +using namespace std; +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_ListIteratorOfListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#endif +SMESHDS_ListNodeOfListOfPtrHypothesis::~SMESHDS_ListNodeOfListOfPtrHypothesis() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_ListNodeOfListOfPtrHypothesis", + sizeof(SMESHDS_ListNodeOfListOfPtrHypothesis), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_ListNodeOfListOfPtrHypothesis) Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_ListNodeOfListOfPtrHypothesis) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_ListNodeOfListOfPtrHypothesis))) { + _anOtherObject = Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)((Handle(SMESHDS_ListNodeOfListOfPtrHypothesis)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_ListNodeOfListOfPtrHypothesis::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_ListNodeOfListOfPtrHypothesis) ; +} +Standard_Boolean SMESHDS_ListNodeOfListOfPtrHypothesis::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_ListNodeOfListOfPtrHypothesis) == AType || TCollection_MapNode::IsKind(AType)); +} +Handle_SMESHDS_ListNodeOfListOfPtrHypothesis::~Handle_SMESHDS_ListNodeOfListOfPtrHypothesis() {} +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListOfAsciiString.hxx b/src/SMESHDS/SMESHDS_ListOfAsciiString.hxx new file mode 100644 index 000000000..189f3a925 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfAsciiString.hxx @@ -0,0 +1,152 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListOfAsciiString_HeaderFile +#define _SMESHDS_ListOfAsciiString_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfAsciiString.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMESHDS_ListIteratorOfListOfAsciiString; +class TCollection_AsciiString; +class SMESHDS_ListNodeOfListOfAsciiString; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListOfAsciiString { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListOfAsciiString(); +Standard_EXPORT void Assign(const SMESHDS_ListOfAsciiString& Other) ; + void operator=(const SMESHDS_ListOfAsciiString& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMESHDS_ListOfAsciiString() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const TCollection_AsciiString& I) ; +Standard_EXPORT void Prepend(SMESHDS_ListOfAsciiString& Other) ; +Standard_EXPORT void Append(const TCollection_AsciiString& I) ; +Standard_EXPORT void Append(SMESHDS_ListOfAsciiString& Other) ; +Standard_EXPORT TCollection_AsciiString& First() const; +Standard_EXPORT TCollection_AsciiString& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMESHDS_ListIteratorOfListOfAsciiString& It) ; +Standard_EXPORT void InsertBefore(const TCollection_AsciiString& I,SMESHDS_ListIteratorOfListOfAsciiString& It) ; +Standard_EXPORT void InsertBefore(SMESHDS_ListOfAsciiString& Other,SMESHDS_ListIteratorOfListOfAsciiString& It) ; +Standard_EXPORT void InsertAfter(const TCollection_AsciiString& I,SMESHDS_ListIteratorOfListOfAsciiString& It) ; +Standard_EXPORT void InsertAfter(SMESHDS_ListOfAsciiString& Other,SMESHDS_ListIteratorOfListOfAsciiString& It) ; + + +friend class SMESHDS_ListIteratorOfListOfAsciiString; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_ListOfAsciiString(const SMESHDS_ListOfAsciiString& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx b/src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx new file mode 100644 index 000000000..85ab425f3 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfAsciiString_0.cxx @@ -0,0 +1,40 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListOfAsciiString.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListIteratorOfListOfAsciiString_HeaderFile +#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfAsciiString_HeaderFile +#include "SMESHDS_ListNodeOfListOfAsciiString.hxx" +#endif + + +#define Item TCollection_AsciiString +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfAsciiString +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfAsciiString +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfAsciiString_Type_() +#define TCollection_List SMESHDS_ListOfAsciiString +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListOfCommand.hxx b/src/SMESHDS/SMESHDS_ListOfCommand.hxx new file mode 100644 index 000000000..4cd94f3b1 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfCommand.hxx @@ -0,0 +1,155 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListOfCommand_HeaderFile +#define _SMESHDS_ListOfCommand_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Command_HeaderFile +#include "Handle_SMESHDS_Command.hxx" +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfCommand_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfCommand.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMESHDS_ListIteratorOfListOfCommand; +class SMESHDS_Command; +class SMESHDS_ListNodeOfListOfCommand; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListOfCommand { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListOfCommand(); +Standard_EXPORT void Assign(const SMESHDS_ListOfCommand& Other) ; + void operator=(const SMESHDS_ListOfCommand& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMESHDS_ListOfCommand() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const Handle(SMESHDS_Command)& I) ; +Standard_EXPORT void Prepend(SMESHDS_ListOfCommand& Other) ; +Standard_EXPORT void Append(const Handle(SMESHDS_Command)& I) ; +Standard_EXPORT void Append(SMESHDS_ListOfCommand& Other) ; +Standard_EXPORT Handle_SMESHDS_Command& First() const; +Standard_EXPORT Handle_SMESHDS_Command& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMESHDS_ListIteratorOfListOfCommand& It) ; +Standard_EXPORT void InsertBefore(const Handle(SMESHDS_Command)& I,SMESHDS_ListIteratorOfListOfCommand& It) ; +Standard_EXPORT void InsertBefore(SMESHDS_ListOfCommand& Other,SMESHDS_ListIteratorOfListOfCommand& It) ; +Standard_EXPORT void InsertAfter(const Handle(SMESHDS_Command)& I,SMESHDS_ListIteratorOfListOfCommand& It) ; +Standard_EXPORT void InsertAfter(SMESHDS_ListOfCommand& Other,SMESHDS_ListIteratorOfListOfCommand& It) ; + + +friend class SMESHDS_ListIteratorOfListOfCommand; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_ListOfCommand(const SMESHDS_ListOfCommand& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListOfCommand_0.cxx b/src/SMESHDS/SMESHDS_ListOfCommand_0.cxx new file mode 100644 index 000000000..613b03cb6 --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfCommand_0.cxx @@ -0,0 +1,43 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListOfCommand.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListIteratorOfListOfCommand_HeaderFile +#include "SMESHDS_ListIteratorOfListOfCommand.hxx" +#endif +#ifndef _SMESHDS_Command_HeaderFile +#include "SMESHDS_Command.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfCommand_HeaderFile +#include "SMESHDS_ListNodeOfListOfCommand.hxx" +#endif + + +#define Item Handle_SMESHDS_Command +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfCommand +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfCommand +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfCommand_Type_() +#define TCollection_List SMESHDS_ListOfCommand +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx b/src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx new file mode 100644 index 000000000..f303d07be --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfPtrHypothesis.hxx @@ -0,0 +1,154 @@ +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#define _SMESHDS_ListOfPtrHypothesis_HeaderFile + +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Handle_SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#include "Handle_SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class SMESHDS_ListIteratorOfListOfPtrHypothesis; +class SMESHDS_ListNodeOfListOfPtrHypothesis; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + +class SMESHDS_ListOfPtrHypothesis { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_ListOfPtrHypothesis(); +Standard_EXPORT void Assign(const SMESHDS_ListOfPtrHypothesis& Other) ; + void operator=(const SMESHDS_ListOfPtrHypothesis& Other) +{ + Assign(Other); +} + +Standard_EXPORT Standard_Integer Extent() const; +Standard_EXPORT void Clear() ; +~SMESHDS_ListOfPtrHypothesis() +{ + Clear(); +} + +Standard_EXPORT inline Standard_Boolean IsEmpty() const; +Standard_EXPORT void Prepend(const SMESHDS_PtrHypothesis& I) ; +Standard_EXPORT void Prepend(SMESHDS_ListOfPtrHypothesis& Other) ; +Standard_EXPORT void Append(const SMESHDS_PtrHypothesis& I) ; +Standard_EXPORT void Append(SMESHDS_ListOfPtrHypothesis& Other) ; +Standard_EXPORT SMESHDS_PtrHypothesis& First() const; +Standard_EXPORT SMESHDS_PtrHypothesis& Last() const; +Standard_EXPORT void RemoveFirst() ; +Standard_EXPORT void Remove(SMESHDS_ListIteratorOfListOfPtrHypothesis& It) ; +Standard_EXPORT void InsertBefore(const SMESHDS_PtrHypothesis& I,SMESHDS_ListIteratorOfListOfPtrHypothesis& It) ; +Standard_EXPORT void InsertBefore(SMESHDS_ListOfPtrHypothesis& Other,SMESHDS_ListIteratorOfListOfPtrHypothesis& It) ; +Standard_EXPORT void InsertAfter(const SMESHDS_PtrHypothesis& I,SMESHDS_ListIteratorOfListOfPtrHypothesis& It) ; +Standard_EXPORT void InsertAfter(SMESHDS_ListOfPtrHypothesis& Other,SMESHDS_ListIteratorOfListOfPtrHypothesis& It) ; + + +friend class SMESHDS_ListIteratorOfListOfPtrHypothesis; + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // +Standard_EXPORT SMESHDS_ListOfPtrHypothesis(const SMESHDS_ListOfPtrHypothesis& Other); + + + // Fields PRIVATE + // +Standard_Address myFirst; +Standard_Address myLast; + + +}; + +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx + +#include + +#undef Item +#undef Item_hxx +#undef TCollection_ListNode +#undef TCollection_ListNode_hxx +#undef TCollection_ListIterator +#undef TCollection_ListIterator_hxx +#undef Handle_TCollection_ListNode +#undef TCollection_ListNode_Type_ +#undef TCollection_List +#undef TCollection_List_hxx + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx b/src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx new file mode 100644 index 000000000..71753e1db --- /dev/null +++ b/src/SMESHDS/SMESHDS_ListOfPtrHypothesis_0.cxx @@ -0,0 +1,40 @@ +using namespace std; +// File generated by CPPExt (Value) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_ListOfPtrHypothesis.hxx" + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _SMESHDS_ListIteratorOfListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_ListNodeOfListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListNodeOfListOfPtrHypothesis.hxx" +#endif + + +#define Item SMESHDS_PtrHypothesis +#define Item_hxx +#define TCollection_ListNode SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_hxx +#define TCollection_ListIterator SMESHDS_ListIteratorOfListOfPtrHypothesis +#define TCollection_ListIterator_hxx +#define Handle_TCollection_ListNode Handle_SMESHDS_ListNodeOfListOfPtrHypothesis +#define TCollection_ListNode_Type_() SMESHDS_ListNodeOfListOfPtrHypothesis_Type_() +#define TCollection_List SMESHDS_ListOfPtrHypothesis +#define TCollection_List_hxx +#include + diff --git a/src/SMESHDS/SMESHDS_Mesh.cdl b/src/SMESHDS/SMESHDS_Mesh.cdl new file mode 100644 index 000000000..15959de8d --- /dev/null +++ b/src/SMESHDS/SMESHDS_Mesh.cdl @@ -0,0 +1,157 @@ +-- File : SMESHDS_Mesh.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + + +class Mesh from SMESHDS inherits Mesh from SMDS + +uses + Mesh from SMDS, + MeshNode from SMDS, + MeshEdge from SMDS, + MeshFace from SMDS, + MeshElement from SMDS, + Shell from TopoDS, + Shape from TopoDS, + Face from TopoDS, + Edge from TopoDS, + Vertex from TopoDS, + SubMesh from SMESHDS, + PtrHypothesis from SMESHDS, + ListOfPtrHypothesis from SMESHDS, + Script from SMESHDS, + IndexedMapOfShape from TopTools, + DataMapOfIntegerSubMesh from SMESHDS, + DataMapOfShapeListOfPtrHypothesis from SMESHDS + + +is + + Create (MeshID : Integer from Standard) returns mutable Mesh from SMESHDS; + +-- Building + + ShapeToMesh (me: mutable; S : Shape from TopoDS); + + AddHypothesis(me: mutable; SS : in Shape from TopoDS; H : PtrHypothesis from SMESHDS) + returns Boolean; + + RemoveHypothesis(me: mutable; S : in Shape from TopoDS; H : PtrHypothesis from SMESHDS) + returns Boolean; + + + -- Building Node + + AddNode(me: mutable; x,y,z : Real) returns Integer from Standard + is redefined; + + RemoveNode (me: mutable; ID: Integer) is redefined; + + MoveNode (me: mutable; ID: Integer; x,y,z: Real); + + + -- Building Edge + AddEdge(me: mutable; idnode1, idnode2 : Integer) returns Integer from Standard + is redefined; + + -- Building Face + AddFace(me: mutable; idnode1, idnode2, idnode3 : Integer) returns Integer from Standard + -- To build a Triangle + is redefined; + + + AddFace(me: mutable; idnode1, idnode2, idnode3 , idnode4 : Integer) returns Integer from Standard + -- To build a quadrangle + is redefined; + + -- Building Volume + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4 : Integer) returns Integer + -- To build a Tetrahedron + is redefined; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5 : Integer) returns Integer + -- To build a Pyramid + is redefined; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer) returns Integer + -- To build a Prism + is redefined; + + AddVolume(me: mutable; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer) returns Integer + -- To build a Hexahedron + is redefined; + + + RemoveElement(me: mutable; IDelem : Integer) + is redefined; + + -- Binding BRep and MeshElements + + SetNodeInVolume (me: mutable; aNode : MeshNode from SMDS ; S : Shell from TopoDS); + + SetNodeOnFace (me: mutable; aNode : MeshNode from SMDS ; S : Face from TopoDS); + + SetNodeOnEdge (me: mutable; aNode : MeshNode from SMDS ; S : Edge from TopoDS); + + SetNodeOnVertex(me: mutable; aNode : MeshNode from SMDS ; S : Vertex from TopoDS); + + UnSetNodeOnShape (me: mutable; aNode : MeshNode from SMDS); + + SetMeshElementOnShape (me: mutable; anElt : MeshElement from SMDS ; S : Shape from TopoDS); + + UnSetMeshElementOnShape (me: mutable; anElt : MeshElement from SMDS ; S : Shape from TopoDS) ; + +-- Exploration + + ShapeToMesh (me: mutable) returns Shape from TopoDS; + + HasMeshElements (me: mutable; S : Shape from TopoDS) returns Boolean from Standard; + + MeshElements (me: mutable; S : Shape from TopoDS) returns SubMesh from SMESHDS; + + HasHypothesis (me: mutable; S : Shape from TopoDS) returns Boolean from Standard; + + GetHypothesis (me: mutable; S : Shape from TopoDS) + ---C++ : return const & + returns ListOfPtrHypothesis from SMESHDS; + +-- Historic of commands + + GetScript(me: mutable) returns Script from SMESHDS; + ---C++ : return const & + + + ClearScript(me: mutable); + +-- Methods for persitance + + ShapeToIndex (me : mutable; aShape : Shape from TopoDS) returns Integer from Standard; + + IndexToShape (me : mutable; ShapeIndex : Integer from Standard) returns Shape from TopoDS; + + NewSubMesh (me : mutable; Index : Integer from Standard); + + SetNodeInVolume (me: mutable; aNode : MeshNode from SMDS ; Index : Integer from Standard); + + SetNodeOnFace (me: mutable; aNode : MeshNode from SMDS ; Index : Integer from Standard); + + SetNodeOnEdge (me: mutable; aNode : MeshNode from SMDS ; Index : Integer from Standard); + + SetNodeOnVertex(me: mutable; aNode : MeshNode from SMDS ; Index : Integer from Standard); + + SetMeshElementOnShape (me: mutable; anElt : MeshElement from SMDS ; Index : Integer from Standard); + + +fields + + myMeshID : Integer from Standard; + myShape : Shape from TopoDS; + myIndexToShape : IndexedMapOfShape from TopTools; -- Gives Index from Shape and Shape from Index + myShapeIndexToSubMesh : DataMapOfIntegerSubMesh from SMESHDS ; + myShapeToHypothesis : DataMapOfShapeListOfPtrHypothesis from SMESHDS; + myScript : Script from SMESHDS; + +end Mesh; diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx new file mode 100644 index 000000000..45b11c4b0 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -0,0 +1,601 @@ +using namespace std; +//============================================================================= +// File : SMESH_Mesh.cxx +// Created : +// Author : Yves FRICAUD, OCC +// Project : SALOME +// Copyright : OCC 2002 +// $Header: +//============================================================================= + +#include "SMESHDS_Mesh.ixx" +#include "SMESHDS_Hypothesis.hxx" +#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_VertexPosition.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" +#include +#include + +#include +#include "utilities.h" + +//======================================================================= +//function : Create +//purpose : +//======================================================================= +SMESHDS_Mesh::SMESHDS_Mesh(const Standard_Integer MeshID) : myMeshID( MeshID) +{ + myScript = new SMESHDS_Script(); +} + +//======================================================================= +//function : ShapeToMesh +//purpose : +//======================================================================= +void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape& S) +{ + myShape = S; + TopExp::MapShapes(myShape,myIndexToShape); +} + + +//======================================================================= +//function : AddHypothesis +//purpose : +//======================================================================= + +Standard_Boolean SMESHDS_Mesh::AddHypothesis(const TopoDS_Shape& SS, + const SMESHDS_PtrHypothesis& H) +{ + if (!myShapeToHypothesis.IsBound(SS)){ + SMESHDS_ListOfPtrHypothesis empty; + myShapeToHypothesis.Bind(SS,empty); + } + else { + //Check if the Hypothesis is still present + SMESHDS_ListOfPtrHypothesis& Hypos = myShapeToHypothesis.ChangeFind (SS); + + for (SMESHDS_ListIteratorOfListOfPtrHypothesis it(Hypos); it.More(); it.Next()) { + if (H == it.Value()) { + return Standard_False; + } + } + } + myShapeToHypothesis(SS).Append(H); + return Standard_True; +} + +//======================================================================= +//function : RemoveHypothesis +//purpose : +//======================================================================= + +Standard_Boolean SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape& S, + const SMESHDS_PtrHypothesis& H) +{ + if (myShapeToHypothesis.IsBound(S)){ + SMESHDS_ListOfPtrHypothesis& Hypos = myShapeToHypothesis.ChangeFind (S); + for (SMESHDS_ListIteratorOfListOfPtrHypothesis it(Hypos); it.More(); it.Next()) { + if (H == it.Value()) { + Hypos.Remove(it); + return Standard_True; + } + } + } + return Standard_False; +} + + +//======================================================================= +//function : AddNode +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddNode(const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + Standard_Integer NodeID = SMDS_Mesh::AddNode(x,y,z); + myScript->AddNode(NodeID,x,y,z); + return NodeID; +} + +//======================================================================= +//function : MoveNode +//purpose : +//======================================================================= +void SMESHDS_Mesh::MoveNode(const Standard_Integer ID, + const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + + Handle(SMDS_MeshNode) Node = Handle(SMDS_MeshNode)::DownCast(FindNode(ID)); + gp_Pnt P(x,y,z); + Node->SetPnt(P); + myScript->MoveNode(ID,x,y,z); +} + + + +//======================================================================= +//function : AddEdge +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddEdge(const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + Standard_Integer ID = SMDS_Mesh::AddEdge(idnode1,idnode2); + myScript->AddEdge (ID,idnode1,idnode2); + return ID; +} + + +//======================================================================= +//function :AddFace +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + Standard_Integer ID = SMDS_Mesh::AddFace(idnode1,idnode2,idnode3); + myScript->AddFace (ID,idnode1,idnode2,idnode3); + return ID; +} + +//======================================================================= +//function :AddFace +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddFace(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer ID = SMDS_Mesh::AddFace(idnode1,idnode2,idnode3,idnode4); + myScript->AddFace (ID,idnode1,idnode2,idnode3,idnode4); + return ID; +} + + +//======================================================================= +//function :AddVolume +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4); + myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4); + return ID; +} + + +//======================================================================= +//function :AddVolume +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) +{ + Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5); + myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5); + return ID; +} + + +//======================================================================= +//function :AddVolume +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) +{ + Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); + myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); + return ID; +} + +//======================================================================= +//function :AddVolume +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::AddVolume(const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) +{ + Standard_Integer ID = SMDS_Mesh::AddVolume(idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8); + myScript->AddVolume (ID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6,idnode7,idnode8); + return ID; +} + + +//======================================================================= +//function : RemoveNode +//purpose : +//======================================================================= +void SMESHDS_Mesh::RemoveNode(const Standard_Integer ID) +{ + SMDS_Mesh::RemoveNode (ID); + myScript->RemoveNode (ID); +} + + + +//======================================================================= +//function : RemoveElement +//purpose : +//======================================================================== +void SMESHDS_Mesh::RemoveElement(const Standard_Integer ID) +{ + SMDS_Mesh::RemoveElement (ID); + myScript->RemoveElement (ID); +} + +//======================================================================= +//function : SetNodeOnVolume +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeInVolume (const Handle(SMDS_MeshNode)& aNode, + const TopoDS_Shell& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVolume"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + //Set Position on Node + //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);; + //aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + +//======================================================================= +//function : SetNodeOnFace +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnFace (const Handle(SMDS_MeshNode)& aNode, + const TopoDS_Face& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnFace"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + //Set Position on Node + Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (Index,0.,0.);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + +//======================================================================= +//function : SetNodeOnEdge +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnEdge (const Handle(SMDS_MeshNode)& aNode, + const TopoDS_Edge& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnEdge"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + //Set Position on Node + Handle (SMDS_EdgePosition) aPos = new SMDS_EdgePosition (Index,0.);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); + +} + +//======================================================================= +//function : SetNodeOnVertex +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnVertex (const Handle(SMDS_MeshNode)& aNode, + const TopoDS_Vertex& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVertex"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + //Set Position on Node + Handle (SMDS_VertexPosition) aPos = new SMDS_VertexPosition (Index);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + + +//======================================================================= +//function : UnSetNodeOnShape +//purpose : +//======================================================================= +void SMESHDS_Mesh::UnSetNodeOnShape(const Handle(SMDS_MeshNode)& aNode) +{ + MESSAGE("not implemented"); +} + + +//======================================================================= +//function : SetMeshElementOnShape +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, + const TopoDS_Shape& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetMeshElementOnShape"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddElement (anElement); +} + +//======================================================================= +//function : UnSetMeshElementOnShape +//purpose : +//======================================================================= +void SMESHDS_Mesh::UnSetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, + const TopoDS_Shape& S) + +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::UnSetMeshElementOnShape"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + if (myShapeIndexToSubMesh.IsBound(Index)) + myShapeIndexToSubMesh(Index)->RemoveElement (anElement); +} + +//======================================================================= +//function : ShapeToMesh +//purpose : +//======================================================================= +TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() +{ + return myShape; +} + +//======================================================================= +//function : MeshElements +//purpose : +//======================================================================= +Handle_SMESHDS_SubMesh SMESHDS_Mesh::MeshElements(const TopoDS_Shape& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::MeshElements"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + if (myShapeIndexToSubMesh.IsBound(Index)) + return myShapeIndexToSubMesh(Index); + Handle(SMESHDS_SubMesh) SM; + return SM; +} + +//======================================================================= +//function : GetHypothesis +//purpose : +//======================================================================= +const SMESHDS_ListOfPtrHypothesis& SMESHDS_Mesh::GetHypothesis(const TopoDS_Shape& S) +{ + if (myShapeToHypothesis.IsBound(S)) + return myShapeToHypothesis(S); + + static SMESHDS_ListOfPtrHypothesis empty; + return empty; +} + +//======================================================================= +//function : GetScript +//purpose : +//======================================================================= +const Handle (SMESHDS_Script)& SMESHDS_Mesh::GetScript() +{ + return myScript; +} + +//======================================================================= +//function : ClearScript +//purpose : +//======================================================================= +void SMESHDS_Mesh::ClearScript() +{ + myScript->Clear(); +} + +//======================================================================= +//function : HasMeshElements +//purpose : +//======================================================================= +Standard_Boolean SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::MeshElements"); + + Standard_Integer Index = myIndexToShape.FindIndex(S); + + return myShapeIndexToSubMesh.IsBound(Index); +} + +//======================================================================= +//function : HasHypothesis +//purpose : +//======================================================================= +Standard_Boolean SMESHDS_Mesh::HasHypothesis(const TopoDS_Shape& S) +{ + return myShapeToHypothesis.IsBound(S); +} + +//======================================================================= +//function : NewSubMesh +//purpose : +//======================================================================= +void SMESHDS_Mesh::NewSubMesh(const Standard_Integer Index) +{ + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } +} + +//======================================================================= +//function : IndexToShape +//purpose : +//======================================================================= +TopoDS_Shape SMESHDS_Mesh::IndexToShape(const Standard_Integer ShapeIndex) +{ + return myIndexToShape.FindKey(ShapeIndex); +} + +//======================================================================= +//function : ShapeToIndex +//purpose : +//======================================================================= +Standard_Integer SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape& S) +{ + if (myShape.IsNull()) + Standard_NullObject::Raise("SMESHDS_Mesh::SetNodeOnVolume"); + + return myIndexToShape.FindIndex(S); +} + +//======================================================================= +//function : SetNodeOnVolume +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeInVolume (const Handle(SMDS_MeshNode)& aNode, + const Standard_Integer Index) +{ + + //Set Position on Node + //Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (myFaceToId(S),0.,0.);; + //aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + +//======================================================================= +//function : SetNodeOnFace +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnFace (const Handle(SMDS_MeshNode)& aNode, + const Standard_Integer Index) +{ + + //Set Position on Node + Handle (SMDS_FacePosition) aPos = new SMDS_FacePosition (Index,0.,0.);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + +//======================================================================= +//function : SetNodeOnEdge +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnEdge (const Handle(SMDS_MeshNode)& aNode, + const Standard_Integer Index) +{ + + //Set Position on Node + Handle (SMDS_EdgePosition) aPos = new SMDS_EdgePosition (Index,0.);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); + +} + +//======================================================================= +//function : SetNodeOnVertex +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetNodeOnVertex (const Handle(SMDS_MeshNode)& aNode, + const Standard_Integer Index) +{ + //Set Position on Node + Handle (SMDS_VertexPosition) aPos = new SMDS_VertexPosition (Index);; + aNode->SetPosition(aPos); + + //Update or build submesh + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddNode (aNode); +} + +//======================================================================= +//function : SetMeshElementOnShape +//purpose : +//======================================================================= +void SMESHDS_Mesh::SetMeshElementOnShape (const Handle(SMDS_MeshElement)& anElement, + const Standard_Integer Index) +{ + if (!myShapeIndexToSubMesh.IsBound(Index)) { + Handle(SMESHDS_SubMesh) SM = new SMESHDS_SubMesh (this); + myShapeIndexToSubMesh.Bind(Index,SM); + } + myShapeIndexToSubMesh(Index)->AddElement (anElement); +} diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx new file mode 100644 index 000000000..260d4ac7a --- /dev/null +++ b/src/SMESHDS/SMESHDS_Mesh.hxx @@ -0,0 +1,186 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_Mesh_HeaderFile +#define _SMESHDS_Mesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Mesh_HeaderFile +#include "Handle_SMESHDS_Mesh.hxx" +#endif + +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shell_HeaderFile +#include +#endif +#ifndef _TopTools_IndexedMapOfShape_HeaderFile +#include +#endif +#ifndef _SMESHDS_DataMapOfIntegerSubMesh_HeaderFile +#include "SMESHDS_DataMapOfIntegerSubMesh.hxx" +#endif +#ifndef _SMESHDS_DataMapOfShapeListOfPtrHypothesis_HeaderFile +#include "SMESHDS_DataMapOfShapeListOfPtrHypothesis.hxx" +#endif +#ifndef _Handle_SMESHDS_Script_HeaderFile +#include "Handle_SMESHDS_Script.hxx" +#endif +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#include "SMESHDS_PtrHypothesis.hxx" +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshNode_HeaderFile +#include "Handle_SMDS_MeshNode.hxx" +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif +class SMESHDS_Script; +class TopoDS_Shape; +class SMDS_MeshNode; +class TopoDS_Shell; +class TopoDS_Face; +class TopoDS_Edge; +class TopoDS_Vertex; +class SMDS_MeshElement; +class SMESHDS_SubMesh; +class SMESHDS_ListOfPtrHypothesis; + + +class SMESHDS_Mesh : public SMDS_Mesh { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_Mesh(const Standard_Integer MeshID); +Standard_EXPORT void ShapeToMesh(const TopoDS_Shape& S) ; +Standard_EXPORT Standard_Boolean AddHypothesis(const TopoDS_Shape& SS,const SMESHDS_PtrHypothesis& H) ; +Standard_EXPORT Standard_Boolean RemoveHypothesis(const TopoDS_Shape& S,const SMESHDS_PtrHypothesis& H) ; +Standard_EXPORT virtual Standard_Integer AddNode(const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT virtual void RemoveNode(const Standard_Integer ID) ; +Standard_EXPORT void MoveNode(const Standard_Integer ID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT virtual Standard_Integer AddEdge(const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT virtual Standard_Integer AddFace(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ; +Standard_EXPORT virtual Standard_Integer AddVolume(const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ; +Standard_EXPORT virtual void RemoveElement(const Standard_Integer IDelem) ; +Standard_EXPORT void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Shell& S) ; +Standard_EXPORT void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Face& S) ; +Standard_EXPORT void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Edge& S) ; +Standard_EXPORT void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const TopoDS_Vertex& S) ; +Standard_EXPORT void UnSetNodeOnShape(const Handle(SMDS_MeshNode)& aNode) ; +Standard_EXPORT void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ; +Standard_EXPORT void UnSetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const TopoDS_Shape& S) ; +Standard_EXPORT TopoDS_Shape ShapeToMesh() ; +Standard_EXPORT Standard_Boolean HasMeshElements(const TopoDS_Shape& S) ; +Standard_EXPORT Handle_SMESHDS_SubMesh MeshElements(const TopoDS_Shape& S) ; +Standard_EXPORT Standard_Boolean HasHypothesis(const TopoDS_Shape& S) ; +Standard_EXPORT const SMESHDS_ListOfPtrHypothesis& GetHypothesis(const TopoDS_Shape& S) ; +Standard_EXPORT const Handle_SMESHDS_Script& GetScript() ; +Standard_EXPORT void ClearScript() ; +Standard_EXPORT Standard_Integer ShapeToIndex(const TopoDS_Shape& aShape) ; +Standard_EXPORT TopoDS_Shape IndexToShape(const Standard_Integer ShapeIndex) ; +Standard_EXPORT void NewSubMesh(const Standard_Integer Index) ; +Standard_EXPORT void SetNodeInVolume(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ; +Standard_EXPORT void SetNodeOnFace(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ; +Standard_EXPORT void SetNodeOnEdge(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ; +Standard_EXPORT void SetNodeOnVertex(const Handle(SMDS_MeshNode)& aNode,const Standard_Integer Index) ; +Standard_EXPORT void SetMeshElementOnShape(const Handle(SMDS_MeshElement)& anElt,const Standard_Integer Index) ; +Standard_EXPORT ~SMESHDS_Mesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Mesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Standard_Integer myMeshID; +TopoDS_Shape myShape; +TopTools_IndexedMapOfShape myIndexToShape; +SMESHDS_DataMapOfIntegerSubMesh myShapeIndexToSubMesh; +SMESHDS_DataMapOfShapeListOfPtrHypothesis myShapeToHypothesis; +Handle_SMESHDS_Script myScript; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_Mesh.ixx b/src/SMESHDS/SMESHDS_Mesh.ixx new file mode 100644 index 000000000..865af0c29 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Mesh.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_Mesh.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESHDS_Mesh::~SMESHDS_Mesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_Mesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SMDS_Mesh); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SMDS_Mesh); + static Handle_Standard_Type aType2 = STANDARD_TYPE(SMDS_MeshObject); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SMDS_MeshObject); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_Mesh", + sizeof(SMESHDS_Mesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_Mesh) Handle(SMESHDS_Mesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_Mesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_Mesh))) { + _anOtherObject = Handle(SMESHDS_Mesh)((Handle(SMESHDS_Mesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_Mesh::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_Mesh) ; +} +Standard_Boolean SMESHDS_Mesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_Mesh) == AType || SMDS_Mesh::IsKind(AType)); +} +Handle_SMESHDS_Mesh::~Handle_SMESHDS_Mesh() {} + diff --git a/src/SMESHDS/SMESHDS_Mesh.jxx b/src/SMESHDS/SMESHDS_Mesh.jxx new file mode 100644 index 000000000..395da02b8 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Mesh.jxx @@ -0,0 +1,30 @@ +#ifndef _SMESHDS_Script_HeaderFile +#include "SMESHDS_Script.hxx" +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _SMDS_MeshNode_HeaderFile +#include "SMDS_MeshNode.hxx" +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _TopoDS_Edge_HeaderFile +#include +#endif +#ifndef _TopoDS_Vertex_HeaderFile +#include +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif +#ifndef _SMESHDS_ListOfPtrHypothesis_HeaderFile +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#endif +#ifndef _SMESHDS_Mesh_HeaderFile +#include "SMESHDS_Mesh.hxx" +#endif diff --git a/src/SMESHDS/SMESHDS_PtrHypothesis.hxx b/src/SMESHDS/SMESHDS_PtrHypothesis.hxx new file mode 100644 index 000000000..82ef45ff2 --- /dev/null +++ b/src/SMESHDS/SMESHDS_PtrHypothesis.hxx @@ -0,0 +1,22 @@ +// File generated by CPPExt (Pointer) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_PtrHypothesis_HeaderFile +#define _SMESHDS_PtrHypothesis_HeaderFile + +class SMESHDS_Hypothesis; + +typedef SMESHDS_Hypothesis* SMESHDS_PtrHypothesis; + +#endif diff --git a/src/SMESHDS/SMESHDS_Script.cdl b/src/SMESHDS/SMESHDS_Script.cdl new file mode 100644 index 000000000..f224b21f3 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Script.cdl @@ -0,0 +1,52 @@ +-- File : SMESHDS_Script.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + +class Script from SMESHDS inherits TShared from MMgt + +uses + Integer from Standard, + Real from Standard, + CString from Standard, + ListOfCommand from SMESHDS + +is + + --Building + AddNode(me: mutable; NewNodeID : Integer; x,y,z : Real); + + AddEdge(me: mutable; NewEdgeID : Integer; idnode1, idnode2 : Integer); + + AddFace(me: mutable; NewFaceID : Integer; idnode1, idnode2, idnode3 : Integer); + + AddFace(me: mutable; NewFaceID : Integer; idnode1, idnode2, idnode3, idnode4 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6 : Integer); + + AddVolume(me: mutable; NewVolID : Integer; idnode1, idnode2, idnode3, idnode4, idnode5, idnode6, idnode7, idnode8 : Integer); + + + MoveNode(me: mutable; NewNodeID : Integer; x,y,z : Real); + + RemoveNode (me: mutable; NodeID : Integer); + + RemoveElement(me: mutable; ElementID : Integer); + + Clear (me : mutable); + + -- Querry + + GetCommands (me : mutable) returns ListOfCommand from SMESHDS; + ---C++ :return const & +fields + + myCommands : ListOfCommand from SMESHDS; + + +end Script; diff --git a/src/SMESHDS/SMESHDS_Script.cxx b/src/SMESHDS/SMESHDS_Script.cxx new file mode 100644 index 000000000..6c702be56 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Script.cxx @@ -0,0 +1,304 @@ +using namespace std; +//============================================================================= +// File : SMESH_Script.cxx +// Created : +// Author : Yves FRICAUD, OCC +// Project : SALOME +// Copyright : OCC 2002 +// $Header: +//============================================================================= + +#include "SMESHDS_Script.ixx" +#include "SMESHDS_Command.hxx" +#include "SMESHDS_CommandType.hxx" +#include "SMESHDS_ListOfCommand.hxx" + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddNode(const Standard_Integer NewNodeID, + const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddNode); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddNode) { + com = new SMESHDS_Command(SMESHDS_AddNode); + myCommands.Append (com); + } + } + com->AddNode (NewNodeID,x,y,z); +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddEdge(const Standard_Integer NewEdgeID, + const Standard_Integer idnode1, + const Standard_Integer idnode2) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddEdge); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddEdge) { + com = new SMESHDS_Command(SMESHDS_AddEdge); + myCommands.Append (com); + } + } + com->AddEdge (NewEdgeID,idnode1,idnode2); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddTriangle); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddTriangle) { + com = new SMESHDS_Command(SMESHDS_AddTriangle); + myCommands.Append (com); + } + } + com->AddFace (NewFaceID,idnode1,idnode2,idnode3); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddFace(const Standard_Integer NewFaceID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddQuadrangle); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddQuadrangle) { + com = new SMESHDS_Command(SMESHDS_AddQuadrangle); + myCommands.Append (com); + } + } + com->AddFace (NewFaceID,idnode1,idnode2,idnode3,idnode4); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddVolume(const Standard_Integer NewID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddTetrahedron); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddQuadrangle) { + com = new SMESHDS_Command(SMESHDS_AddQuadrangle); + myCommands.Append (com); + } + } + com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddVolume(const Standard_Integer NewID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddPyramid); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddPyramid) { + com = new SMESHDS_Command(SMESHDS_AddPyramid); + myCommands.Append (com); + } + } + com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4,idnode5); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddVolume(const Standard_Integer NewID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddPrism); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddPrism) { + com = new SMESHDS_Command(SMESHDS_AddPrism); + myCommands.Append (com); + } + } + com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4,idnode5,idnode6); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::AddVolume(const Standard_Integer NewID, + const Standard_Integer idnode1, + const Standard_Integer idnode2, + const Standard_Integer idnode3, + const Standard_Integer idnode4, + const Standard_Integer idnode5, + const Standard_Integer idnode6, + const Standard_Integer idnode7, + const Standard_Integer idnode8) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_AddHexahedron); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_AddHexahedron) { + com = new SMESHDS_Command(SMESHDS_AddHexahedron); + myCommands.Append (com); + } + } + com->AddVolume (NewID,idnode1,idnode2,idnode3,idnode4, + idnode5,idnode6,idnode7,idnode8); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::MoveNode(const Standard_Integer NewNodeID, + const Standard_Real x, + const Standard_Real y, + const Standard_Real z) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_MoveNode); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_MoveNode) { + com = new SMESHDS_Command(SMESHDS_MoveNode); + myCommands.Append (com); + } + } + com->MoveNode (NewNodeID,x,y,z); +} + + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::RemoveNode(const Standard_Integer ID) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_RemoveNode); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_RemoveNode) { + com = new SMESHDS_Command(SMESHDS_RemoveNode); + myCommands.Append (com); + } + } + com->RemoveNode (ID); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= + void SMESHDS_Script::RemoveElement(const Standard_Integer ElementID) +{ + Handle(SMESHDS_Command) com; + if (myCommands.IsEmpty()) { + com = new SMESHDS_Command(SMESHDS_RemoveElement); + myCommands.Append (com); + } + else { + com = myCommands.Last(); + if (com->GetType() != SMESHDS_RemoveElement) { + com = new SMESHDS_Command(SMESHDS_RemoveElement); + myCommands.Append (com); + } + } + com->RemoveElement (ElementID); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void SMESHDS_Script::Clear() +{ + myCommands.Clear(); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +const SMESHDS_ListOfCommand& SMESHDS_Script::GetCommands() +{ + return myCommands; +} diff --git a/src/SMESHDS/SMESHDS_Script.hxx b/src/SMESHDS/SMESHDS_Script.hxx new file mode 100644 index 000000000..bfbedf52e --- /dev/null +++ b/src/SMESHDS/SMESHDS_Script.hxx @@ -0,0 +1,118 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_Script_HeaderFile +#define _SMESHDS_Script_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_Script_HeaderFile +#include "Handle_SMESHDS_Script.hxx" +#endif + +#ifndef _SMESHDS_ListOfCommand_HeaderFile +#include "SMESHDS_ListOfCommand.hxx" +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +class SMESHDS_ListOfCommand; + + +class SMESHDS_Script : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT void AddNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT void AddEdge(const Standard_Integer NewEdgeID,const Standard_Integer idnode1,const Standard_Integer idnode2) ; +Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3) ; +Standard_EXPORT void AddFace(const Standard_Integer NewFaceID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6) ; +Standard_EXPORT void AddVolume(const Standard_Integer NewVolID,const Standard_Integer idnode1,const Standard_Integer idnode2,const Standard_Integer idnode3,const Standard_Integer idnode4,const Standard_Integer idnode5,const Standard_Integer idnode6,const Standard_Integer idnode7,const Standard_Integer idnode8) ; +Standard_EXPORT void MoveNode(const Standard_Integer NewNodeID,const Standard_Real x,const Standard_Real y,const Standard_Real z) ; +Standard_EXPORT void RemoveNode(const Standard_Integer NodeID) ; +Standard_EXPORT void RemoveElement(const Standard_Integer ElementID) ; +Standard_EXPORT void Clear() ; +Standard_EXPORT const SMESHDS_ListOfCommand& GetCommands() ; +Standard_EXPORT ~SMESHDS_Script(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_Script_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +SMESHDS_ListOfCommand myCommands; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_Script.ixx b/src/SMESHDS/SMESHDS_Script.ixx new file mode 100644 index 000000000..cbfb33e82 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Script.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_Script.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESHDS_Script::~SMESHDS_Script() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_Script_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_Script", + sizeof(SMESHDS_Script), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_Script) Handle(SMESHDS_Script)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_Script) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_Script))) { + _anOtherObject = Handle(SMESHDS_Script)((Handle(SMESHDS_Script)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_Script::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_Script) ; +} +Standard_Boolean SMESHDS_Script::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_Script) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMESHDS_Script::~Handle_SMESHDS_Script() {} + diff --git a/src/SMESHDS/SMESHDS_Script.jxx b/src/SMESHDS/SMESHDS_Script.jxx new file mode 100644 index 000000000..4cb5490c7 --- /dev/null +++ b/src/SMESHDS/SMESHDS_Script.jxx @@ -0,0 +1,6 @@ +#ifndef _SMESHDS_ListOfCommand_HeaderFile +#include "SMESHDS_ListOfCommand.hxx" +#endif +#ifndef _SMESHDS_Script_HeaderFile +#include "SMESHDS_Script.hxx" +#endif diff --git a/src/SMESHDS/SMESHDS_SubMesh.cdl b/src/SMESHDS/SMESHDS_SubMesh.cdl new file mode 100644 index 000000000..030e4e36d --- /dev/null +++ b/src/SMESHDS/SMESHDS_SubMesh.cdl @@ -0,0 +1,62 @@ +-- File : SMESHDS_SubMesh.cdl +-- Created : +-- Author : Yves FRICAUD, OCC +-- Project : SALOME +-- Copyright : OCC + +class SubMesh from SMESHDS inherits TShared from MMgt + +uses + Mesh from SMDS, + MeshElement from SMDS, + MeshNode from SMDS, + ListOfInteger from TColStd, + MapOfMeshElement from SMDS + +is + + Create (M : Mesh from SMDS) returns mutable SubMesh from SMESHDS; + + -- Build + + AddElement (me : mutable; ME : MeshElement from SMDS); + + RemoveElement (me: mutable; ME : MeshElement from SMDS); + + AddNode (me : mutable; ME : MeshNode from SMDS); + + RemoveNode (me: mutable; ME : MeshNode from SMDS); + + + -- Querry + + NbElements (me: mutable) returns Integer from Standard; + + GetElements (me: mutable ) returns MapOfMeshElement from SMDS; + ---C++ : return const & + + GetIDElements (me: mutable) returns ListOfInteger from TColStd; + ---C++ : return const & + + NbNodes (me: mutable) returns Integer from Standard; + + GetNodes (me: mutable ) returns MapOfMeshElement from SMDS; + ---C++ : return const & + + GetIDNodes (me: mutable) returns ListOfInteger from TColStd; + ---C++ : return const & + +fields + + myMesh : Mesh from SMDS; + myElements : MapOfMeshElement from SMDS; + myNodes : MapOfMeshElement from SMDS; + + myListOfEltIDIsUpdate : Boolean from Standard; + myListOfEltID : ListOfInteger from TColStd; + + myListOfNodeIDIsUpdate : Boolean from Standard; + myListOfNodeID : ListOfInteger from TColStd; + + +end SubMesh; diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx new file mode 100644 index 000000000..fab9fba9c --- /dev/null +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -0,0 +1,128 @@ +using namespace std; +//============================================================================= +// File : SMESH_SubMesh.cxx +// Created : +// Author : Yves FRICAUD, OCC +// Project : SALOME +// Copyright : OCC 2002 +// $Header: +//============================================================================= + +#include "SMESHDS_SubMesh.ixx" +#include "SMDS_MapIteratorOfExtendedMap.hxx" + +//======================================================================= +//function : SMESHDS_SubMesh +//purpose : +//======================================================================= +SMESHDS_SubMesh::SMESHDS_SubMesh(const Handle(SMDS_Mesh)& M) : myMesh(M) +{ + myListOfEltIDIsUpdate = Standard_False; + myListOfNodeIDIsUpdate = Standard_False; +} + +//======================================================================= +//function : AddElement +//purpose : +//======================================================================= +void SMESHDS_SubMesh::AddElement (const Handle(SMDS_MeshElement)& ME) +{ + myElements.Add(ME); + myListOfEltIDIsUpdate = Standard_False; +} + +//======================================================================= +//function : RemoveElement +//purpose : +//======================================================================= +void SMESHDS_SubMesh::RemoveElement(const Handle(SMDS_MeshElement)& ME) +{ + myElements.Remove(ME); + myListOfEltIDIsUpdate = Standard_False; +} +//======================================================================= +//function : AddNode +//purpose : +//======================================================================= +void SMESHDS_SubMesh::AddNode (const Handle(SMDS_MeshNode)& N) +{ + myNodes.Add(N); + myListOfNodeIDIsUpdate = Standard_False; +} + +//======================================================================= +//function : RemoveNode +//purpose : +//======================================================================= +void SMESHDS_SubMesh::RemoveNode (const Handle(SMDS_MeshNode)& N) +{ + myNodes.Remove(N); + myListOfNodeIDIsUpdate = Standard_False; +} + +//======================================================================= +//function : NbElements +//purpose : +//======================================================================= +Standard_Integer SMESHDS_SubMesh::NbElements() +{ + return myElements.Extent(); +} + +//======================================================================= +//function : GetElements +//purpose : +//======================================================================= +const SMDS_MapOfMeshElement& SMESHDS_SubMesh::GetElements() +{ + return myElements; +} +//======================================================================= +//function : NbNodes +//purpose : +//======================================================================= +Standard_Integer SMESHDS_SubMesh::NbNodes() +{ + return myNodes.Extent(); +} + +//======================================================================= +//function : GetNodes +//purpose : +//======================================================================= +const SMDS_MapOfMeshElement& SMESHDS_SubMesh::GetNodes() +{ + return myNodes; +} + +//======================================================================= +//function : GetIDElements +//purpose : +//======================================================================= +const TColStd_ListOfInteger& SMESHDS_SubMesh::GetIDElements() +{ + if (!myListOfEltIDIsUpdate) { + myListOfEltID.Clear(); + for (SMDS_MapIteratorOfExtendedMap it(myElements); it.More(); it.Next()) { + myListOfEltID.Append(it.Key()->GetID()); + } + myListOfEltIDIsUpdate = Standard_True; + } + return myListOfEltID; +} + +//======================================================================= +//function : GetIDNodes +//purpose : +//======================================================================= +const TColStd_ListOfInteger& SMESHDS_SubMesh::GetIDNodes() +{ + if (!myListOfNodeIDIsUpdate) { + myListOfNodeID.Clear(); + for (SMDS_MapIteratorOfExtendedMap it(myNodes); it.More(); it.Next()) { + myListOfNodeID.Append(it.Key()->GetID()); + } + myListOfNodeIDIsUpdate = Standard_True; + } + return myListOfNodeID; +} diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx new file mode 100644 index 000000000..334965d89 --- /dev/null +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -0,0 +1,138 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESHDS_SubMesh_HeaderFile +#define _SMESHDS_SubMesh_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SMESHDS_SubMesh_HeaderFile +#include "Handle_SMESHDS_SubMesh.hxx" +#endif + +#ifndef _Handle_SMDS_Mesh_HeaderFile +#include "Handle_SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _MMgt_TShared_HeaderFile +#include +#endif +#ifndef _Handle_SMDS_MeshElement_HeaderFile +#include "Handle_SMDS_MeshElement.hxx" +#endif +#ifndef _Handle_SMDS_MeshNode_HeaderFile +#include "Handle_SMDS_MeshNode.hxx" +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +class SMDS_Mesh; +class SMDS_MeshElement; +class SMDS_MeshNode; +class SMDS_MapOfMeshElement; +class TColStd_ListOfInteger; + + +class SMESHDS_SubMesh : public MMgt_TShared { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESHDS_SubMesh(const Handle(SMDS_Mesh)& M); +Standard_EXPORT void AddElement(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT void RemoveElement(const Handle(SMDS_MeshElement)& ME) ; +Standard_EXPORT void AddNode(const Handle(SMDS_MeshNode)& ME) ; +Standard_EXPORT void RemoveNode(const Handle(SMDS_MeshNode)& ME) ; +Standard_EXPORT Standard_Integer NbElements() ; +Standard_EXPORT const SMDS_MapOfMeshElement& GetElements() ; +Standard_EXPORT const TColStd_ListOfInteger& GetIDElements() ; +Standard_EXPORT Standard_Integer NbNodes() ; +Standard_EXPORT const SMDS_MapOfMeshElement& GetNodes() ; +Standard_EXPORT const TColStd_ListOfInteger& GetIDNodes() ; +Standard_EXPORT ~SMESHDS_SubMesh(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESHDS_SubMesh_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +Handle_SMDS_Mesh myMesh; +SMDS_MapOfMeshElement myElements; +SMDS_MapOfMeshElement myNodes; +Standard_Boolean myListOfEltIDIsUpdate; +TColStd_ListOfInteger myListOfEltID; +Standard_Boolean myListOfNodeIDIsUpdate; +TColStd_ListOfInteger myListOfNodeID; + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHDS/SMESHDS_SubMesh.ixx b/src/SMESHDS/SMESHDS_SubMesh.ixx new file mode 100644 index 000000000..7e85ef0ff --- /dev/null +++ b/src/SMESHDS/SMESHDS_SubMesh.ixx @@ -0,0 +1,69 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESHDS_SubMesh.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESHDS_SubMesh::~SMESHDS_SubMesh() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESHDS_SubMesh_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESHDS_SubMesh", + sizeof(SMESHDS_SubMesh), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESHDS_SubMesh) Handle(SMESHDS_SubMesh)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESHDS_SubMesh) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESHDS_SubMesh))) { + _anOtherObject = Handle(SMESHDS_SubMesh)((Handle(SMESHDS_SubMesh)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESHDS_SubMesh::DynamicType() const +{ + return STANDARD_TYPE(SMESHDS_SubMesh) ; +} +Standard_Boolean SMESHDS_SubMesh::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESHDS_SubMesh) == AType || MMgt_TShared::IsKind(AType)); +} +Handle_SMESHDS_SubMesh::~Handle_SMESHDS_SubMesh() {} + diff --git a/src/SMESHDS/SMESHDS_SubMesh.jxx b/src/SMESHDS/SMESHDS_SubMesh.jxx new file mode 100644 index 000000000..fc05b5a8b --- /dev/null +++ b/src/SMESHDS/SMESHDS_SubMesh.jxx @@ -0,0 +1,18 @@ +#ifndef _SMDS_Mesh_HeaderFile +#include "SMDS_Mesh.hxx" +#endif +#ifndef _SMDS_MeshElement_HeaderFile +#include "SMDS_MeshElement.hxx" +#endif +#ifndef _SMDS_MeshNode_HeaderFile +#include "SMDS_MeshNode.hxx" +#endif +#ifndef _SMDS_MapOfMeshElement_HeaderFile +#include "SMDS_MapOfMeshElement.hxx" +#endif +#ifndef _TColStd_ListOfInteger_HeaderFile +#include +#endif +#ifndef _SMESHDS_SubMesh_HeaderFile +#include "SMESHDS_SubMesh.hxx" +#endif diff --git a/src/SMESHFiltersSelection/Handle_SMESH_TypeFilter.hxx b/src/SMESHFiltersSelection/Handle_SMESH_TypeFilter.hxx new file mode 100644 index 000000000..79db47025 --- /dev/null +++ b/src/SMESHFiltersSelection/Handle_SMESH_TypeFilter.hxx @@ -0,0 +1,89 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SMESH_TypeFilter_HeaderFile +#define _Handle_SMESH_TypeFilter_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_SALOME_Filter_HeaderFile +#include "Handle_SALOME_Filter.hxx" +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(SALOME_Filter); +class SMESH_TypeFilter; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SMESH_TypeFilter); + +class Handle(SMESH_TypeFilter) : public Handle(SALOME_Filter) { + public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + Handle(SMESH_TypeFilter)():Handle(SALOME_Filter)() {} + Handle(SMESH_TypeFilter)(const Handle(SMESH_TypeFilter)& aHandle) : Handle(SALOME_Filter)(aHandle) + { + } + + Handle(SMESH_TypeFilter)(const SMESH_TypeFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem) + { + } + + Handle(SMESH_TypeFilter)& operator=(const Handle(SMESH_TypeFilter)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SMESH_TypeFilter)& operator=(const SMESH_TypeFilter* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SMESH_TypeFilter* operator->() + { + return (SMESH_TypeFilter *)ControlAccess(); + } + + SMESH_TypeFilter* operator->() const + { + return (SMESH_TypeFilter *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SMESH_TypeFilter)(); + + Standard_EXPORT static const Handle(SMESH_TypeFilter) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SMESHFiltersSelection/Makefile.in b/src/SMESHFiltersSelection/Makefile.in new file mode 100644 index 000000000..6878fa16c --- /dev/null +++ b/src/SMESHFiltersSelection/Makefile.in @@ -0,0 +1,40 @@ +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 29/06/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets + +LIB = libSMESHFiltersSelection.la +LIB_SRC = SMESH_TypeFilter.cxx + +LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl + +# header files +EXPORT_HEADERS= SMESH_Type.h \ + SMESH_TypeFilter.hxx \ + Handle_SMESH_TypeFilter.hxx + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) +LDFLAGS += $(OCC_LIBS) + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ + diff --git a/src/SMESHFiltersSelection/SMESH_Type.h b/src/SMESHFiltersSelection/SMESH_Type.h new file mode 100644 index 000000000..7bf427270 --- /dev/null +++ b/src/SMESHFiltersSelection/SMESH_Type.h @@ -0,0 +1,21 @@ +// File : SMESH_Type.h +// Created : Mon Jun 03 15:14:15 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +enum MeshObjectType { + HYPOTHESIS, + ALGORITHM, + MESH, + SUBMESH, + MESHorSUBMESH, + SUBMESH_VERTEX, + SUBMESH_EDGE, + SUBMESH_FACE, + SUBMESH_SOLID, + SUBMESH_COMPOUND +}; diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx new file mode 100644 index 000000000..3a14178e5 --- /dev/null +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx @@ -0,0 +1,139 @@ +using namespace std; +// File : SMESH_TypeFilter.cxx +// Created : Fri Dec 07 09:57:24 2001 +// Author : Nicolas REJNERI +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE +// $Header$ + +#include "SMESH_TypeFilter.ixx" + +#include "SALOME_InteractiveObject.hxx" +#include "SALOME_TypeFilter.hxx" + +#include "utilities.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_Study.h" + + +SMESH_TypeFilter::SMESH_TypeFilter(MeshObjectType aType) +{ + myKind = aType; +} + +Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const +{ + Handle(SALOME_TypeFilter) meshFilter = new SALOME_TypeFilter( "MESH" ); + if ( !meshFilter->IsOk(anObj) ) + return false; + + if ( anObj->hasEntry() ) { + QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); + SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() ); + + bool Ok = false; + + switch ( myKind ) + { + case HYPOTHESIS: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) + Ok = true; + break; + } + case ALGORITHM: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) + Ok = true; + break; + } + case MESH: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) ) + Ok = true; + break; + } + case SUBMESH: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) + Ok = true; + break; + } + case MESHorSUBMESH: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) ) + Ok = true; + + if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) + Ok = true; + + break; + } + case SUBMESH_VERTEX: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) + Ok = true; + break; + } + case SUBMESH_EDGE: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) + Ok = true; + break; + } + case SUBMESH_FACE: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) + Ok = true; + break; + } + case SUBMESH_SOLID: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) + Ok = true; + break; + } + case SUBMESH_COMPOUND: + { + SALOMEDS::SObject_var objFather = obj->GetFather(); + SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent(); + + if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) + Ok = true; + break; + } + } + + if ( Ok ) + return true; + } + return false; +} diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx new file mode 100644 index 000000000..9e98ab8b8 --- /dev/null +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.hxx @@ -0,0 +1,95 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SMESH_TypeFilter_HeaderFile +#define _SMESH_TypeFilter_HeaderFile + +#ifndef _Handle_SMESH_TypeFilter_HeaderFile +#include "Handle_SMESH_TypeFilter.hxx" +#endif + +#include "SALOME_InteractiveObject.hxx" +#include "SALOME_Filter.hxx" +#include "SMESH_Type.h" + +// Open CASCADE Includes +#include + +class SMESH_TypeFilter : public SALOME_Filter { + +public: + + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } +// inline void operator delete(void *anAddress, size_t size) +// { +// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); +// } + // Methods PUBLIC + // +Standard_EXPORT SMESH_TypeFilter(MeshObjectType aType); +Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const; +Standard_EXPORT ~SMESH_TypeFilter(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SMESH_TypeFilter_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +MeshObjectType myKind; + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.ixx b/src/SMESHFiltersSelection/SMESH_TypeFilter.ixx new file mode 100644 index 000000000..a01d02ee0 --- /dev/null +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.ixx @@ -0,0 +1,71 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include "SMESH_TypeFilter.jxx" + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SMESH_TypeFilter::~SMESH_TypeFilter() {} + + + +Standard_EXPORT Handle_Standard_Type& SMESH_TypeFilter_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SMESH_TypeFilter", + sizeof(SMESH_TypeFilter), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SMESH_TypeFilter) Handle(SMESH_TypeFilter)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SMESH_TypeFilter) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SMESH_TypeFilter))) { + _anOtherObject = Handle(SMESH_TypeFilter)((Handle(SMESH_TypeFilter)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SMESH_TypeFilter::DynamicType() const +{ + return STANDARD_TYPE(SMESH_TypeFilter) ; +} +Standard_Boolean SMESH_TypeFilter::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SMESH_TypeFilter) == AType || SALOME_Filter::IsKind(AType)); +} +Handle_SMESH_TypeFilter::~Handle_SMESH_TypeFilter() {} + diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.jxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.jxx new file mode 100644 index 000000000..2aed9c397 --- /dev/null +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.jxx @@ -0,0 +1,3 @@ +#ifndef _SMESH_TypeFilter_HeaderFile +#include "SMESH_TypeFilter.hxx" +#endif diff --git a/src/SMESHGUI/Makefile.in b/src/SMESHGUI/Makefile.in new file mode 100644 index 000000000..4fed8d203 --- /dev/null +++ b/src/SMESHGUI/Makefile.in @@ -0,0 +1,111 @@ +# -* Makefile *- +# +# Author : Nicolas REJNERI +# Date : Sun May 05 11:45:40 2002 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= SMESHGUI_Swig.hxx \ + SMESHGUI_Swig.i + +# .po files to transform in .qm +PO_FILES = \ + SMESH_icons.po \ + SMESH_msg_en.po + +# Libraries targets +LIB = libSMESHGUI.la +LIB_SRC = SMESHGUI.cxx \ + SMESHGUI_StudyAPI.cxx \ + SMESHGUI_SpinBox.cxx \ + SMESHGUI_NodesDlg.cxx \ + SMESHGUI_AddHypothesisDlg.cxx \ + SMESHGUI_AddAlgorithmDlg.cxx \ + SMESHGUI_InitMeshDlg.cxx \ + SMESHGUI_AddSubMeshDlg.cxx \ + SMESHGUI_LocalLengthDlg.cxx \ + SMESHGUI_NbSegmentsDlg.cxx \ + SMESHGUI_TransparencyDlg.cxx \ + SMESHGUI_RemoveNodesDlg.cxx \ + SMESHGUI_RemoveElementsDlg.cxx \ + SMESHGUI_MeshInfosDlg.cxx \ + SMESHGUI_Preferences_ColorDlg.cxx \ + SMESHGUI_MaxElementAreaDlg.cxx \ + SMESHGUI_Preferences_ScalarBarDlg.cxx \ + SMESHGUI_EditScalarBarDlg.cxx \ + SMESHGUI_aParameterDlg.cxx \ + SMESHGUI_MaxElementVolumeDlg.cxx \ + SMESHGUI_Swig.cxx \ + SMESHGUI_ComputeScalarValue.cxx \ + SMESHGUI_MoveNodesDlg.cxx \ + SMESHGUI_OrientationElementsDlg.cxx \ + SMESHGUI_DiagonalInversionDlg.cxx \ + SMESHGUI_EdgesConnectivityDlg.cxx \ + SMESHGUI_AddFaceDlg.cxx \ + SMESHGUI_AddVolumeDlg.cxx \ + SMESHGUI_AddEdgeDlg.cxx \ + SMESHGUI_EditHypothesesDlg.cxx + +LIB_MOC = \ + SMESHGUI.h \ + SMESHGUI_NodesDlg.h \ + SMESHGUI_SpinBox.h \ + SMESHGUI_AddHypothesisDlg.h \ + SMESHGUI_AddAlgorithmDlg.h \ + SMESHGUI_InitMeshDlg.h \ + SMESHGUI_AddSubMeshDlg.h \ + SMESHGUI_LocalLengthDlg.h \ + SMESHGUI_NbSegmentsDlg.h \ + SMESHGUI_TransparencyDlg.h \ + SMESHGUI_RemoveNodesDlg.h \ + SMESHGUI_RemoveElementsDlg.h \ + SMESHGUI_MeshInfosDlg.h \ + SMESHGUI_Preferences_ColorDlg.h \ + SMESHGUI_MaxElementAreaDlg.h \ + SMESHGUI_Preferences_ScalarBarDlg.h \ + SMESHGUI_EditScalarBarDlg.h \ + SMESHGUI_aParameterDlg.h \ + SMESHGUI_MaxElementVolumeDlg.h \ + SMESHGUI_MoveNodesDlg.h \ + SMESHGUI_OrientationElementsDlg.h \ + SMESHGUI_DiagonalInversionDlg.h \ + SMESHGUI_EdgesConnectivityDlg.h \ + SMESHGUI_AddEdgeDlg.h \ + SMESHGUI_AddVolumeDlg.h \ + SMESHGUI_AddFaceDlg.h \ + SMESHGUI_EditHypothesesDlg.h + +LIB_CLIENT_IDL = SALOME_Exception.idl \ + GEOM_Gen.idl \ + GEOM_Shape.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Hypothesis.idl \ + SMESH_BasicHypothesis.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_ModuleCatalog.idl \ + SALOME_Component.idl \ + MED.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +#$(OCC_CXXFLAGS) + +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lSMESHObject -lSMDS -lSMESHDS -lSMESHFiltersSelection -lGeometryClient -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV $(OCC_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx new file mode 100644 index 000000000..72e66bf00 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -0,0 +1,6013 @@ +using namespace std; +// File : SMESHGUI.cxx +// Created : Sun May 05 11:49:46 2002 +// Author : Nicolas REJNERI +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI.h" +#include "SMESHGUI_AddHypothesisDlg.h" +#include "SMESHGUI_AddAlgorithmDlg.h" +#include "SMESHGUI_InitMeshDlg.h" +#include "SMESHGUI_LocalLengthDlg.h" +#include "SMESHGUI_NbSegmentsDlg.h" +#include "SMESHGUI_AddSubMeshDlg.h" +#include "SMESHGUI_NodesDlg.h" +#include "SMESHGUI_TransparencyDlg.h" +#include "SMESHGUI_RemoveNodesDlg.h" +#include "SMESHGUI_RemoveElementsDlg.h" +#include "SMESHGUI_MeshInfosDlg.h" +#include "SMESHGUI_Preferences_ColorDlg.h" +#include "SMESHGUI_MaxElementAreaDlg.h" +#include "SMESHGUI_MaxElementVolumeDlg.h" +#include "SMESHGUI_Preferences_ScalarBarDlg.h" +#include "SMESHGUI_EditScalarBarDlg.h" +#include "SMESHGUI_aParameterDlg.h" +#include "SMESHGUI_ComputeScalarValue.h" +#include "SMESHGUI_MoveNodesDlg.h" +#include "SMESHGUI_OrientationElementsDlg.h" +#include "SMESHGUI_DiagonalInversionDlg.h" +#include "SMESHGUI_EdgesConnectivityDlg.h" +#include "SMESHGUI_AddFaceDlg.h" +#include "SMESHGUI_AddEdgeDlg.h" +#include "SMESHGUI_AddVolumeDlg.h" +#include "SMESHGUI_EditHypothesesDlg.h" + +#include "SMESH_Grid.h" + +// SALOME Includes +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +#include "QAD.h" +#include "QAD_Tools.h" +#include "QAD_Config.h" +#include "QAD_Settings.h" +#include "QAD_RightFrame.h" +#include "QAD_MessageBox.h" +#include "QAD_Resource.h" +#include "QAD_FileDlg.h" +#include "SALOMEGUI_Desktop.h" +#include "SALOMEGUI_NameDlg.h" + +#include "OCCViewer_ViewPort.h" +#include "OCCViewer_ViewPort3d.h" +#include "OCCViewer_Viewer3d.h" + +#include "VTKViewer_RenderWindowInteractor.h" +#include "VTKViewer_ViewFrame.h" +//#include "QAD_ViewPort.h" +//#include "QAD_ViewPort3d.h" + +#include "GEOM_Client.hxx" +#include "GEOM_InteractiveObject.hxx" + +#include "SALOME_NamingService.hxx" +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_InteractiveObject.hxx" + +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "utilities.h" + +#include "SMDS_Mesh.hxx" +#include "SMESHDS_Document.hxx" +#include "Document_Reader.h" +#include "Document_Writer.h" +#include "Mesh_Reader.h" +#include "Mesh_Writer.h" + +#include "DriverDAT_R_SMESHDS_Document.h" +#include "DriverMED_R_SMESHDS_Document.h" +#include "DriverUNV_R_SMESHDS_Document.h" +#include "DriverDAT_W_SMESHDS_Document.h" +#include "DriverMED_W_SMESHDS_Document.h" +#include "DriverUNV_W_SMESHDS_Document.h" +#include "DriverDAT_R_SMESHDS_Mesh.h" +#include "DriverMED_R_SMESHDS_Mesh.h" +#include "DriverUNV_R_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverMED_W_SMESHDS_Mesh.h" +#include "DriverUNV_W_SMESHDS_Mesh.h" + +// QT Includes +#define INCLUDE_MENUITEM_DEF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Open CASCADE Includes +#include +#include + +static GEOM_Client ShapeReader; +static SMESHGUI* smeshGUI = 0; +static CORBA::ORB_var _orb; + + +//============================================================================= +/*! + * + */ +//============================================================================= +class CustomItem : public QCustomMenuItem +{ +public: + CustomItem( const QString& s, const QFont& f ) + : string( s ), font( f ){}; + ~CustomItem(){} + + void paint( QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h ) + { + p->setFont ( font ); + p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); + } + + QSize sizeHint() + { + return QFontMetrics( font ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); + } +private: + QString string; + QFont font; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESHGUI::SMESHGUI() : + QObject() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESHGUI::~SMESHGUI() +{ +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESHGUI* SMESHGUI::GetSMESHGUI( ) +{ + return smeshGUI; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESHGUI* SMESHGUI::GetOrCreateSMESHGUI( QAD_Desktop* desktop ) +{ + if( smeshGUI == 0 ) { + setOrb(); + smeshGUI = new SMESHGUI; + smeshGUI->myActiveDialogBox = 0 ; + smeshGUI->myState = -1 ; + smeshGUI->myDesktop = desktop ; + smeshGUI->myActiveStudy = desktop->getActiveStudy(); + + Engines::Component_var comp = desktop->getEngine("FactoryServer", "SMESH"); + smeshGUI->myComponentMesh = SMESH::SMESH_Gen::_narrow(comp); + + Engines::Component_var comp1 = desktop->getEngine("FactoryServer", "Geometry"); + smeshGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp1); + + /* GetCurrentStudy */ + smeshGUI->myStudyId = smeshGUI->myActiveStudy->getStudyId(); + + smeshGUI->myComponentGeom->GetCurrentStudy( smeshGUI->myStudyId ); + // smeshGUI->myComponentGeom->NbLabels(); + + smeshGUI->myStudy = smeshGUI->myActiveStudy->getStudyDocument(); + + smeshGUI->myStudyAPI = SMESHGUI_StudyAPI(smeshGUI->myStudy, smeshGUI->myComponentMesh); + + smeshGUI->myDocument = new SMESHDS_Document(1);//NBU + + smeshGUI->mySimulationActors = vtkActorCollection::New(); + smeshGUI->mySimulationActors2D = vtkActor2DCollection::New(); + } else { + /* study may have changed */ + smeshGUI->myActiveStudy = desktop->getActiveStudy(); + smeshGUI->myStudyAPI.Update(smeshGUI->myComponentMesh); + } + + /* Automatic Update */ + if ( desktop->menuBar()->isItemChecked(1001) ) + smeshGUI->myAutomaticUpdate = true; + else + smeshGUI->myAutomaticUpdate = false; + + return smeshGUI; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::SetState(int aState ) +{ this->myState = aState ; return ; } + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::ResetState() +{ this->myState = -1 ; return ; } + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::EmitSignalDeactivateDialog() +{ + emit this->SignalDeactivateActiveDialog() ; + return ; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::EmitSignalCloseAllDialogs() +{ + emit this->SignalCloseAllDialogs() ; + return ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +QDialog* SMESHGUI::GetActiveDialogBox() +{ + return this->myActiveDialogBox ; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::SetActiveDialogBox(QDialog* aDlg) +{ + this->myActiveDialogBox = (QDialog*)aDlg ; + return ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +QAD_Study* SMESHGUI::GetActiveStudy() +{ + return this->myActiveStudy ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +SALOMEDS::Study_ptr SMESHGUI::GetStudy() +{ + return SALOMEDS::Study::_narrow( myStudy ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESHGUI_StudyAPI SMESHGUI::GetStudyAPI() +{ + return myStudyAPI; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +QAD_Desktop* SMESHGUI::GetDesktop() +{ + return this->myDesktop ; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +vtkScalarBarActor* SMESHGUI::GetScalarBar() +{ + vtkRenderer* aRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActor2DCollection* actor2DList = aRenderer->GetActors2D(); + actor2DList->InitTraversal(); + vtkActor2D* aActor2d = actor2DList->GetNextActor2D(); + while (aActor2d != NULL) { + if (aActor2d->IsA("vtkScalarBarActor")) + return vtkScalarBarActor::SafeDownCast(aActor2d); + actor2DList->GetNextActor2D(); + } + return NULL; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::activeStudyChanged( QAD_Desktop* parent ) +{ + MESSAGE ("SMESHGUI::activeStudyChanged init.") + /* Create or retrieve an object SMESHGUI */ + SMESHGUI::GetOrCreateSMESHGUI(parent); + if(smeshGUI != 0) { + smeshGUI->EmitSignalCloseAllDialogs() ; + MESSAGE( "Active study changed : SMESHGUI nullified" << endl ) ; + smeshGUI = 0 ; + } + + //smeshGUI->SetSettings( parent ); //DCQ : Pb. Multi-Etudes + MESSAGE ("SMESHGUI::activeStudyChanged done.") + return ; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::DefineDlgPosition(QWidget* aDlg, int& x, int& y) +{ + /* Here the position is on the bottom right corner - 10 */ + QAD_Desktop* PP = QAD_Application::getDesktop() ; + x = abs ( PP->x() + PP->size().width() - aDlg->size().width() - 10 ) ; + y = abs ( PP->y() + PP->size().height() - aDlg->size().height() - 10 ) ; + return true ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::EraseSimulationActors() +{ + if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + + if ( mySimulationActors != NULL ) { + + mySimulationActors->InitTraversal(); + vtkActor *ac = mySimulationActors->GetNextActor(); + while(!(ac==NULL)) { + theRenderer->RemoveActor(ac); + ac = mySimulationActors->GetNextActor(); + } + mySimulationActors->RemoveAllItems(); + } + if ( mySimulationActors2D != NULL ) { + mySimulationActors2D->InitTraversal(); + vtkActor2D *ac = mySimulationActors2D->GetNextActor2D(); + while(!(ac==NULL)) { + theRenderer->RemoveActor2D(ac); + ac = mySimulationActors2D->GetNextActor2D(); + } + mySimulationActors2D->RemoveAllItems(); + } + renWin->Render(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_Mesh_ptr SMESHGUI::InitMesh( GEOM::GEOM_Shape_ptr aShape, QString NameMesh ) +{ + try { + if ( !myComponentMesh->_is_nil() && !aShape->_is_nil() ) { + SMESH::SMESH_Mesh_var aMesh = myComponentMesh->Init( myComponentGeom, myStudyId, aShape); + + if ( !aMesh->_is_nil() ) { + SALOMEDS::SObject_var SM = myStudyAPI.AddNewMesh ( aMesh ); + myStudyAPI.SetName( SM, NameMesh ); + + // GEOM::GEOM_Shape has non-empty StudyShapeId only after AddInStudy operation, + // not after loading from file, so let's use more reliable way to retrieve SObject + Standard_CString ShapeIOR = _orb->object_to_string(aShape); + SALOMEDS::SObject_var SObject = myStudy->FindObjectIOR(ShapeIOR); + if ( !SObject->_is_nil() && !SM->_is_nil() ) { + myStudyAPI.SetShape( SM, SObject ); + } + return SMESH::SMESH_Mesh::_narrow(aMesh); + } + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); + return SMESH::SMESH_Mesh::_nil(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_subMesh_ptr SMESHGUI::AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh, GEOM::GEOM_Shape_ptr aShape, QString NameMesh ) +{ + try { + SMESH::SMESH_subMesh_var aSubMesh = aMesh->GetElementsOnShape(aShape); + SALOMEDS::SObject_var SO_Mesh = myStudyAPI.FindMesh(aMesh); + Standard_CString ShapeIOR = _orb->object_to_string(aShape); + SALOMEDS::SObject_var SO_GeomShape = myStudy->FindObjectIOR(ShapeIOR); + + if ( !SO_GeomShape->_is_nil() && !SO_Mesh->_is_nil() && !aSubMesh->_is_nil() && !aMesh->_is_nil() ) { + SALOMEDS::SObject_var SO = myStudyAPI.AddSubMeshOnShape(SO_Mesh, SO_GeomShape, aSubMesh, aShape->ShapeType() ); + myStudyAPI.SetName(SO, NameMesh); + + SMESH_Actor* amesh = SMESH_Actor::New(); + Handle(SALOME_InteractiveObject) IO = new SALOME_InteractiveObject(SO->GetID(), + "MESH", + strdup(NameMesh)); + amesh->setIO( IO ); + amesh->setName( strdup(NameMesh) ); + DisplayActor(amesh, false); + return SMESH::SMESH_subMesh::_narrow( aSubMesh ); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); + return SMESH::SMESH_subMesh::_nil(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_Hypothesis_ptr SMESHGUI::CreateHypothesis( QString TypeHypothesis, + QString NameHypothesis ) +{ + SMESH::SMESH_Hypothesis_var Hyp; + try { + Hyp = myComponentMesh->CreateHypothesis( TypeHypothesis, myStudyId ); + if ( !Hyp->_is_nil() ) { + SALOMEDS::SObject_var SHyp = myStudyAPI.AddNewHypothesis( Hyp ); + myStudyAPI.SetName( SHyp, NameHypothesis); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + return SMESH::SMESH_Hypothesis::_narrow( Hyp ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) +{ + if ( !aMesh->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + SALOMEDS::SObject_var SM = myStudyAPI.FindMesh( aMesh ); + GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SM ); + try { + bool res = aMesh->AddHypothesis( aShape, aHyp ); + if (res) { + SALOMEDS::SObject_var SH = myStudyAPI.FindHypothesisOrAlgorithms( aHyp ); + if ( !SM->_is_nil() && !SH->_is_nil() ) { + myStudyAPI.SetHypothesis( SM, SH ); + myStudyAPI.ModifiedMesh( SM, false ); + } + QApplication::restoreOverrideCursor(); + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_ALREADYEXIST"), tr ("SMESH_BUT_YES") ); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveHypothesisOrAlgorithmOnMesh( const Handle(SALOME_InteractiveObject)& IObject ) +{ + if ( IObject->hasReference() ) { + SMESH::SMESH_Hypothesis_var anHyp; + SALOMEDS::SObject_var SO_Hypothesis = smeshGUI->myStudy->FindObjectID(IObject->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + + if ( !SO_Hypothesis->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + if (SO_Hypothesis->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anHyp = SMESH::SMESH_Hypothesis::_narrow( _orb->string_to_object(anIOR->Value()) ); + } + + SALOMEDS::SObject_var SO_Applied_Hypothesis = smeshGUI->myStudy->FindObjectID(IObject->getReference()); + if ( !SO_Applied_Hypothesis->_is_nil() ) { + SALOMEDS::SObject_var MorSM = smeshGUI->myStudyAPI.GetMeshOrSubmesh( SO_Applied_Hypothesis ); + if ( !MorSM->_is_nil() ) { + smeshGUI->myStudyAPI.ModifiedMesh( MorSM, false ); + + GEOM::GEOM_Shape_var aShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh( MorSM ); + if ( !aShape->_is_nil() ) { + if (MorSM->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->RemoveHypothesis( aShape, anHyp ); + if ( !res ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_NOTEXIST"), tr ("SMESH_BUT_YES") ); + } + } else if ( !aSubMesh->_is_nil() ) { + aMesh = aSubMesh->GetFather(); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->RemoveHypothesis( aShape, anHyp ); + if ( !res ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_NOTEXIST"), tr ("SMESH_BUT_YES") ); + } + } + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { +#ifdef TRACE + Dump( Mesh ); +#endif + DisplayActor( Mesh ); + DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + } + } + } + } + } + smeshGUI->myStudyAPI.UnSetHypothesis( SO_Applied_Hypothesis ); + } + } + } else if ( IObject->hasEntry() ) { + MESSAGE ( "IObject entry " << IObject->getEntry() ) + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveHypothesisOrAlgorithmOnMesh( SALOMEDS::SObject_ptr MorSM, SMESH::SMESH_Hypothesis_ptr anHyp ) +{ + SALOMEDS::SObject_var AHR, aRef; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + + if ( !MorSM->_is_nil() ) { + GEOM::GEOM_Shape_var aShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh( MorSM ); + if ( !aShape->_is_nil() ) { + if (MorSM->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->RemoveHypothesis( aShape, anHyp ); + if ( !res ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_NOTEXIST"), tr ("SMESH_BUT_YES") ); + } + } else if ( !aSubMesh->_is_nil() ) { + aMesh = aSubMesh->GetFather(); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->RemoveHypothesis( aShape, anHyp ); + if ( !res ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_NOTEXIST"), tr ("SMESH_BUT_YES") ); + } + } + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { +#ifdef TRACE + Dump( Mesh ); +#endif + DisplayActor( Mesh ); + DisplayEdges( Mesh ); + // smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + } + } + } + } + + if ( MorSM->FindSubObject (2, AHR)) { + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if ( strcmp( anIOR->Value(), _orb->object_to_string(anHyp) ) == 0 ) { + smeshGUI->myStudyAPI.UnSetHypothesis( Obj ); + break; + } + } + } + } + } + if ( MorSM->FindSubObject (3, AHR)) { + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if ( strcmp( anIOR->Value(), _orb->object_to_string(anHyp) ) == 0 ) { + smeshGUI->myStudyAPI.UnSetAlgorithm( Obj ); + break; + } + } + } + } + } + smeshGUI->myStudyAPI.ModifiedMesh( MorSM, false ); + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddAlgorithmOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) +{ + if ( !aMesh->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + SALOMEDS::SObject_var SM = myStudyAPI.FindMesh( aMesh ); + GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SM ); + try { + bool res = aMesh->AddHypothesis( aShape, aHyp ); + if (res) { + SALOMEDS::SObject_var SH = myStudyAPI.FindHypothesisOrAlgorithms( aHyp ); + if ( !SM->_is_nil() && !SH->_is_nil() ) { + myStudyAPI.SetAlgorithms( SM, SH ); + myStudyAPI.ModifiedMesh( SM, false ); + } + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_ALGORITHM_ALREADYEXIST"), tr ("SMESH_BUT_YES") ); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddHypothesisOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) +{ + if ( !aSubMesh->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); + SALOMEDS::SObject_var SsubM = myStudyAPI.FindSubMesh( aSubMesh ); + GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SsubM ); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->AddHypothesis( aShape, aHyp ); + if (res) { + SALOMEDS::SObject_var SH = myStudyAPI.FindHypothesisOrAlgorithms( aHyp ); + if ( !SsubM->_is_nil() && !SH->_is_nil() ) { + myStudyAPI.SetHypothesis( SsubM, SH ); + myStudyAPI.ModifiedMesh( SsubM, false ); + } + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_HYPOTHESIS_ALREADYEXIST"), tr ("SMESH_BUT_YES") ); + } + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddAlgorithmOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) +{ + if ( !aSubMesh->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); + SALOMEDS::SObject_var SsubM = myStudyAPI.FindSubMesh( aSubMesh ); + GEOM::GEOM_Shape_var aShape = myStudyAPI.GetShapeOnMeshOrSubMesh( SsubM ); + if ( !aMesh->_is_nil() ) { + bool res = aMesh->AddHypothesis( aShape, aHyp ); + if (res) { + SALOMEDS::SObject_var SH = myStudyAPI.FindHypothesisOrAlgorithms( aHyp ); + if ( !SsubM->_is_nil() && !SH->_is_nil() ) { + myStudyAPI.SetAlgorithms( SsubM, SH ); + myStudyAPI.ModifiedMesh( SsubM, false ); + } + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_ALGORITHM_ALREADYEXIST"), tr ("SMESH_BUT_YES") ); + } + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::CreateAlgorithm( QString TypeAlgo, QString NameAlgo ) +{ + SMESH::SMESH_Hypothesis_var Hyp; + try { + if ( TypeAlgo.compare("Regular_1D") == 0 ) + Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId ); + else if ( TypeAlgo.compare("MEFISTO_2D") == 0 ) + Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId ); + else if ( TypeAlgo.compare("Quadrangle_2D") == 0 ) + Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId ); + else if ( TypeAlgo.compare("Hexa_3D") == 0 ) + Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId ); + + if ( !Hyp->_is_nil() ) { + SALOMEDS::SObject_var SHyp = myStudyAPI.AddNewAlgorithms( Hyp ); + myStudyAPI.SetName( SHyp, NameAlgo); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::CreateLocalLength( QString TypeHypothesis, QString NameHypothesis, double Length ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow( CreateHypothesis( TypeHypothesis, NameHypothesis ) ); + SMESH::SMESH_LocalLength_var LL = SMESH::SMESH_LocalLength::_narrow( Hyp ); + if ( !LL->_is_nil() ) + LL->SetLength( Length ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::CreateMaxElementArea( QString TypeHypothesis, QString NameHypothesis, double MaxArea ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow( CreateHypothesis( TypeHypothesis, NameHypothesis ) ); + SMESH::SMESH_MaxElementArea_var MaxElArea = SMESH::SMESH_MaxElementArea::_narrow( Hyp ); + if ( !MaxElArea->_is_nil() ) + MaxElArea->SetMaxElementArea( MaxArea ); + } + catch (SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::CreateMaxElementVolume( QString TypeHypothesis, QString NameHypothesis, double MaxVolume ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow( CreateHypothesis( TypeHypothesis, NameHypothesis ) ); + SMESH::SMESH_MaxElementVolume_var MaxElVolume = SMESH::SMESH_MaxElementVolume::_narrow( Hyp ); + if ( !MaxElVolume->_is_nil() ) + MaxElVolume->SetMaxElementVolume( MaxVolume ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, double nbSegments ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + SMESH::SMESH_Hypothesis_var Hyp = SMESH::SMESH_Hypothesis::_narrow( CreateHypothesis( TypeHypothesis, NameHypothesis ) ); + SMESH::SMESH_NumberOfSegments_var NbS = SMESH::SMESH_NumberOfSegments::_narrow( Hyp ); + if ( !NbS->_is_nil() ) + NbS->SetNumberOfSegments( nbSegments ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + myActiveStudy->updateObjBrowser(true); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESHGUI::GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) +{ + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + aName = IObject->getName(); + } else { + aName = tr( "SMESH_OBJECTS_SELECTED" ).arg( nbSel ); + } + return nbSel; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESHGUI::GetNameOfSelectedNodes( SALOME_Selection* Sel, QString& aName ) +{ + int nbNodes = 0; + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + if ( !IObject->hasEntry() ) + return -1; + + Standard_Boolean res; + SMESH_Actor* ac = FindActorByEntry( IObject->getEntry(), res, true ); + if ( !res ) + return -1; + + TColStd_MapOfInteger MapIndex; + Sel->GetIndex( IObject, MapIndex ); + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + aName = " "; + nbNodes = MapIndex.Extent(); + for ( ; ite.More(); ite.Next() ) { + aName = aName + QString("%1").arg(ac->GetIdSMESHDSNode(ite.Key())) + " "; + } + } else { + aName = ""; + } + return nbNodes; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESHGUI::GetNameOfSelectedElements( SALOME_Selection* Sel, QString& aName ) +{ + int nbElements = 0; + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + if ( !IObject->hasEntry() ) + return -1; + + Standard_Boolean res; + SMESH_Actor* ac = FindActorByEntry( IObject->getEntry(), res, true ); + if ( !res ) + return -1; + + TColStd_MapOfInteger MapIndex; + Sel->GetIndex( IObject, MapIndex ); + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + aName = " "; + nbElements = MapIndex.Extent(); + MESSAGE("GetNameOfSelectedElements(): number = " << nbElements); + for ( ; ite.More(); ite.Next() ) { + int idVTK = ite.Key(); + MESSAGE("GetNameOfSelectedElements(): VTK Id = " << idVTK); + aName = aName + QString("%1").arg(ac->GetIdSMESHDSElement(idVTK)) + " "; + } + } else { + aName = ""; + } + return nbElements; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESHGUI::GetNameOfSelectedEdges( SALOME_Selection* Sel, QString& aName ) +{ + int nbElements = 0; + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + if ( !IObject->hasEntry() ) + return -1; + + Standard_Boolean res; + SMESH_Actor* ac = FindActorByEntry( IObject->getEntry(), res, true ); + if ( !res ) + return -1; + + TColStd_MapOfInteger MapIndex; + Sel->GetIndex( IObject, MapIndex ); + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + aName = " "; + nbElements = MapIndex.Extent(); + for ( ; ite.More(); ite.Next() ) { + aName = aName + QString("%1").arg(ite.Key()) + " "; + } + } else { + aName = ""; + } + return nbElements; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH_Actor* SMESHGUI::FindActorByEntry(QString entry, + Standard_Boolean& testResult, + bool onlyInActiveView) +{ + int nbSf = myActiveStudy->getStudyFramesCount(); + for ( int i = 0; i < nbSf; i++ ) { + QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); + if ( sf->getTypeView() == VIEW_VTK ) { + vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if ( ac->IsA("SMESH_Actor") ) { + SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( ac ); + if ( anActor->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = anActor->getIO(); + if ( strcmp( IO->getEntry(), entry ) == 0 ) { + if ( onlyInActiveView ) { + if ( sf == myActiveStudy->getActiveStudyFrame() ) { + testResult = true; + return anActor; + } + } else { + testResult = true; + return anActor; + } + } + } + } + ac = theActors->GetNextActor(); + } + } + } + + MESSAGE ( " Actor Not Found " ) + testResult = false; + return SMESH_Actor::New(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH_Actor* SMESHGUI::FindActor(SMESH::SMESH_Mesh_ptr aMesh, + Standard_Boolean& testResult, + bool onlyInActiveView) +{ + SALOMEDS::SObject_var SM = myStudyAPI.FindMesh( aMesh ); + if ( SM->_is_nil() ) { + MESSAGE ( " Actor Not Found " ) + + testResult = false; + return SMESH_Actor::New(); + } + + return FindActorByEntry( SM->GetID(), testResult, onlyInActiveView); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_Mesh_ptr SMESHGUI::ConvertIOinMesh(const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult) +{ + SMESH::SMESH_Mesh_var aMesh; + testResult = false ; + + /* case SObject */ + if ( IO->hasEntry() ) { + SALOMEDS::SObject_var obj = myStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !obj->_is_nil() ) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aMesh = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + if ( !aMesh->_is_nil() ) { + testResult = true ; + return SMESH::SMESH_Mesh::_duplicate( aMesh ); + } + } + } + } + return SMESH::SMESH_Mesh::_nil(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_subMesh_ptr SMESHGUI::ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult) +{ + SMESH::SMESH_subMesh_var aSubMesh; + testResult = false ; + + /* case SObject */ + if ( IO->hasEntry() ) { + SALOMEDS::SObject_var obj = myStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !obj->_is_nil() ) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aSubMesh = SMESH::SMESH_subMesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + if ( !aSubMesh->_is_nil() ) { + testResult = true ; + return SMESH::SMESH_subMesh::_duplicate( aSubMesh ); + } + } + } + } + return SMESH::SMESH_subMesh::_nil(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_Hypothesis_ptr SMESHGUI::ConvertIOinSMESHHypothesis( const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult ) +{ + SMESH::SMESH_Hypothesis_var aHyp ; + testResult = false ; + + /* case SObject */ + if ( IO->hasEntry() ) { + SALOMEDS::SObject_var obj = myStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !obj->_is_nil() ) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aHyp = SMESH::SMESH_Hypothesis::_narrow( _orb->string_to_object(anIOR->Value())); + if ( !aHyp->_is_nil() ) { + testResult = true ; + return SMESH::SMESH_Hypothesis::_duplicate( aHyp ); + } + } + } + } + return SMESH::SMESH_Hypothesis::_nil(); +} + + + +//============================================================================= +/*! + * + */ +//============================================================================= +GEOM::GEOM_Shape_ptr SMESHGUI::ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult ) +{ + GEOM::GEOM_Shape_var aShape ; + testResult = false ; + + /* case SObject */ + if ( IO->hasEntry() ) { + SALOMEDS::SObject_var obj = myStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !obj->_is_nil() ) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aShape = myComponentGeom->GetIORFromString(anIOR->Value()) ; + if ( !aShape->_is_nil() ) { + testResult = true ; + return GEOM::GEOM_Shape::_duplicate( aShape ); + } + } + } + } + return GEOM::GEOM_Shape::_nil(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::SetViewMode(int commandId) +{ + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + if ( nbSel >= 1 ) { + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for ( ; It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if ( IObject->hasEntry() ) { + Standard_Boolean res; + SMESH_Actor* ac = FindActorByEntry( IObject->getEntry(), res, true ); + if ( res ) { + switch (commandId) { + case 211: { + ChangeRepresentation( ac, 0 ); + break; + } + case 212: { + ChangeRepresentation( ac, 1 ); + break; + } + case 213: { + ChangeRepresentation( ac, 2 ); + break; + } + case 1132: { + ChangeRepresentation( ac, 3 ); + break; + } + } + } + } + } + if ( commandId == 1133 ) { + ChangeRepresentation( SMESH_Actor::New(), 4 ); + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type ) +{ + if (ac->DataSource == NULL && type != 4 ) + return; + + if ( type != 4 ) { + if ( ac->getMapper() == NULL ) { + return; + } + } + switch (type) { + case 0 : { + QApplication::setOverrideCursor( Qt::waitCursor ); + if (ac->getDisplayMode()==2) { + vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); + meshMapper->SetInput(ac->DataSource); + } + ac->setDisplayMode(0); + ac->GetProperty()->SetRepresentationToWireframe(); + // ac->SetActorProperty( ac->GetProperty() ); + QApplication::restoreOverrideCursor(); + break; + } + case 1 : { + QApplication::setOverrideCursor( Qt::waitCursor ); + if (ac->getDisplayMode()==2) { + vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); + meshMapper->SetInput(ac->DataSource); + } + ac->setDisplayMode(1); + ac->GetProperty()->SetRepresentationToSurface(); + QApplication::restoreOverrideCursor(); + // ac->SetActorProperty( ac->GetProperty() ); + break; + } + case 2 : { + // if (!(ac->getDisplayMode()==2)) { + // ChangeRepresentation(ac, 1); + QApplication::setOverrideCursor( Qt::waitCursor ); + ac->setDisplayMode(2); + vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); + meshMapper->SetInput(ac->DataSource); + vtkShrinkFilter *shrink = vtkShrinkFilter::New(); + shrink->SetInput(meshMapper->GetInput()); + shrink->SetShrinkFactor(ac->GetShrinkFactor()); + + meshMapper->SetInput( shrink->GetOutput() ); + ac->SetMapper( meshMapper ); + QApplication::restoreOverrideCursor(); + // } + break; + } + case 3: + { + float color[3]; + float edgecolor[3]; + float backfacecolor[3]; + float nodecolor[3]; + ac->GetColor(color[0],color[1],color[2]); + QColor c(color[0]*255,color[1]*255,color[2]*255); + ac->GetEdgeColor(edgecolor[0],edgecolor[1],edgecolor[2]); + QColor e(edgecolor[0]*255,edgecolor[1]*255,edgecolor[2]*255); + ac->GetBackfaceProperty()->GetColor(backfacecolor); + QColor b(backfacecolor[0]*255,backfacecolor[1]*255,backfacecolor[2]*255); + ac->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2] ) ; + QColor n(nodecolor[0]*255, nodecolor[1]*255, nodecolor[2]*255 ) ; + + int Edgewidth = (int)ac->EdgeDevice->GetProperty()->GetLineWidth(); + if ( Edgewidth == 0 ) + Edgewidth = 1; + int intValue = ac->GetNodeSize() ; + float Shrink = ac->GetShrinkFactor(); + + SMESHGUI_Preferences_ColorDlg *aDlg = new SMESHGUI_Preferences_ColorDlg( QAD_Application::getDesktop(), "" ) ; + aDlg->SetColor(1,c); + aDlg->SetColor(2,e); + aDlg->SetColor(3,n); + aDlg->SetColor(4,b); + aDlg->SetIntValue(1,Edgewidth); + aDlg->SetIntValue(2,intValue); + aDlg->SetIntValue(3,int(Shrink*100.)); + + if ( aDlg->exec() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + QColor color = aDlg->GetColor(1); + QColor edgecolor = aDlg->GetColor(2); + QColor nodecolor = aDlg->GetColor(3); + QColor backfacecolor = aDlg->GetColor(4); + /* actor color and backface color */ + ac->GetProperty()->SetColor(float(color.red())/255.,float(color.green())/255.,float(color.blue())/255.); + ac->SetColor(float(color.red())/255.,float(color.green())/255.,float(color.blue())/255.); + ac->GetBackfaceProperty()->SetColor(float(backfacecolor.red())/255.,float(backfacecolor.green())/255.,float(backfacecolor.blue())/255.); + + /* edge color */ + ac->EdgeDevice->GetProperty()->SetColor(float(edgecolor.red())/255., + float(edgecolor.green())/255., + float(edgecolor.blue())/255.); + ac->EdgeShrinkDevice->GetProperty()->SetColor(float(edgecolor.red())/255., + float(edgecolor.green())/255., + float(edgecolor.blue())/255.); + ac->SetEdgeColor(float(edgecolor.red())/255., + float(edgecolor.green())/255., + float(edgecolor.blue())/255.); + + /* Shrink factor and size edges */ + ac->SetShrinkFactor( aDlg->GetIntValue(3)/100. ); + ac->EdgeDevice->GetProperty()->SetLineWidth( aDlg->GetIntValue(1) ); + ac->EdgeShrinkDevice->GetProperty()->SetLineWidth( aDlg->GetIntValue(1) ); + + /* Nodes color and size */ + ac->SetNodeColor(float(nodecolor.red())/255., + float(nodecolor.green())/255., + float(nodecolor.blue())/255.); + ac->SetNodeSize(aDlg->GetIntValue(2)) ; + + if (ac->getDisplayMode()==2) { + vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); + meshMapper->SetInput(ac->DataSource); + vtkShrinkFilter *shrink = vtkShrinkFilter::New(); + shrink->SetInput(meshMapper->GetInput()); + shrink->SetShrinkFactor(ac->GetShrinkFactor()); + + meshMapper->SetInput( shrink->GetOutput() ); + ac->SetMapper( meshMapper ); + } + } + delete aDlg; + QApplication::restoreOverrideCursor(); + break; + } + case 4: + { + EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + SMESHGUI_TransparencyDlg *aDlg = new SMESHGUI_TransparencyDlg( QAD_Application::getDesktop(), "", Sel) ; + break; + } + case 5: { + QApplication::setOverrideCursor( Qt::waitCursor ); + ac->GetProperty()->SetRepresentationToPoints(); + QApplication::restoreOverrideCursor(); + break; + } + } + + QApplication::setOverrideCursor( Qt::waitCursor ); + if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + theRenderer->Render(); + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::UpdateView() +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + theRenderer->Render(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplayActor(SMESH_Actor* ac, bool visibility) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + MESSAGE("DisplayActor(): DataSource = " << ac->DataSource); + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = theRenderer->GetActors(); + theActors->InitTraversal(); + if ( theActors->IsItemPresent(ac) == 0 ) { + vtkProperty* prop = vtkProperty::New(); + prop->SetColor( QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue").toFloat()/255. ) ; + + prop->SetPointSize( QAD_CONFIG->getSetting("SMESH:SettingsNodesSize").toInt()); + prop->SetLineWidth( QAD_CONFIG->getSetting("SMESH:SettingsWidth").toInt() ); + ac->SetProperty( prop ); + ac->SetColor( QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue").toFloat()/255. ); + + // prop->BackfaceCullingOn(); + vtkProperty* backprop = vtkProperty::New(); + backprop->SetColor( QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue").toFloat()/255. ) ; + ac->SetBackfaceProperty(backprop); + + int intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff").toInt(); + if (intValue == 0 ) + intValue = 80; + ac->SetShrinkFactor( intValue/100. ); + + ac->GetMapper()->SetResolveCoincidentTopologyToShiftZBuffer(); + ac->GetMapper()->SetResolveCoincidentTopologyZShift(0.02); + + QString DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode"); + if ( DisplayMode.compare("Wireframe") == 0 ){ + ac->setDisplayMode(0); + ChangeRepresentation( ac, 0 ); + } else if ( DisplayMode.compare("Shading") == 0 ){ + ac->setDisplayMode(1); + ChangeRepresentation( ac, 1 ); + } else if ( DisplayMode.compare("Shrink") == 0 ) { + ac->setDisplayMode(2); + ChangeRepresentation( ac, 2 ); + } + theRenderer->AddActor(ac); + } else { + if (ac->GetMapper()) + ac->GetMapper()->Update(); + } + +// if ( visibility ) + ac->SetVisibility(visibility); +// ac->VisibilityOn(); +// else +// ac->VisibilityOff(); + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::EraseActor(SMESH_Actor* ac) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + + //NRI- : 02/12/2002 : Fixed bugId 882 + // ac->EdgeDevice->VisibilityOff(); + // ac->EdgeShrinkDevice->VisibilityOff(); + // ac->VisibilityOff(); + ac->SetVisibility( false ); + + theRenderer->Render(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::AddActorInSelection(SMESH_Actor* ac) +{ + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + if ( ac->hasIO() ) + return Sel->AddIObject( ac->getIO() ); + else + return -1; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +QString SMESHGUI::CheckHomogeneousSelection() +{ + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + /* copy the list */ + SALOME_ListIO List; + SALOME_ListIteratorOfListIO Itinit( Sel->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + List.Append(Itinit.Value()); + } + + QString RefType = CheckTypeObject( Sel->firstIObject() ); + SALOME_ListIteratorOfListIO It( List ); + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + QString Type = CheckTypeObject( IObject ); + if ( Type.compare( RefType ) != 0 ) + return "Heterogeneous Selection"; + } + + Sel->ClearIObjects(); + SALOME_ListIteratorOfListIO It1( List ); + for(;It1.More();It1.Next()) { + int res = Sel->AddIObject( It1.Value() ); + if ( res == -1 ) + myActiveStudy->highlight( It1.Value(), false ); + if ( res == 0 ) + myActiveStudy->highlight( It1.Value(), true ); + } + return RefType; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +QString SMESHGUI::CheckTypeObject(const Handle(SALOME_InteractiveObject)& IO) +{ + SALOMEDS::SObject_var sobj = smeshGUI->myActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry()); + if (!sobj->_is_nil()) { + SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent(); + if (strcmp(scomp->GetID(), IO->getEntry()) == 0) { // component is selected + return "Component"; + } + } + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + + Handle(SMESH_TypeFilter) aHypFilter = new SMESH_TypeFilter( HYPOTHESIS ); + Handle(SMESH_TypeFilter) anAlgoFilter = new SMESH_TypeFilter( ALGORITHM ); + Handle(SMESH_TypeFilter) aMeshFilter = new SMESH_TypeFilter( MESH ); + Handle(SMESH_TypeFilter) aSubMeshFilter = new SMESH_TypeFilter( SUBMESH ); + Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH ); + Handle(SMESH_TypeFilter) aSubMeshVextexFilter = new SMESH_TypeFilter( SUBMESH_VERTEX ); + Handle(SMESH_TypeFilter) aSubMeshEdgeFilter = new SMESH_TypeFilter( SUBMESH_EDGE ); + Handle(SMESH_TypeFilter) aSubMeshFaceFilter = new SMESH_TypeFilter( SUBMESH_FACE ); + Handle(SMESH_TypeFilter) aSubMeshSolidFilter = new SMESH_TypeFilter( SUBMESH_SOLID ); + Handle(SMESH_TypeFilter) aSubMeshCompoundFilter = new SMESH_TypeFilter( SUBMESH_COMPOUND ); + + Sel->AddFilter(aHypFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "Hypothesis"; + } + + Sel->ClearFilters(); + Sel->AddFilter(anAlgoFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "Algorithm"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aMeshFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "Mesh"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "SubMesh"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshVextexFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "SubMeshVertex"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshEdgeFilter); + if ( Sel->AddIObject( IO ) != -1 ){ + Sel->ClearFilters(); + return "SubMeshEdge"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshFaceFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "SubMeshFace"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshSolidFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "SubMeshSolid"; + } + + Sel->ClearFilters(); + Sel->AddFilter(aSubMeshCompoundFilter); + if ( Sel->AddIObject( IO ) != -1 ) { + Sel->ClearFilters(); + return "SubMeshCompound"; + } + + Sel->ClearFilters(); + Sel->AddIObject( IO ); + return "NoType"; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + /* Create or retrieve an object SMESHGUI */ + SMESHGUI::GetOrCreateSMESHGUI(parent); + + // NRI : Temporary added + if ( smeshGUI->myStudy->GetProperties()->IsLocked() ) { + return false; + } + //NRI + + // QAD_Viewer3d* v3d; + OCCViewer_Viewer3d* v3d; + + Handle(AIS_InteractiveContext) ic; + vtkRenderer* Renderer; + vtkRenderWindow* RenWin; + + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + v3d =((OCCViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } else if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { + Renderer = ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + RenWin = Renderer->GetRenderWindow(); + } + + switch (theCommandID) + { + case 33: // DELETE + smeshGUI->OnEditDelete(); + break; + + case 113: // IMPORT + case 112: + case 111: + { + Import_Document(parent,theCommandID);//NBU + //Import_Mesh(parent,theCommandID); + break; + } + + case 122: // EXPORT MED + case 121: + case 123: + { + Export_Mesh(parent, theCommandID); + break; + } + + case 200: // SCALAR BAR + { + smeshGUI->DisplayScalarBar(false); + break; + } + case 201: + { + SMESHGUI_EditScalarBarDlg *aDlg = new SMESHGUI_EditScalarBarDlg( parent, "", false ) ; + aDlg->show(); + break; + } + case 202: + { + smeshGUI->DisplayScalarBar( true ); + break; + } + + case 1133: // DISPLAY MODE : WireFrame, Surface, Shrink + case 1132: + case 213: + case 212: + case 211: + { + smeshGUI->SetViewMode(theCommandID); + break; + } + + case 214 : // UPDATE + { + smeshGUI->Update(); + break; + } + + case 300 : // ERASE + { + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + if ( IOS->hasEntry() ) { + Standard_Boolean res; + SMESH_Actor *ac = smeshGUI->FindActorByEntry(IOS->getEntry(), res, true ); + if ( res ) smeshGUI->EraseActor( ac ); + } + } + } + Sel->ClearIObjects(); + smeshGUI->myActiveStudy->updateObjBrowser( true ); + } + + case 301 : // DISPLAY + { + if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + QApplication::setOverrideCursor( Qt::waitCursor ); + SALOMEDS::SObject_var fatherSF = + smeshGUI->myStudy->FindObjectID(smeshGUI->myActiveStudy->getActiveStudyFrame()->entry()); + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if ( IObject->hasEntry() ) { + Standard_Boolean res; + SMESH_Actor *ac = smeshGUI->FindActorByEntry(IObject->getEntry(), res, true ); + if ( res ) { + smeshGUI->DisplayActor( ac, true ); + smeshGUI->DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + } + } + } + QApplication::restoreOverrideCursor(); + } + break; + } + + case 302 : // DISPLAY ONLY + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if ( ac->IsA("SMESH_Actor") ) { + SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( ac ); + if(!anActor->isHighlighted()) { + //anActor->VisibilityOff(); + //NRI- : 02/12/2002 : Fixed bugId 882 + // anActor->EdgeDevice->VisibilityOff(); + // anActor->EdgeShrinkDevice->VisibilityOff(); + anActor->SetVisibility( false ); + } + } + ac = theActors->GetNextActor(); + } + + // Display selection + SALOMEDS::SObject_var fatherSF = smeshGUI->myStudy->FindObjectID(smeshGUI->myActiveStudy->getActiveStudyFrame()->entry()); + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + SALOMEDS::SObject_var obj = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); + + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + // vtkQGLRenderWindowInteractor* myRenderInter= smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor(); + + if(myRenderInter->isInViewer(IObject)) { + if ( IObject->hasEntry() ) { + Standard_Boolean res; + SMESH_Actor *ac = smeshGUI->FindActorByEntry(IObject->getEntry(), res, true ); + if ( res ) { + smeshGUI->DisplayActor( ac, true ); + smeshGUI->DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + } + } + } + } + smeshGUI->myActiveStudy->updateObjBrowser( true ); + QApplication::restoreOverrideCursor(); + } + break; + } + + case 400: // NODES + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_NodesDlg *aDlg = new SMESHGUI_NodesDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + + case 405: // MOVE NODE + { + smeshGUI->myDesktop->SetSelectionMode(1, true); + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_MoveNodesDlg *aDlg = new SMESHGUI_MoveNodesDlg( parent, "", Sel ) ; + break; + } + + case 701: // COMPUTE MESH + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + if ( nbSel != 1 ) { + QApplication::restoreOverrideCursor(); + break; + } + + SMESH::SMESH_Mesh_var aM; + SMESH::SMESH_subMesh_var aSubM; + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + if ( IObject->hasEntry() ) { + SALOMEDS::SObject_var aMorSM = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !aMorSM->_is_nil() ) { + if (aMorSM->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + MESSAGE( "SMESHGUI::OnGUIEvent - Compute mesh : IOR = " << anIOR->Value() ) + CORBA::Object_var cobj; + try { + cobj = _orb->string_to_object(anIOR->Value()); + if ( CORBA::is_nil(cobj) ) { + MESSAGE( "SMESHGUI::OnGUIEvent - Compute mesh : nil object" ) + } + } + catch(CORBA::COMM_FAILURE& ex) { + MESSAGE( "SMESHGUI::OnGUIEvent - Compute mesh : exception (1)" ) + } + aM = SMESH::SMESH_Mesh::_narrow(cobj); + //aM = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + aSubM = SMESH::SMESH_subMesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + if ( !aM->_is_nil() ) { + GEOM::GEOM_Shape_var refShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(aMorSM); + if ( !refShape->_is_nil() ) { + bool compute = smeshGUI->myComponentMesh->IsReadyToCompute(aM, refShape); + if ( !compute ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_MISSING_PARAMETERS"), tr ("SMESH_BUT_YES") ); + break; + } + try { + smeshGUI->myComponentMesh->Compute( aM, refShape); + smeshGUI->myStudyAPI.ModifiedMesh( aMorSM, true ); + // TO Do : change icon of all submeshes + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + } else if ( !aSubM->_is_nil() ) { + aM = aSubM->GetFather(); + GEOM::GEOM_Shape_var refShape = smeshGUI->myStudyAPI.GetShapeOnMeshOrSubMesh(aMorSM); + if ( !refShape->_is_nil() ) { + bool compute = smeshGUI->myComponentMesh->IsReadyToCompute(aM, refShape); + if ( !compute ) { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_MISSING_PARAMETERS"), tr ("SMESH_BUT_YES") ); + break; + } + try { + smeshGUI->myComponentMesh->Compute( aM, refShape); + smeshGUI->myStudyAPI.ModifiedMesh( aMorSM, true ); + // TO Do : change icon of all submeshes + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + } + } + } + } + + // Check whether the actor for the mesh exists at least in one view + Standard_Boolean res; + SMESH_Actor* ac = smeshGUI->FindActorByEntry(IObject->getEntry(), res, false); + if (!res) + smeshGUI->InitActor( aM ); + else { + // Check whether the actor belongs to the active view + VTKViewer_RenderWindowInteractor* rwInter = + ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + // The actor belongs to inactive view -> create a copy and add it in the active view + if (!rwInter->isInViewer(IObject)) { + SMESH_Actor* acCopy = SMESH_Actor::New(); + acCopy->ShallowCopy(ac); + + smeshGUI->DisplayActor( acCopy, false ); + } + } + + if ( smeshGUI->myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aM); + if ( Mesh != NULL ) { +#ifdef TRACE + Dump( Mesh ); +#endif + smeshGUI->DisplayActor( Mesh, true ); + smeshGUI->DisplayEdges( Mesh, true ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + } + } + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + QApplication::restoreOverrideCursor(); + break; + } + + case 702: // ADD SUB MESH + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_AddSubMeshDlg *aDlg = new SMESHGUI_AddSubMeshDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + + case 703: // INIT MESH + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_InitMeshDlg *aDlg = new SMESHGUI_InitMeshDlg( parent, "", Sel ) ; + break; + } + + case 704: // EDIT Hypothesis + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg( parent, "", Sel ) ; + break; + } + + case 705: // EDIT Global Hypothesis + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg( parent, "", Sel ) ; + break; + } + + case 706: // EDIT Local Hypothesis + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg( parent, "", Sel ) ; + break; + } + + case 806: // ORIENTATION ELEMENTS + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + smeshGUI->myDesktop->SetSelectionMode(3, true); + SMESHGUI_OrientationElementsDlg *aDlg = new SMESHGUI_OrientationElementsDlg( parent, "", Sel ) ; + break; + } + + case 807: // DIAGONAL INVERSION + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(2, true); + SMESHGUI_DiagonalInversionDlg *aDlg = new SMESHGUI_DiagonalInversionDlg( parent, "", Sel ) ; + break; + } + + case 900: // MESH INFOS + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg( parent, "", Sel ) ; + break; + } + + case 1001: // AUTOMATIC UPDATE PREFERENCES + { + parent->menuBar()->setItemChecked(1001, !parent->menuBar()->isItemChecked(1001) ); + if ( parent->menuBar()->isItemChecked(1001) ) { + QAD_CONFIG->addSetting("SMESH:AutomaticUpdate","true"); + smeshGUI->myAutomaticUpdate = true; + } else { + QAD_CONFIG->addSetting("SMESH:AutomaticUpdate","false"); + smeshGUI->myAutomaticUpdate = false; + } + break; + } + + case 1003: // MESH PREFERENCES + { + smeshGUI->SetDisplaySettings(); + break; + } + + case 1005: + { + QString Bold = QAD_CONFIG->getSetting("ScalarBar:Bold"); + QString Italic = QAD_CONFIG->getSetting("ScalarBar:Italic"); + QString Shadow = QAD_CONFIG->getSetting("ScalarBar:Shadow"); + QString FontFamily = QAD_CONFIG->getSetting("ScalarBar:FontFamily"); + QString Orientation = QAD_CONFIG->getSetting("ScalarBar:Orientation"); + float Width = QAD_CONFIG->getSetting("ScalarBar:Width").toFloat(); + float Height = QAD_CONFIG->getSetting("ScalarBar:Height").toFloat(); + int NumberOfLabels = QAD_CONFIG->getSetting("ScalarBar:NumberOfLabels").toInt(); + int NumberOfColors = QAD_CONFIG->getSetting("ScalarBar:NumberOfColors").toInt(); + + if ( Width == 0 ) Width = 0.17; + if ( Height == 0 ) Height = 0.8; + if ( NumberOfLabels == 0 ) NumberOfLabels = 5; + if ( NumberOfColors == 0) NumberOfColors = 64; + + SMESHGUI_Preferences_ScalarBarDlg *aDlg = new SMESHGUI_Preferences_ScalarBarDlg( parent, "", true) ; + + if ( Bold.compare("true") == 0 ) + aDlg->Bold->setChecked(true); else aDlg->Bold->setChecked(false); + if ( Italic.compare("true") == 0 ) + aDlg->Italic->setChecked(true); else aDlg->Italic->setChecked(false); + if ( Shadow.compare("true") == 0 ) + aDlg->Shadow->setChecked(true); else aDlg->Shadow->setChecked(false); + + if ( Orientation.compare("Horizontal") == 0 ) + aDlg->RadioHoriz->setChecked(true); else aDlg->RadioVert->setChecked(true); + + int NbItems = aDlg->ComboBox1->count(); + int i = 0; + aDlg->ComboBox1->setCurrentItem( i ); + while ( i < NbItems ) { + if ( FontFamily.compare( aDlg->ComboBox1->text( i ) ) == 0 ) + aDlg->ComboBox1->setCurrentItem( i ); + i++; + } + + aDlg->LineEditWidth->setText( QString("%1").arg(Width) ); + aDlg->LineEditHeight->setText( QString("%1").arg(Height) ); + + aDlg->SpinBoxLabels->setValue( NumberOfLabels ); + aDlg->SpinBoxColors->setValue( NumberOfColors ); + + aDlg->show(); + if ( aDlg->result() ) { + if ( aDlg->RadioHoriz->isChecked() ) + Orientation = "Horizontal"; else Orientation = "Vertical"; + if ( aDlg->Bold->isChecked() ) + Bold = "true"; else Bold = "false"; + if ( aDlg->Italic->isChecked() ) + Italic = "true"; else Italic = "false"; + if ( aDlg->Shadow->isChecked() ) + Shadow = "true"; else Shadow = "false"; + + FontFamily = aDlg->ComboBox1->currentText(); + Width = aDlg->LineEditWidth->text().toFloat(); + Height = aDlg->LineEditHeight->text().toFloat(); + NumberOfColors = aDlg->SpinBoxColors->text().toInt(); + NumberOfLabels = aDlg->SpinBoxLabels->text().toInt(); + + + vtkScalarBarActor* aScalarBar = smeshGUI->GetScalarBar(); + if ( aScalarBar != NULL ) { + smeshGUI->SetSettingsScalarBar(aScalarBar, Bold, Italic, Shadow, + FontFamily, Orientation, + Width, Height, NumberOfColors, NumberOfLabels); + } + + QAD_CONFIG->addSetting("ScalarBar:Bold", Bold); + QAD_CONFIG->addSetting("ScalarBar:Italic", Italic); + QAD_CONFIG->addSetting("ScalarBar:Shadow", Shadow); + QAD_CONFIG->addSetting("ScalarBar:FontFamily", FontFamily); + QAD_CONFIG->addSetting("ScalarBar:Orientation", Orientation); + QAD_CONFIG->addSetting("ScalarBar:Width", Width); + QAD_CONFIG->addSetting("ScalarBar:Height", Height); + QAD_CONFIG->addSetting("ScalarBar:NumberOfLabels", NumberOfLabels); + QAD_CONFIG->addSetting("ScalarBar:NumberOfColors", NumberOfColors); + } + break; + } + + case 1100: // EDIT HYPOTHESIS + { + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount() ; + + if ( nbSel == 1 ) { + Standard_Boolean res; + SMESH::SMESH_Hypothesis_var Hyp = smeshGUI->ConvertIOinSMESHHypothesis( Sel->firstIObject(), res ); + + /* Look for all mesh objects that have this hupothesis affected in order to flag as ModifiedMesh */ + /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */ + /* Warning : however by internal mechanism all subMeshes icons are changed ! */ + SALOMEDS::Study::ListOfSObject_var listSOmesh = smeshGUI->GetMeshesUsingAlgoOrHypothesis( Hyp) ; + + if ( res ) { + QString Name = Hyp->GetName(); + + if ( Name.compare("LocalLength") == 0 ) { + SMESH::SMESH_LocalLength_var LL = SMESH::SMESH_LocalLength::_narrow( Hyp ); + double beforeLength = LL->GetLength() ; + double Length = smeshGUI->Parameter( res, + beforeLength, + tr("SMESH_LOCAL_LENGTH_HYPOTHESIS"), + tr("SMESH_VALUE"), + 1.0E-5, 1E6, 6 ) ; + if ( res && Length != beforeLength ) { + LL->SetLength( Length ); + for( int i=0; ilength(); i++ ) { + smeshGUI->GetStudyAPI().ModifiedMesh( listSOmesh[i], false ) ; + } + break; + } + + } else if ( Name.compare("NumberOfSegments") == 0 ) { + SMESH::SMESH_NumberOfSegments_var NOS = SMESH::SMESH_NumberOfSegments::_narrow( Hyp ); + int beforeNbSeg = NOS->GetNumberOfSegments() ; + int NbSeg = smeshGUI->Parameter( res, + beforeNbSeg, + tr("SMESH_NB_SEGMENTS_HYPOTHESIS"), + tr("SMESH_VALUE"), + 1, 1000000 ) ; + + if ( res && NbSeg != beforeNbSeg ) { + NOS->SetNumberOfSegments( NbSeg ); + for( int i=0; ilength(); i++ ) { + SALOMEDS::SObject_var SO = listSOmesh[i] ; + smeshGUI->GetStudyAPI().ModifiedMesh( listSOmesh[i], false ) ; + } + break; + } + + } else if ( Name.compare("MaxElementArea") == 0 ) { + SMESH::SMESH_MaxElementArea_var MEA = SMESH::SMESH_MaxElementArea::_narrow( Hyp ); + double beforeMaxArea = MEA->GetMaxElementArea() ; + double MaxArea = smeshGUI->Parameter( res, + beforeMaxArea, + tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"), + tr("SMESH_VALUE"), + 1.0E-5, 1E6, 6 ) ; + if ( res && MaxArea != beforeMaxArea ) { + MEA->SetMaxElementArea( MaxArea ); + for( int i=0; ilength(); i++ ) { + smeshGUI->GetStudyAPI().ModifiedMesh( listSOmesh[i], false ) ; + } + break; + } + + } else if ( Name.compare("MaxElementVolume") == 0 ) { + SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( Hyp ); + double beforeMaxVolume = MEV->GetMaxElementVolume() ; + double MaxVolume = smeshGUI->Parameter( res, + beforeMaxVolume, + tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"), + tr("SMESH_VALUE"), + 1.0E-5, 1E6, 6 ) ; + if ( res && MaxVolume != beforeMaxVolume ) { + MEV->SetMaxElementVolume( MaxVolume ); + for( int i=0; ilength(); i++ ) { + smeshGUI->GetStudyAPI().ModifiedMesh( listSOmesh[i], false ) ; + } + break; + } + + } else if ( Name.compare("Regular_1D") == 0 ) { + } else if ( Name.compare("MEFISTO_2D") == 0 ) { + } else { + } + + } + } + break; + } + + case 1101: // RENAME + { + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for ( ; It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + + SALOMEDS::SObject_var obj = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if ( !obj->_is_nil() ) { + if (obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + QString newName = QString( aName->Value() ); + newName = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), newName); + if ( !newName.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + smeshGUI->myActiveStudy->renameIObject( IObject, newName ); + } + QApplication::restoreOverrideCursor(); + } + } + } + break; + } + + case 1102: // REMOVE HYPOTHESIS / ALGORITHMS + { + QApplication::setOverrideCursor( Qt::waitCursor ); + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for ( int i=0; It.More(); It.Next(), i++ ) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + smeshGUI->RemoveHypothesisOrAlgorithmOnMesh( IObject ); + } + Sel->ClearIObjects(); + smeshGUI->myActiveStudy->updateObjBrowser( true ); + QApplication::restoreOverrideCursor(); + break; + } + + case 401: // GEOM::EDGE + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_AddEdgeDlg *aDlg = new SMESHGUI_AddEdgeDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + case 4021: // TRIANGLE + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_AddFaceDlg *aDlg = new SMESHGUI_AddFaceDlg( parent, "", Sel, 3 ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + case 4022: // QUAD + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_AddFaceDlg *aDlg = new SMESHGUI_AddFaceDlg( parent, "", Sel, 4 ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + case 4031: // TETRA + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_AddVolumeDlg *aDlg = new SMESHGUI_AddVolumeDlg( parent, "", Sel, 4 ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + case 4032: // HEXA + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_AddVolumeDlg *aDlg = new SMESHGUI_AddVolumeDlg( parent, "", Sel, 8 ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + + case 4041: // REMOVES NODES + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(1, true); + parent->menuBar()->setItemChecked(9010, false ); + parent->menuBar()->setItemChecked(9011, false ); + smeshGUI->ViewNodes(); + SMESHGUI_RemoveNodesDlg *aDlg = new SMESHGUI_RemoveNodesDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + case 4042: // REMOVES ELEMENTS + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + Sel->ClearIObjects(); + smeshGUI->myDesktop->SetSelectionMode(3, true); + SMESHGUI_RemoveElementsDlg *aDlg = new SMESHGUI_RemoveElementsDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + + case 5000: // HYPOTHESIS - ALGO + { + smeshGUI->CreateAlgorithm("Regular_1D","Wire Discretisation"); + break; + } + case 5010: + { + smeshGUI->CreateAlgorithm("MEFISTO_2D","Triangle (Mefisto)"); + break; + } + case 5011: + { + smeshGUI->CreateAlgorithm("Quadrangle_2D","Quadrangle (Mapping)"); + break; + } + case 5020: + { + smeshGUI->CreateAlgorithm("Hexa_3D","Hexaedral (i,j,k)"); + break; + } + + case 5030: // HYPOTHESIS - LOCAL LENGTH + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_LocalLengthDlg *aDlg = new SMESHGUI_LocalLengthDlg( parent, "" ) ; + break; + } + case 5031: // HYPOTHESIS - NB SEGMENTS + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_NbSegmentsDlg *aDlg = new SMESHGUI_NbSegmentsDlg( parent, "" ) ; + break; + } + + case 5032: // HYPOTHESIS - MAX ELEMENT AREA + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_MaxElementAreaDlg *aDlg = new SMESHGUI_MaxElementAreaDlg( parent, "" ) ; + break; + } + + case 5033: // HYPOTHESIS - MAX ELEMENT VOLUME + { + smeshGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_MaxElementVolumeDlg *aDlg = new SMESHGUI_MaxElementVolumeDlg( parent, "" ) ; + break; + } + + case 6016: // CONTROLS + case 6015: + case 6014: + case 6013: + case 6012: + case 6011: + case 6001: + { + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + if ( nbSel != 1 ) + break; + smeshGUI->Control(theCommandID); + break; + } + + case 6002: + { + if ( smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SMESHGUI_EdgesConnectivityDlg *Dlg = new SMESHGUI_EdgesConnectivityDlg( parent, "", Sel ) ; + } else { + QApplication::restoreOverrideCursor(); + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_VIEWER_VTK"), tr ("SMESH_BUT_YES") ); + } + break; + } + + case 9010: + { + if ( !parent->menuBar()->isItemChecked(9010) ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + parent->menuBar()->setItemChecked(9011, false ); + + smeshGUI->EraseSimulationActors(); + smeshGUI->mySimulationActors2D = vtkActor2DCollection::New(); + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Standard_Boolean res; + SMESH_Actor* MeshActor = smeshGUI->FindActorByEntry(Sel->firstIObject()->getEntry(), res, true); + if ( res ) { + parent->menuBar()->setItemChecked(9010, !parent->menuBar()->isItemChecked(9010) ); + + // It's necessary to display SMDS IDs instead of VTK ones, so + // vtkIdFilter is unacceptable here. We have to do it manually :( + vtkUnstructuredGrid* ptGrid = vtkUnstructuredGrid::New(); + ptGrid->CopyStructure(MeshActor->DataSource); + + int numPts = MeshActor->DataSource->GetNumberOfPoints(); + + // Loop over points and generate ids + vtkIntArray *ptIds = vtkIntArray::New(); + ptIds->SetNumberOfValues(numPts); + + for (int id=0; id < numPts; id++) { + int idSMDS = MeshActor->GetIdSMESHDSNode(id); + ptIds->SetValue(id, idSMDS); + } + + vtkScalars* newScalars = vtkScalars::New(); + newScalars->SetData(ptIds); + ptGrid->GetPointData()->SetScalars(newScalars); + + newScalars->Delete(); + ptIds->Delete(); + + vtkMaskPoints* mask = vtkMaskPoints::New(); + mask->SetInput(ptGrid); + mask->SetOnRatio( 1 ); + // mask->SetMaximumNumberOfPoints( 50 ); + // mask->RandomModeOn(); + + vtkSelectVisiblePoints* visPts = vtkSelectVisiblePoints::New(); + visPts->SetInput(mask->GetOutput()); + visPts->SetRenderer(((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()); + //visPts->SetSelectInvisible(1); + visPts->SelectInvisibleOff(); + visPts->SetTolerance(0.1); + + vtkLabeledDataMapper* ldm = vtkLabeledDataMapper::New(); + ldm->SetInput(visPts->GetOutput()); + ldm->SetLabelFormat("%g"); + ldm->SetLabelModeToLabelScalars(); + //ldm->SetLabelModeToLabelFieldData(); + + ldm->SetFontFamilyToTimes(); + ldm->SetFontSize(6 * parent->font().pointSize() / 5); + ldm->SetBold(1); + ldm->SetItalic(0); + ldm->SetShadow(0); + + vtkActor2D* pointLabels = vtkActor2D::New(); + pointLabels->SetMapper(ldm); + pointLabels->GetProperty()->SetColor(0,1,0); + + visPts->Delete(); + ldm->Delete(); + smeshGUI->mySimulationActors2D->AddItem( pointLabels ); + ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->AddActor2D( pointLabels ); + } + } + } else { + QApplication::setOverrideCursor( Qt::waitCursor ); + parent->menuBar()->setItemChecked(9010, !parent->menuBar()->isItemChecked(9010) ); + smeshGUI->EraseSimulationActors(); + smeshGUI->ScalarVisibilityOff(); + } + QApplication::restoreOverrideCursor(); + break; + } + case 9011: + { + if ( !parent->menuBar()->isItemChecked(9011) ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + parent->menuBar()->setItemChecked(9010, false ); + + smeshGUI->EraseSimulationActors(); + smeshGUI->mySimulationActors2D = vtkActor2DCollection::New(); + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Standard_Boolean res; + SMESH_Actor* MeshActor = smeshGUI->FindActorByEntry(Sel->firstIObject()->getEntry(), res, true); + if ( res ) { + parent->menuBar()->setItemChecked(9011, !parent->menuBar()->isItemChecked(9011) ); + + // It's necessary to display SMDS IDs instead of VTK ones, so + // vtkIdFilter is unacceptable here. We have to do it manually :( + vtkUnstructuredGrid* elGrid = vtkUnstructuredGrid::New(); + elGrid->CopyStructure(MeshActor->DataSource); + + int numCells = MeshActor->DataSource->GetNumberOfCells(); + + // Loop over points and generate ids + vtkIntArray *cellIds = vtkIntArray::New(); + cellIds->SetNumberOfValues(numCells); + + for (int id=0; id < numCells; id++) { + int idSMDS = MeshActor->GetIdSMESHDSElement(id); + cellIds->SetValue(id, idSMDS); + } + + vtkScalars* newScalars = vtkScalars::New(); + newScalars->SetData(cellIds); + elGrid->GetCellData()->SetScalars(newScalars); + + newScalars->Delete(); + cellIds->Delete(); + + vtkCellCenters* cc = vtkCellCenters::New(); + cc->SetInput(elGrid); + + vtkSelectVisiblePoints* visCells = vtkSelectVisiblePoints::New(); + visCells->SetInput(cc->GetOutput()); + visCells->SetRenderer(((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()); + visCells->SelectInvisibleOff(); + visCells->SetTolerance(0.1); + // visCells->SetSelectInvisible(1); + + vtkLabeledDataMapper* ldm = vtkLabeledDataMapper::New(); + ldm->SetInput(visCells->GetOutput()); + ldm->SetLabelFormat("%g"); + ldm->SetLabelModeToLabelScalars(); + + ldm->SetFontFamilyToTimes(); + ldm->SetFontSize(6 * parent->font().pointSize() / 5); + ldm->SetBold(1); + ldm->SetItalic(0); + ldm->SetShadow(0); + + vtkActor2D* cellLabels = vtkActor2D::New(); + cellLabels->SetMapper(ldm); + cellLabels->GetProperty()->SetColor(1,0,0); + + cc->Delete(); + visCells->Delete(); + ldm->Delete(); + smeshGUI->mySimulationActors2D->AddItem( cellLabels ); + ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->AddActor2D( cellLabels ); + } + } + } else { + QApplication::setOverrideCursor( Qt::waitCursor ); + parent->menuBar()->setItemChecked(9011, !parent->menuBar()->isItemChecked(9011) ); + smeshGUI->EraseSimulationActors(); + smeshGUI->ScalarVisibilityOff(); + } + QApplication::restoreOverrideCursor(); + break; + } + + case 10001: // DISPLAY MODE PREFERENCE + { + parent->menuBar()->setItemChecked(10001, !parent->menuBar()->isItemChecked(10001) ); + parent->menuBar()->setItemChecked(10002, false ); + parent->menuBar()->setItemChecked(10003, false ); + QAD_CONFIG->addSetting("SMESH:DisplayMode", "Wireframe"); + break; + } + case 10002: + { + parent->menuBar()->setItemChecked(10002, !parent->menuBar()->isItemChecked(10002) ); + parent->menuBar()->setItemChecked(10001, false ); + parent->menuBar()->setItemChecked(10003, false ); + QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading"); + break; + } + case 10003: + { + parent->menuBar()->setItemChecked(10003, !parent->menuBar()->isItemChecked(10003) ); + parent->menuBar()->setItemChecked(10002, false ); + parent->menuBar()->setItemChecked(10001, false ); + QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shrink"); + break; + } + + } + + smeshGUI->myActiveStudy->updateObjBrowser(true); + return true ; +} + + +//============================================================================= +/*! function : GetMeshesUsingAlgoOrHypothesis() + * purpose : return a list of Study objects (mesh kind) that have 'AlgoOrHyp' affected. + * : However is supposed here that father of father of an hypothesis is a Mesh Object. + */ +//============================================================================= +SALOMEDS::Study::ListOfSObject* SMESHGUI::GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) +{ + SALOMEDS::Study::ListOfSObject_var listSOmesh = new SALOMEDS::Study::ListOfSObject ; + listSOmesh->length(0) ; + unsigned int index = 0 ; + if( !AlgoOrHyp->_is_nil() ) { + SALOMEDS::SObject_var SO_Hypothesis = smeshGUI->GetStudyAPI().FindHypothesisOrAlgorithms( AlgoOrHyp ); + if( !SO_Hypothesis->_is_nil() ) { + SALOMEDS::Study::ListOfSObject_var listSO = smeshGUI->myStudy->FindDependances(SO_Hypothesis) ; + for( unsigned int i=0; ilength(); i++ ) { + SALOMEDS::SObject_var SO = listSO[i] ; + if( !SO->_is_nil() ) { + SALOMEDS::SObject_var SOfatherFather = SO->GetFather()->GetFather() ; + if( !SOfatherFather->_is_nil() ) { + index++ ; + listSOmesh->length(index) ; + listSOmesh[index-1] = SOfatherFather ; + } + } + } + } + } + return listSOmesh._retn() ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Import_Mesh(QAD_Desktop* parent, int theCommandID) +{ + QString filter; + string myExtension; + Mesh_Reader* myReader; + + if (theCommandID==113) { + filter = tr("MED files (*.med)"); + myExtension = string("MED"); + myReader = new DriverMED_R_SMESHDS_Mesh; + } + else if (theCommandID==112) { + filter = tr("IDEAS files (*.unv)"); + myExtension = string("UNV"); + } + else if (theCommandID==111) { + filter = tr("DAT files (*.dat)"); + myExtension = string("MED"); + myReader = new DriverDAT_R_SMESHDS_Mesh; + } + + QString filename = QAD_FileDlg::getFileName(parent, + "", + filter, + tr("Import mesh"), + true); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + string myClass = string("SMESHDS_Mesh"); +// Mesh_Reader* myReader = SMESHDriver::GetMeshReader(myExtension, myClass); + + int myMeshId = (smeshGUI->myDocument)->NewMesh(); + Handle(SMDS_Mesh) myMesh = (smeshGUI->myDocument)->GetMesh(myMeshId); + + myReader->SetFile(string(filename.latin1())); + myReader->SetMesh(myMesh); + myReader->SetMeshId(myMeshId); + myReader->Read(); + + QApplication::restoreOverrideCursor(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Export_Mesh(QAD_Desktop* parent, int theCommandID) +{ + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount() ; + if ( nbSel == 1 ) { + Standard_Boolean res; + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + SMESH::SMESH_Mesh_var aMesh = smeshGUI->ConvertIOinMesh( IObject, res ); + if ( res ) { + if (theCommandID==122) { // EXPORT MED + QString filename = QAD_FileDlg::getFileName(parent, + "", + tr("MED files (*.med)"), + tr("Export mesh"), + false); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + aMesh->ExportMED( filename.latin1() ); + QApplication::restoreOverrideCursor(); + } + } + else if (theCommandID==121) { // EXPORT DAT + QString filename = QAD_FileDlg::getFileName(parent, + "", + tr("DAT files (*.dat)"), + tr("Export mesh"), + false); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + aMesh->ExportDAT( filename.latin1() ); + QApplication::restoreOverrideCursor(); + } + } + else if (theCommandID==123) { // EXPORT UNV + QString filename = QAD_FileDlg::getFileName(parent, + "", + tr("IDEAS files (*.unv)"), + tr("Export mesh"), + false); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + aMesh->ExportUNV( filename.latin1() ); + QApplication::restoreOverrideCursor(); + } + else + aMesh->ExportDAT( filename.latin1() ); + + QApplication::restoreOverrideCursor(); + + if ( IObject->hasEntry() ) + { + MESSAGE("---"); + SALOMEDS::SObject_var SO = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeComment_var aFileName; + SALOMEDS::StudyBuilder_var aStudyBuilder = smeshGUI->myStudy->NewBuilder(); + anAttr = aStudyBuilder->FindOrCreateAttribute(SO, "AttributeComment"); + aFileName = SALOMEDS::AttributeComment::_narrow(anAttr); + aFileName->SetValue(filename.latin1()); + } + } + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Import_Document(QAD_Desktop* parent, int theCommandID) +{ + QString filter; + string myExtension; + Document_Reader* myReader; + + if (theCommandID==113) { + filter = tr("MED files (*.med)"); + myExtension = string("MED"); + myReader = new DriverMED_R_SMESHDS_Document; + } + else if (theCommandID==112) { + filter = tr("IDEAS files (*.unv)"); + myExtension = string("UNV"); + myReader = new DriverUNV_R_SMESHDS_Document; + } + else if (theCommandID==111) { + filter = tr("DAT files (*.dat)"); + myExtension = string("DAT"); + myReader = new DriverDAT_R_SMESHDS_Document; + } + + QString filename = QAD_FileDlg::getFileName(parent, + "", + filter, + tr("Import document"), + true); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + string myClass = string("SMESHDS_Document"); +// Document_Reader* myReader = SMESHDriver::GetDocumentReader(myExtension, myClass); + Handle(SMESHDS_Document) newDocument = new SMESHDS_Document(1); + + myReader->SetFile(string(filename.latin1())); + myReader->SetDocument(smeshGUI->myDocument); + myReader->Read(); + QApplication::restoreOverrideCursor(); + } +} + +void SMESHGUI::Export_Document(QAD_Desktop* parent, int theCommandID) +{ + QString filter; + Document_Writer* myWriter; + string myExtension; + + if (theCommandID==122) { + filter = tr("MED files (*.med)"); + myExtension = string("MED"); + myWriter = new DriverMED_W_SMESHDS_Document; + } + else if (theCommandID==121) { + filter = tr("DAT files (*.dat)"); + myExtension = string("DAT"); + myWriter = new DriverDAT_W_SMESHDS_Document; + } else if (theCommandID==123) { + filter = tr("IDEAS files (*.unv)"); + myExtension = string("UNV"); + myWriter = new DriverUNV_W_SMESHDS_Document; + } + + QString filename = QAD_FileDlg::getFileName(parent, + "", + filter, + tr("Export document"), + false); + if ( !filename.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + string myClass = string("SMESHDS_Document"); + //Document_Writer* myWriter = SMESHDriver::GetDocumentWriter(myExtension, myClass); + + myWriter->SetFile(string(filename.latin1())); + myWriter->SetDocument(smeshGUI->myDocument); + + //StudyContextStruct* myStudyContext = _impl.GetStudyContext(myStudyId); + //Handle(SMESHDS_Document) myDocument = myStudyContext->myDocument; + //myWriter->SetDocument(myDocument); + + myWriter->Write(); + QApplication::restoreOverrideCursor(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + SMESHGUI::GetOrCreateSMESHGUI(parent); + return false ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + SMESHGUI::GetOrCreateSMESHGUI(parent); + + return true; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + SMESHGUI::GetOrCreateSMESHGUI(parent); + + return true ; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::SetSettings( QAD_Desktop* parent ) +{ + SMESHGUI::GetOrCreateSMESHGUI(parent); + + /* Display mode */ + QString DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode"); + if ( DisplayMode.compare("") == 0 ) { + DisplayMode = "Shading"; + QAD_CONFIG->addSetting("SMESH:DisplayMode","Shading"); + } + + if ( DisplayMode.compare("Wireframe") == 0 ){ + parent->menuBar()->setItemChecked(10003, false ); + parent->menuBar()->setItemChecked(10002, false ); + parent->menuBar()->setItemChecked(10001, true ); + } else if ( DisplayMode.compare("Shading") == 0 ){ + parent->menuBar()->setItemChecked(10003, false ); + parent->menuBar()->setItemChecked(10002, true ); + parent->menuBar()->setItemChecked(10001, false ); + } else if ( DisplayMode.compare("Shrink") == 0 ) { + parent->menuBar()->setItemChecked(10003, true ); + parent->menuBar()->setItemChecked(10002, false ); + parent->menuBar()->setItemChecked(10001, false ); + } + + /* Automatic Update */ + QString AutoUpdate = QAD_CONFIG->getSetting("SMESH:AutomaticUpdate"); + if ( AutoUpdate.compare("true") == 0 ) { + parent->menuBar()->setItemChecked(1001, true ); + smeshGUI->myAutomaticUpdate = true; + } else { + parent->menuBar()->setItemChecked(1001, false ); + smeshGUI->myAutomaticUpdate = false; + } + + /* menus disable */ + parent->menuBar()->setItemEnabled( 11, false); // IMPORT + + return true; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject ) +{ + /* Create or retrieve an object SMESHGUI */ + SMESHGUI::GetOrCreateSMESHGUI(QAD_Application::getDesktop()); + + // NRI : Temporary added + // if ( smeshGUI->myStudy->GetProperties()->IsLocked() ) { + // theObject = "NothingSelected"; + // theContext = "NothingSelected"; + // } + // NRI + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + if (nbSel == 0) { + if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + vtkScalarBarActor* aScalarBar = smeshGUI->GetScalarBar(); + if ((aScalarBar != NULL) && (aScalarBar->GetVisibility() == 1) ) { + theObject = "ScalarBar"; + theContext = ""; + } else { + theObject = "NothingSelected"; + theContext = "NothingSelected"; + } + } else { + theObject = "NothingSelected"; + theContext = "NothingSelected"; + } + } else if (nbSel == 1 ) { + theObject = smeshGUI->CheckTypeObject( Sel->firstIObject() ); + theContext = ""; + } else { + theObject = smeshGUI->CheckHomogeneousSelection(); + theContext = ""; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::CustomPopup( QAD_Desktop* parent, + QPopupMenu* popup, + const QString& theContext, + const QString& theParent, + const QString& theObject ) +{ + // Popup should be customized for any viewer since some meaningless commands may be present in the popup + //if (smeshGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) //Test du type de viewer true=OCC false=VTK + // return false; + /* Create or retrieve an object SMESHGUI */ + SMESHGUI::GetOrCreateSMESHGUI(parent); + + // NRI : Temporary added + // if ( smeshGUI->myStudy->GetProperties()->IsLocked() ) { + // return false; + // } + // NRI + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + QAD_StudyFrame* studyFrame = smeshGUI->myActiveStudy->getActiveStudyFrame(); + int nbSel = Sel->IObjectCount(); + + if (nbSel == 0) { + if (studyFrame->getTypeView() != VIEW_VTK) + popup->clear(); + return false; + } else if (nbSel == 1 ) { + QString parentComp = ((SALOMEGUI_Desktop*)parent)->getComponentFromSelection(); + // First check type of active viewer (VTK required) + if (/*studyFrame->getTypeView() != VIEW_VTK ||*/ parentComp != parent->getActiveComponent()) + { + //MESSAGE("CustomPopup(): VTK viewer required, removing all SMESH-specific popup menu items") + while (1) { + int id = popup->idAt(0); + if (id <= QAD_TopLabel_Popup_ID) + popup->removeItemAt(0); + else + break; + } + if (theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + } + return false; + } + + // Remove common popup items for Submesh, Hypothesis and Algorithm + if (theObject.compare("SubMesh") == 0 || + theObject.compare("Hypothesis") == 0 || + theObject.compare("Algorithm") == 0 ) { + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + int id = popup->idAt(popup->count()-1); // last item + if (id < 0 && id != -1) popup->removeItem(id); // separator + } + + if (theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + return true; + } + + int id = QAD_TopLabel_Popup_ID;//popup->idAt(0); + QFont f = QApplication::font(); + f.setBold( TRUE ); + + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + + if ( theParent.compare("Viewer")==0 ) { + if (popup->idAt(0) == id) { + popup->removeItem(id); + popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), id, 0 ); + } + + Standard_Boolean res; + SMESH_Actor* ac = smeshGUI->FindActorByEntry( IObject->getEntry(), res, false ); + if ( res && studyFrame->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter= + ((VTKViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getRWInteractor(); + if ( myRenderInter->isVisible( IObject ) ) { + popup->removeItem(QAD_Display_Popup_ID); + } else { + popup->removeItem(QAD_Erase_Popup_ID); + } + } else { + popup->removeItem(QAD_Erase_Popup_ID); + if (!res) {// mesh not computed -> can't display it + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItemAt(popup->count() - 1);//separator + } + } + } else if ( theParent.compare("ObjectBrowser")==0 ) { + if (theObject.compare("Mesh") == 0 || + theObject.compare("SubMesh") == 0 || + theObject.compare("Hypothesis") == 0 || + theObject.compare("Algorithm") == 0 ) { + popup->removeItemAt(0); + } else { + if (popup->idAt(0) == id) { + popup->removeItem(id); + popup->removeItemAt(0);//separator + } + } + + Standard_Boolean res; + SMESH_Actor* ac = smeshGUI->FindActorByEntry( IObject->getEntry(), res, false ); + if ( res && studyFrame->getTypeView() == VIEW_VTK ) { + VTKViewer_RenderWindowInteractor* myRenderInter= + ((VTKViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getRWInteractor(); + if ( myRenderInter->isVisible( IObject ) ) { + popup->removeItem(QAD_Display_Popup_ID); + } else { + popup->removeItem(QAD_Erase_Popup_ID); + } + } else { + if (theObject.compare("Mesh") == 0 || + theObject.compare("SubMesh") == 0 || + theObject.compare("Hypothesis") == 0 || + theObject.compare("Algorithm") == 0 ) { + } else { + popup->removeItem(QAD_Erase_Popup_ID); + if (!res) {// mesh not computed -> can't display it + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItemAt(popup->count() - 1);//separator + } + } + } + } + } else { + QString parentComp = ((SALOMEGUI_Desktop*)parent)->getComponentFromSelection(); + QAD_StudyFrame* studyFrame = smeshGUI->myActiveStudy->getActiveStudyFrame(); + if (/*studyFrame->getTypeView() != VIEW_VTK ||*/ parentComp != parent->getActiveComponent()) + { + //MESSAGE("CustomPopup(): VTK viewer required, removing all SMESH-specific popup menu items") + while (1) { + int id = popup->idAt(0); + if (id <= QAD_TopLabel_Popup_ID && id != -1) + popup->removeItemAt(0); + else + break; + } + if (parentComp.isNull()) { // objects from several components are selected + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + int id = popup->idAt(popup->count()-1); // last item + if (id < 0 && id != -1) popup->removeItem(id); // separator + } + return false; + } + + QString type = smeshGUI->CheckHomogeneousSelection(); + if ( type.compare("Heterogeneous Selection") != 0 ) { + int id = QAD_TopLabel_Popup_ID;//popup->idAt(0); + QFont f = QApplication::font(); + f.setBold( TRUE ); + popup->removeItem(id); + popup->insertItem( new CustomItem ( QString("%1 ").arg(nbSel) + type + " (s) ", f), id, 0 ); + } + } + return false; +} + +//============================================================================= +/*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) + * Purpose: ensures that the actor for the given exists in the active VTK view + */ +//============================================================================= +void SMESHGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) +{ + /* Create or retrieve an object SMESHGUI */ + SMESHGUI::GetOrCreateSMESHGUI(QAD_Application::getDesktop()); + + QAD_StudyFrame* activeFrame = smeshGUI->myActiveStudy->getActiveStudyFrame(); + if (activeFrame->getTypeView() == VIEW_VTK) { + // VTK + SALOMEDS::SObject_var fatherSF = + smeshGUI->myStudy->FindObjectID(activeFrame->entry()); + + SALOME_Selection* Sel = SALOME_Selection::Selection( smeshGUI->myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + +// for(;It.More();It.Next()) { +// Handle(SALOME_InteractiveObject) IObject = It.Value(); + Handle(SALOME_InteractiveObject) IObject = theIO; + if ( IObject->hasEntry() ) { + // Look for the actor in all views + Standard_Boolean res; + SMESH_Actor *ac = smeshGUI->FindActorByEntry(IObject->getEntry(), res, false); + + // Actor not found at all -> mesh is not computed -> do nothing!!! + if ( !res ) { + /*SMESH::SMESH_Mesh_var aM; + SALOMEDS::SObject_var aMorSM = smeshGUI->myStudy->FindObjectID( IObject->getEntry() ); + SALOMEDS::SObject_var father = aMorSM->GetFather(); + SALOMEDS::SObject_var fatherComp = aMorSM->GetFatherComponent(); + + // Non-displayable objects (Hypo, Algo) have tags < 3 or have a father different from component + if (aMorSM->Tag() < 3 || strcmp(father->GetID(), fatherComp->GetID()) != 0) + continue; + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( !aMorSM->_is_nil() ) { + if (aMorSM->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aM = SMESH::SMESH_Mesh::_narrow( _orb->string_to_object(anIOR->Value()) ); + } + } + + if (!aM->_is_nil()) { + smeshGUI->InitActor(aM); + ac = smeshGUI->ReadScript(aM); + } + + if (ac) { + smeshGUI->DisplayActor( ac, true ); + smeshGUI->DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + }*/ +// continue; + } else { // The actor exists in some view + // Check whether the actor belongs to the active view + VTKViewer_RenderWindowInteractor* rwInter = + ((VTKViewer_ViewFrame*)activeFrame->getRightFrame()->getViewFrame())->getRWInteractor(); + + // The actor belongs to inactive view -> create a copy and display it in the active view + if (!rwInter->isInViewer(IObject)) { + SMESH_Actor* acCopy = SMESH_Actor::New(); + acCopy->ShallowCopy(ac); + ac = acCopy; + } + smeshGUI->DisplayActor( ac, false ); + smeshGUI->DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + } + } +// } + } else { + MESSAGE("BuildPresentation() must not be called while non-VTK view is active") + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::setOrb() +{ + try { + ORB_INIT &init = *SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init( 0 , 0 ); + } catch (...) { + INFOS("internal error : orb not found"); + _orb = 0; + } + ASSERT(! CORBA::is_nil(_orb)); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH_Actor* SMESHGUI::ReadScript(SMESH::SMESH_Mesh_ptr aMesh) +{ + SMESH_Actor* MeshActor; + if ( !aMesh->_is_nil() ) { + Standard_Boolean result; + MeshActor = FindActor(aMesh, result, true); + if ( result ) { + SMESH::log_array_var aSeq = aMesh->GetLog(true); + + if (aSeq->length() == 0) { + MESSAGE("ReadScript(): log is empty") + return MeshActor; + } + + for (unsigned int ind = 0; ind < aSeq->length();ind++) { + switch ( aSeq[ind].commandType ) + { + case SMESH::ADD_NODE : + { + AddNodes( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::ADD_EDGE : + { + // AddEdges( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::ADD_TRIANGLE : + { + AddTriangles( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::ADD_QUADRANGLE : + { + AddQuadrangles( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::ADD_TETRAHEDRON : + { + AddTetras( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::ADD_PYRAMID : + { + break; + } + case SMESH::ADD_PRISM : + { + break; + } + case SMESH::ADD_HEXAHEDRON : + { + AddHexaedres( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::REMOVE_NODE : + { + RemoveNodes( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + case SMESH::REMOVE_ELEMENT : + { + RemoveElements( MeshActor, aSeq[ind].number, aSeq[ind].coords, aSeq[ind].indexes ); + break; + } + } + } + return MeshActor; + } + } + return NULL; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Dump(SMESH_Actor* Mactor) +{ + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + vtkPoints *Pts = ugrid->GetPoints(); + int nbPts = Pts->GetNumberOfPoints(); + int nbCells = ugrid->GetNumberOfCells(); + + FILE *In; + int i,j; + In = fopen("/tmp/dumpMesh","w+"); + fprintf(In,"%d %d\n",nbPts,nbCells); + for ( int i = 0; i < nbPts; i++ ) { + float *p = ugrid->GetPoint(i); + fprintf(In,"%d %e %e %e\n",i, p[0], p[1], p[2] ); + } + + for ( int i = 0; i < nbCells; i++ ) { + fprintf(In,"%d %d",i,ugrid->GetCell(i)->GetCellType()); + vtkIdList *Id = ugrid->GetCell(i)->GetPointIds(); + for (j=0; jGetNumberOfIds(); j++) { + fprintf(In," %d",Id->GetId(j)); + } + fprintf(In,"\n"); + } + fclose(In); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddNodes( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, + const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + if ( Mactor->GetMapper() == NULL ) { + vtkPoints *Pts = vtkPoints::New(); + SMESH_Grid *ugrid = SMESH_Grid::New(); + ugrid->Allocate(); + + int i = 1; + int j = 1; + while ( i <= number ) { + int idVTK = Pts->InsertNextPoint( coords[j-1], coords[j], coords[j+1] ); + //Mactor->AddNode( indexes[i-1], idVTK ); + ugrid->AddNode( indexes[i-1], idVTK ); + i++; + j = j + 3; + } + //vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New(); + ugrid->SetPoints(Pts); + vtkDataSetMapper * PtsMapper = vtkDataSetMapper::New(); + PtsMapper->SetInput( ugrid ); + Mactor->DataSource = PtsMapper->GetInput(); + Mactor->SetMapper(PtsMapper); + } else { + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + int idVTK = ugrid->GetPoints()->InsertNextPoint( coords[j-1], coords[j], coords[j+1] ); + ugrid->AddNode( indexes[i-1], idVTK ); + i++; + j = j + 3; + } + vtkDataSetMapper *PtsMapper = vtkDataSetMapper::New(); + PtsMapper->SetInput( ugrid ); + Mactor->DataSource = PtsMapper->GetInput(); + Mactor->SetMapper(PtsMapper); + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddNode(SMESH_Actor* Mactor, int idnode, float x, float y, float z) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + MESSAGE ( "SMESHGUI::AddNode " << idnode << " : " << x << ";" << y << ";" << z ) + if ( Mactor->GetMapper() == NULL ) { + vtkPoints *Pts = vtkPoints::New(); + int idVTK = Pts->InsertNextPoint( x, y, z ); + //Mactor->AddNode( idnode, idVTK ); + //vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New(); + SMESH_Grid *ugrid = SMESH_Grid::New(); + ugrid->Allocate(); + ugrid->AddNode( idnode, idVTK ); + ugrid->SetPoints(Pts); + vtkDataSetMapper * PtsMapper = vtkDataSetMapper::New(); + PtsMapper->SetInput( ugrid ); + Mactor->DataSource = PtsMapper->GetInput(); + Mactor->SetMapper(PtsMapper); + } else { + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid *ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int idVTK = ugrid->GetPoints()->InsertNextPoint( x, y, z ); + //Mactor->AddNode( idnode, idVTK ); + ugrid->AddNode( idnode, idVTK ); + vtkDataSetMapper *PtsMapper = vtkDataSetMapper::New(); + PtsMapper->SetInput( ugrid ); + Mactor->DataSource = PtsMapper->GetInput(); + Mactor->SetMapper(PtsMapper); + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveNode(SMESH_Actor* Mactor, int idnode) +{ + MESSAGE ( " OLD RemoveNode method " ) +// int id = Mactor->GetIdVTKNode( idnode ); +// MESSAGE ( " RemoveNode id VTK " << id ) +// if ( Mactor->GetMapper() != NULL ) { +// vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); +// vtkUnstructuredGrid* newUgrid = vtkUnstructuredGrid::New(); +// vtkPoints *Pts = ugrid->GetPoints(); +// vtkPoints *newPts = vtkPoints::New(); +// int nbPts = Pts->GetNumberOfPoints(); +// bool findPt = false; +// for ( int i = 0; i < nbPts; i++ ) { +// if ( id != i ) { +// if ( !findPt) +// newPts->InsertPoint(i, Pts->GetPoint(i) ); +// else +// newPts->InsertPoint(i-1, Pts->GetPoint(i) ); +// } else { +// findPt = true; +// Mactor->RemoveNode( idnode ); +// } +// } + +// newUgrid->SetPoints(newPts); +// int nbCells = ugrid->GetNumberOfCells(); +// for ( int i = 0; i < nbCells; i++ ) { +// vtkIdList *Ids = ugrid->GetCell(i)->GetPointIds(); +// vtkIdList *newIds = vtkIdList::New(); +// int nbIds = Ids->GetNumberOfIds(); +// newIds->SetNumberOfIds(nbIds); +// for ( int j = 0; j < nbIds; j++ ) { +// int theid = Ids->GetId(j); +// if ( theid > id ) { +// newIds->SetId( j, theid-1 ); +// } else +// newIds->SetId( j, theid ); +// } +// int idSMDSel = Mactor->GetIdSMESHDSElement( i ); +// Mactor->RemoveElement( idSMDSel, false ); +// int idVTKel = newUgrid->InsertNextCell( ugrid->GetCell(i)->GetCellType(), newIds ); +// Mactor->AddElement( idSMDSel, idVTKel ); +// } + + +// vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); +// Mapper->SetInput( newUgrid ); +// Mactor->DataSource = Mapper->GetInput(); +// Mactor->SetMapper(Mapper); + +// UpdateView(); +// } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveNodes(SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + int i = 1; + while ( i <= number ) { + Mactor->RemoveNode( indexes[i-1] ); + i++; + } + + TColStd_DataMapOfIntegerInteger newMapVTKNodes; + TColStd_DataMapOfIntegerInteger newMapSMESHDSNodes; + TColStd_DataMapOfIntegerInteger MapOldNodesToNewNodes; + + if ( Mactor->GetMapper() != NULL ) { + SMESH_Grid *ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid *newUgrid = SMESH_Grid::New(); + newUgrid->CopyMaps(ugrid); + + vtkPoints *Pts = ugrid->GetPoints(); + vtkPoints *newPts = vtkPoints::New(); + int nbPts = Pts->GetNumberOfPoints(); + int j = 0; + for ( int i = 0; i < nbPts; i++ ) { + int idSMESHDSNode = Mactor->GetIdSMESHDSNode(i); + if ( idSMESHDSNode != -1 ) { + newPts->InsertPoint(j, Pts->GetPoint(i) ); + + newMapVTKNodes.Bind(j, idSMESHDSNode); + newMapSMESHDSNodes.Bind(idSMESHDSNode, j); + + MapOldNodesToNewNodes.Bind(i,j); + j++; + } + } + + newUgrid->SetIdsVTKNode(newMapVTKNodes); + newUgrid->SetIdsSMESHDSNode(newMapSMESHDSNodes); + newUgrid->SetPoints(newPts); + + TColStd_DataMapOfIntegerInteger newMapElementSMDStoVTK; + TColStd_DataMapOfIntegerInteger newMapElementVTKtoSMDS; + + int nbCells = ugrid->GetNumberOfCells(); + for ( int i = 0; i < nbCells; i++ ) { + vtkIdList *Ids = ugrid->GetCell(i)->GetPointIds(); + vtkIdList *newIds = vtkIdList::New(); + int nbIds = Ids->GetNumberOfIds(); + newIds->SetNumberOfIds(nbIds); + bool isGood = true; + for ( int j = 0; j < nbIds; j++ ) { + int theid = Ids->GetId(j); + if ( MapOldNodesToNewNodes.IsBound( theid ) ) { + newIds->SetId( j, MapOldNodesToNewNodes.Find( theid ) ); + } else { + isGood = false; + break; + } + } + + // Filtering out cells based on non-existing nodes + if (isGood) { + int idSMDSel = Mactor->GetIdSMESHDSElement( i ); + int idVTKel = newUgrid->InsertNextCell( ugrid->GetCell(i)->GetCellType(), newIds ); + + newMapElementSMDStoVTK.Bind(idSMDSel, idVTKel); + newMapElementVTKtoSMDS.Bind(idVTKel, idSMDSel); + } + } + + newUgrid->SetIdsVTKElement(newMapElementVTKtoSMDS); + newUgrid->SetIdsSMESHDSElement(newMapElementSMDStoVTK); + + // Copy new data to the old DatSource: keep the single DataSource for all actors + ugrid->DeepCopy(newUgrid); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( ugrid ); + Mactor->SetMapper(Mapper); + + // Commented to avoid multiple viewer updates when called by ReadScript() + //UpdateView(); + + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveNodes(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length(MapIndex.Extent()); + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int i = 0; + for ( ; ite.More(); ite.Next() ) { + // MESSAGE ( " RemoveNode : id " << ac->GetIdSMESHDSNode(ite.Key()) ) + anArrayOfIdeces[i] = ac->GetIdSMESHDSNode(ite.Key()); + i++; + } + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->RemoveNodes(anArrayOfIdeces); + + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); + } + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveElement(SMESH_Actor* Mactor, int idelement) +{ + MESSAGE ( " OLD RemoveElement method " ) +// int id = Mactor->GetIdVTKElement( idelement ); +// MESSAGE ( " RemoveElement id VTK : " << id ) +// if ( Mactor->GetMapper() != NULL ) { +// vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); +// vtkUnstructuredGrid* newUgrid = vtkUnstructuredGrid::New(); + +// int nbCells = ugrid->GetNumberOfCells(); +// for ( int i = 0; i < nbCells; i++ ) { +// if ( id != i ) { +// newUgrid->InsertNextCell( ugrid->GetCell(i)->GetCellType(), +// ugrid->GetCell(i)->GetPointIds() ); +// } else +// Mactor->RemoveElement( idelement ); +// } +// newUgrid->SetPoints(ugrid->GetPoints()); + +// vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); +// Mapper->SetInput( newUgrid ); +// Mactor->DataSource = Mapper->GetInput(); +// Mactor->SetMapper(Mapper); + +// UpdateView(); +// } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveElements(SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + int i = 1; + while ( i <= number ) { + Mactor->RemoveElement( indexes[i-1] ); + i++; + } + TColStd_DataMapOfIntegerInteger newMapElementSMDStoVTK; + TColStd_DataMapOfIntegerInteger newMapElementVTKtoSMDS; + + if ( Mactor->GetMapper() != NULL ) { + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* newUgrid = SMESH_Grid::New(); + newUgrid->CopyMaps(ugrid); + + int nbCells = ugrid->GetNumberOfCells(); + for ( int i = 0; i < nbCells; i++ ) { + int idSMESHDSElement = Mactor->GetIdSMESHDSElement(i); + if ( idSMESHDSElement != -1 ) { + int newId = newUgrid->InsertNextCell( ugrid->GetCell(i)->GetCellType(), + ugrid->GetCell(i)->GetPointIds() ); + newMapElementSMDStoVTK.Bind(idSMESHDSElement, newId); + newMapElementVTKtoSMDS.Bind(newId, idSMESHDSElement); + } + } + + newUgrid->SetIdsVTKElement(newMapElementVTKtoSMDS); + newUgrid->SetIdsSMESHDSElement(newMapElementSMDStoVTK); + + newUgrid->SetPoints(ugrid->GetPoints()); + + // Copy new data to the old DatSource: keep the single DataSource for all actors + ugrid->DeepCopy(newUgrid); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( ugrid ); + Mactor->SetMapper(Mapper); + + // Commented to avoid multiple viewer updates when called by ReadScript() + //UpdateView(); + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::RemoveElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length(MapIndex.Extent()); + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int i = 0; + for ( ; ite.More(); ite.Next() ) { + // MESSAGE ( " RemoveElement : id " << ite.Key() << "," << ac->GetIdSMESHDSElement(ite.Key()) ) + anArrayOfIdeces[i] = ac->GetIdSMESHDSElement(ite.Key()); + i++; + } + + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->RemoveElements(anArrayOfIdeces); + } + + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); +#ifdef TRACE + Dump( Mesh ); +#endif + } + } + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::OrientationElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + //vtkUnstructuredGrid* UGrid = vtkUnstructuredGrid::New(); + SMESH_Grid* UGrid = SMESH_Grid::New(); + SMESH_Grid* oldGrid = SMESH_Grid::SafeDownCast(ac->DataSource); + UGrid->CopyMaps(oldGrid); + + vtkGeometryFilter *gf = vtkGeometryFilter::New(); + gf->SetInput( ac->DataSource ); + + vtkPolyDataMapper *Mapper = vtkPolyDataMapper::New(); + Mapper->SetInput( gf->GetOutput() ); + Mapper->Update(); + + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + for ( ; ite.More(); ite.Next() ) { + Mapper->GetInput()->ReverseCell( ite.Key() ); + } + + UGrid->SetPoints( Mapper->GetInput()->GetPoints() ); + int nbCells = Mapper->GetInput()->GetNumberOfCells(); + for ( int i = 0; i < nbCells; i++ ) { + UGrid->InsertNextCell( Mapper->GetInput()->GetCellType(i), Mapper->GetInput()->GetCell(i)->GetPointIds() ); + } + + // Copy new data to the old DatSource: keep the single DataSource for all actors + oldGrid->DeepCopy(UGrid); + + vtkDataSetMapper *NewMapper = vtkDataSetMapper::New(); + //NewMapper->SetInput( UGrid ); + NewMapper->SetInput( oldGrid ); + NewMapper->Update(); + + //ac->DataSource = NewMapper->GetInput(); + ac->SetMapper( NewMapper ); + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + QApplication::setOverrideCursor( Qt::waitCursor ); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + //vtkUnstructuredGrid* UGrid = vtkUnstructuredGrid::New(); + SMESH_Grid* UGrid = SMESH_Grid::New(); + vtkGeometryFilter *gf = vtkGeometryFilter::New(); + gf->SetInput( ac->DataSource ); + + vtkExtractEdges *edges = vtkExtractEdges::New(); + edges->SetInput( ac->DataSource ); + + vtkPolyDataMapper *Mapper = vtkPolyDataMapper::New(); + Mapper->SetInput( edges->GetOutput() ); + Mapper->Update(); + + int nb = Mapper->GetInput()->GetNumberOfCells(); + //MESSAGE ( "nb : " << nb ) + + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + for ( ; ite.More(); ite.Next() ) { + vtkCell* StartEdge = Mapper->GetInput()->GetCell(ite.Key()); + //MESSAGE( "DCQ : Edge Id = " << ite.Key()) + int CellType = StartEdge->GetCellType(); + //MESSAGE( "DCQ : Cell Type = " << CellType) + int nbPoints = StartEdge->GetNumberOfPoints(); + + //MESSAGE( "DCQ : Nb Point = " << nbPoints) + if ( nbPoints == 2 ) { + vtkUnstructuredGrid* StartUGrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + + vtkIdList *IdCells = vtkIdList::New(); + vtkIdList *IdPoints = StartEdge->GetPointIds(); + float p1[3]; + float p2[3]; + + Mapper->GetInput()->GetPoints()->GetPoint(IdPoints->GetId(0),p1); + Mapper->GetInput()->GetPoints()->GetPoint(IdPoints->GetId(1),p2); + + int idp1 = StartUGrid->FindPoint(p1); + int idp2 = StartUGrid->FindPoint(p2); + + StartUGrid->GetPointCells( idp1, IdCells ); + + //MESSAGE ( " pt 0 : " << IdPoints->GetId(0) ) + //MESSAGE ( " pt 1 : " << IdPoints->GetId(1) ) + + //MESSAGE ( " pt 0 : " << idp1 ) + //MESSAGE ( " pt 1 : " << idp2 ) + + vtkIdList *IdPts = vtkIdList::New(); + if (IdCells->GetNumberOfIds() >= 2) { + int nbCells = IdCells->GetNumberOfIds(); + //MESSAGE ( " nbCells : " << nbCells ) + for (int j=0; jGetCellPoints( IdCells->GetId(j), IdPts ); + if ( IdPts->IsId( idp2 ) == -1 ) { + IdCells->DeleteId( IdCells->GetId(j) ); + } + } + + + //MESSAGE ( " IdCells " << IdCells->GetNumberOfIds() ) + + vtkIdList *IdPts0 = vtkIdList::New(); + vtkIdList *IdPts1 = vtkIdList::New(); + + if (IdCells->GetNumberOfIds() == 2) { + StartUGrid->GetCellPoints( IdCells->GetId(0), IdPts0 ); + StartUGrid->GetCellPoints( IdCells->GetId(1), IdPts1 ); + + //Create new faces + TColStd_MapOfInteger EndMapIndex; + for (int j = 0; j < 3; j++ ) { + if ( IdPts0->GetId(j) != idp1 && IdPts0->GetId(j) != idp2 ) { + EndMapIndex.Add( IdPts0->GetId(j) ); + } + if ( IdPts1->GetId(j) != idp1 && IdPts1->GetId(j) != idp2 ) { + EndMapIndex.Add( IdPts1->GetId(j) ); + } + } + + bool MyAU = myAutomaticUpdate ; + myAutomaticUpdate = false ; + + EndMapIndex.Add( idp1 ); + TColStd_MapIteratorOfMapOfInteger ite1( EndMapIndex ); + int i = 1; + while ( ite1.More() ) { + if ( ite1.Key() == idp1 ) + break; + i++; + ite1.Next(); + } + bool reverse1 = ( i == 2 ); + this->AddFace( aMesh, EndMapIndex, reverse1 ); + + EndMapIndex.Remove( idp1 ); + EndMapIndex.Add( idp2 ); + TColStd_MapIteratorOfMapOfInteger ite2( EndMapIndex ); + i = 1; + while ( ite2.More() ) { + if ( ite2.Key() == idp2 ) + break; + i++; + ite2.Next(); + } + bool reverse2 = ( i == 2 ); + this->AddFace( aMesh, EndMapIndex, !(reverse1 == reverse2) ); + + myAutomaticUpdate = MyAU ; + //MESSAGE ( " myAutomaticUpdate = " << MyAU ) + Mapper->Update(); + //Remove old faces + TColStd_MapOfInteger StartMapIndex; + StartMapIndex.Add( IdCells->GetId(0) ); + StartMapIndex.Add( IdCells->GetId(1) ); + this->RemoveElements( aMesh, StartMapIndex ); + + Mapper->Update(); + } + } + } + } + + // UGrid->SetPoints( Mapper->GetInput()->GetPoints() ); + // int nbCells = Mapper->GetInput()->GetNumberOfCells(); + // for ( int i = 0; i < nbCells; i++ ) { + // UGrid->InsertNextCell( Mapper->GetInput()->GetCellType(i), Mapper->GetInput()->GetCell(i)->GetPointIds() ); + // } + + // vtkDataSetMapper *NewMapper = vtkDataSetMapper::New(); + // NewMapper->SetInput( UGrid ); + // NewMapper->Update(); + + // ac->DataSource = NewMapper->GetInput(); + // ac->SetMapper( NewMapper ); + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddEdges( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+1] ) ); + int id = ugrid->InsertNextCell(VTK_LINE, Ids); + Mactor->AddElement( indexes[j-1], id ); + i++; + j = j + 3; + } + vtkDataSetMapper *EdgeMapper = vtkDataSetMapper::New(); + EdgeMapper->SetInput( ugrid ); + Mactor->DataSource = EdgeMapper->GetInput(); + Mactor->SetMapper(EdgeMapper); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddEdge(SMESH_Actor* Mactor, int idedge, int idnode1, int idnode2) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + MESSAGE ( "SMESHGUI::AddEdge " << idedge << " : " << idnode1 << ";" << idnode2 ) + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode1 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode2 ) ); + + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int id = ugrid->InsertNextCell(VTK_LINE, Ids); + Mactor->AddElement( idedge, id ); + + MESSAGE ( " Edge VTK id " << id ) + + vtkDataSetMapper *EdgeMapper = vtkDataSetMapper::New(); + EdgeMapper->SetInput( ugrid ); + Mactor->DataSource = EdgeMapper->GetInput(); + Mactor->SetMapper(EdgeMapper); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddTriangles( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+1] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+2] ) ); + int id = ugrid->InsertNextCell(VTK_TRIANGLE, Ids); + Mactor->AddElement( indexes[j-1], id ); + i++; + j = j + 4; + } + vtkDataSetMapper *TriMapper = vtkDataSetMapper::New(); + TriMapper->SetInput( ugrid ); + Mactor->DataSource = TriMapper->GetInput(); + Mactor->SetMapper(TriMapper); + QApplication::restoreOverrideCursor(); +} +void SMESHGUI::AddTriangle(SMESH_Actor* Mactor, int idtri, int idnode1, int idnode2, int idnode3) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode1 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode2 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode3 ) ); + + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int id = ugrid->InsertNextCell(VTK_TRIANGLE, Ids); + Mactor->AddElement( idtri, id ); + + vtkDataSetMapper *TriMapper = vtkDataSetMapper::New(); + TriMapper->SetInput( ugrid ); + Mactor->DataSource = TriMapper->GetInput(); + Mactor->SetMapper(TriMapper); + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddQuadrangles( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+1] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+2] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+3] ) ); + int id = ugrid->InsertNextCell(VTK_QUAD, Ids); + Mactor->AddElement( indexes[j-1], id ); + i++; + j = j + 5; + } + vtkDataSetMapper *QuadMapper = vtkDataSetMapper::New(); + QuadMapper->SetInput( ugrid ); + Mactor->DataSource = QuadMapper->GetInput(); + Mactor->SetMapper(QuadMapper); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddQuadrangle(SMESH_Actor* Mactor, int idquad, int idnode1, int idnode2, + int idnode3, int idnode4) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode1 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode2 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode3 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode4 ) ); + + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int id = ugrid->InsertNextCell(VTK_QUAD, Ids); + Mactor->AddElement( idquad, id ); + + vtkDataSetMapper *QuadMapper = vtkDataSetMapper::New(); + QuadMapper->SetInput( ugrid ); + Mactor->DataSource = QuadMapper->GetInput(); + Mactor->SetMapper(QuadMapper); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddTetras( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+1] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+2] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+3] ) ); + int id = ugrid->InsertNextCell(VTK_TETRA, Ids); + Mactor->AddElement( indexes[j-1], id ); + i++; + j = j + 5; + } + vtkDataSetMapper *TetraMapper = vtkDataSetMapper::New(); + TetraMapper->SetInput( ugrid ); + Mactor->DataSource = TetraMapper->GetInput(); + Mactor->SetMapper(TetraMapper); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddTetra(SMESH_Actor* Mactor, int idtetra, int idnode1, int idnode2, + int idnode3, int idnode4) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + MESSAGE ( "SMESHGUI::AddTetra " << idtetra << " : " << idnode1 << ";" << idnode2 + << ";" << idnode3 << ";" << idnode4 ) + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode1 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode2 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode3 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode4 ) ); + + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int id = ugrid->InsertNextCell(VTK_TETRA, Ids); + Mactor->AddElement( idtetra, id ); + + MESSAGE ( " Tetra VTK id " << id ) + + vtkDataSetMapper *TetraMapper = vtkDataSetMapper::New(); + TetraMapper->SetInput( ugrid ); + Mactor->DataSource = TetraMapper->GetInput(); + Mactor->SetMapper(TetraMapper); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddHexaedres( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + //vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int i = 1; + int j = 1; + while ( i <= number ) { + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+1] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+2] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+3] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+4] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+5] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+6] ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( indexes[j+7] ) ); + int id = ugrid->InsertNextCell(VTK_HEXAHEDRON, Ids); + Mactor->AddElement( indexes[j-1], id ); + i++; + j = j + 9; + } + vtkDataSetMapper *HexaMapper = vtkDataSetMapper::New(); + HexaMapper->SetInput( ugrid ); + Mactor->DataSource = HexaMapper->GetInput(); + Mactor->SetMapper(HexaMapper); + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddHexaedre(SMESH_Actor* Mactor, int idhexa, int idnode1, int idnode2, + int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + MESSAGE ( "SMESHGUI::AddHexaedre " << idhexa << " : " << idnode1 << ";" << idnode2 + << ";" << idnode3 << ";" << idnode4 << ";" << idnode5 << ";" << idnode6 + << ";" << idnode7 << ";" << idnode8) + + vtkIdList *Ids = vtkIdList::New(); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode1 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode2 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode3 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode4 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode5 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode6 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode7 ) ); + Ids->InsertNextId( Mactor->GetIdVTKNode( idnode8 ) ); + + //vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + SMESH_Grid* ugrid = SMESH_Grid::SafeDownCast( Mactor->DataSource ); + int id = ugrid->InsertNextCell(VTK_HEXAHEDRON, Ids); + Mactor->AddElement( idhexa, id ); + + MESSAGE ( " Hexa VTK id " << id ) + + vtkDataSetMapper *HexaMapper = vtkDataSetMapper::New(); + HexaMapper->SetInput( ugrid ); + Mactor->DataSource = HexaMapper->GetInput(); + Mactor->SetMapper(HexaMapper); + QApplication::restoreOverrideCursor(); +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + { + return SMESHGUI::OnGUIEvent(theCommandID, parent); + } + + bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + { + return SMESHGUI::OnKeyPress (pe, parent, studyFrame); + } + + bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + { + return SMESHGUI::OnMousePress (pe, parent, studyFrame); + } + + bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + { + return SMESHGUI::OnMouseMove (pe, parent, studyFrame); + } + + bool SetSettings ( QAD_Desktop* parent ) + { + return SMESHGUI::SetSettings( parent ); + } + + bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject ) + { + return SMESHGUI::CustomPopup( parent, popup, theContext, theParent, theObject ); + } + + void definePopup ( QString & theContext, QString & theParent, QString & theObject ) + { + SMESHGUI::DefinePopup( theContext, theParent, theObject ); + } + + bool activeStudyChanged ( QAD_Desktop* parent ) + { + SMESHGUI::activeStudyChanged( parent ); + } + + void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) + { + SMESHGUI::BuildPresentation(theIO); + } + + void supportedViewType(int* buffer, int bufferSize) + { + if (!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_VTK; + } + +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::ViewNodes() +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = theRenderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if ( ac->IsA("SMESH_Actor") ) { + SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( ac ); + if ( anActor->GetVisibility() == 1 ) { + vtkGeometryFilter *gf = vtkGeometryFilter::New(); + gf->SetInput( anActor->DataSource ); + vtkMaskPoints *verts = vtkMaskPoints::New(); + verts->SetInput(gf->GetOutput()); + verts->GenerateVerticesOn(); + verts->SetOnRatio(1); + + vtkPolyDataMapper *vertMapper = vtkPolyDataMapper::New(); + vertMapper->SetInput(verts->GetOutput()); + vertMapper->ScalarVisibilityOff(); + + vtkActor *vertActor = vtkActor::New(); + vertActor->SetMapper(vertMapper); + + float r, g , b ; + anActor->GetNodeColor(r, g, b ) ; + vertActor->GetProperty()->SetColor( r, g, b ) ; + + vertActor->GetProperty()->SetPointSize( anActor->GetNodeSize() ); + + vertActor->PickableOff(); + + mySimulationActors->AddItem( vertActor ); + theRenderer->AddActor( vertActor ); + } + } + ac = theActors->GetNextActor(); + } + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Control(int theCommandID) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + QApplication::setOverrideCursor( Qt::waitCursor ); + DisplayScalarBar( false ); + + vtkScalars *scalars = vtkScalars::New(); + vtkDataSetMapper* meshMapper = 0; + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + Standard_Boolean result; + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + SMESH_Actor* MeshActor = FindActorByEntry(IObject->getEntry(), result, true); + + // Mesh may be not updated after Compute + if (!MeshActor->DataSource || !MeshActor->GetMapper()) { + QApplication::restoreOverrideCursor(); + return; + } + + bool ValidateScalars = false; + if ( result ) { + QString type; + switch (theCommandID) + { + case 6001: //Length Edges + { + type = tr( "SMESH_CONTROL_LENGTH_EDGES"); + meshMapper = (vtkDataSetMapper*)MeshActor->EdgeDevice->GetMapper(); + vtkUnstructuredGrid* grid = (vtkUnstructuredGrid*)meshMapper->GetInput(); + MESSAGE ( " init minimum length " << grid->GetNumberOfCells() ) + for (int i=0; iGetNumberOfCells(); i++ ) { + vtkCell* cell = grid->GetCell(i); + float len = SMESHGUI_ComputeScalarValue::LengthEdges(cell); + if (len == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,len); + } + } + if (ValidateScalars && (MeshActor->getDisplayMode()!=0)) + ChangeRepresentation( MeshActor, 1 );// limitation; in Wireframe, colored edges are not visible + break; + } + case 6011: // Area Elements + { + type = tr( "SMESH_CONTROL_AREA_ELEMENTS"); + for (int i=0; i< MeshActor->GetMapper()->GetInput()->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->GetMapper()->GetInput()->GetCell(i); + float area = SMESHGUI_ComputeScalarValue::AreaElements(cell); + if (area == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,area); + } + } + if (ValidateScalars && (MeshActor->getDisplayMode()!=1)) + ChangeRepresentation( MeshActor, 1 ); + break; + } + case 6012: // Taper + { + type = tr( "SMESH_CONTROL_TAPER_ELEMENTS"); + for (int i=0; i< MeshActor->DataSource->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->DataSource->GetCell(i); + float taper = SMESHGUI_ComputeScalarValue::Taper(cell); + if (taper == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,taper); + } + } + break; + } + case 6013: // Aspect ratio + { + type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS"); + for (int i=0; iDataSource->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->DataSource->GetCell(i); + float aspect = SMESHGUI_ComputeScalarValue::AspectRatio(cell); + if (aspect == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,aspect); + } + } + if (ValidateScalars && (MeshActor->getDisplayMode()!=1)) + ChangeRepresentation( MeshActor, 1 ); + break; + } + case 6014: // Minimum angle + { + type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS"); + for (int i=0; iDataSource->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->DataSource->GetCell(i); + float angle = SMESHGUI_ComputeScalarValue::MinimumAngle(cell); + if (angle == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,angle); + } + } + if (ValidateScalars && (MeshActor->getDisplayMode()!=1)) + ChangeRepresentation( MeshActor, 1 ); + break; + } + case 6015: // Warp + { + type = tr( "SMESH_CONTROL_WARP_ELEMENTS"); + for (int i=0; iDataSource->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->DataSource->GetCell(i); + float Warp = SMESHGUI_ComputeScalarValue::Warp(cell); + if (Warp == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,Warp); + } + } + break; + } + case 6016: // Skew + { + type = tr( "SMESH_CONTROL_SKEW_ELEMENTS"); + for (int i=0; iDataSource->GetNumberOfCells(); i++ ) { + vtkCell* cell = MeshActor->DataSource->GetCell(i); + float angle = SMESHGUI_ComputeScalarValue::Skew(cell); + if (angle == 0) continue; + else { + ValidateScalars = true; + scalars->InsertScalar(i,angle); + } + } + break; + } + } + + if ( !ValidateScalars ) { + QApplication::restoreOverrideCursor(); + return; + } + + float range[2]; + scalars->GetRange(range); + + vtkLookupTable* wat = vtkLookupTable::New(); + wat->SetRange( range ); + wat->Build(); + + scalars->SetLookupTable(wat); + + if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper()); + meshMapper->SetScalarModeToUseCellData(); + meshMapper->GetInput()->GetCellData()->SetScalars(scalars); + meshMapper->SetScalarRange( range ); + meshMapper->ScalarVisibilityOn(); + + vtkScalarBarActor* aScalarBar = GetScalarBar(); + if ( aScalarBar == NULL ) { + aScalarBar = vtkScalarBarActor::New(); + QString Bold = QAD_CONFIG->getSetting("ScalarBar:Bold"); + QString Italic = QAD_CONFIG->getSetting("ScalarBar:Italic"); + QString Shadow = QAD_CONFIG->getSetting("ScalarBar:Shadow"); + QString FontFamily = QAD_CONFIG->getSetting("ScalarBar:FontFamily"); + QString Orientation = QAD_CONFIG->getSetting("ScalarBar:Orientation"); + float Width = QAD_CONFIG->getSetting("ScalarBar:Width").toFloat(); + float Height = QAD_CONFIG->getSetting("ScalarBar:Height").toFloat(); + int NumberOfLabels = QAD_CONFIG->getSetting("ScalarBar:NumberOfLabels").toInt(); + int NumberOfColors = QAD_CONFIG->getSetting("ScalarBar:NumberOfColors").toInt(); + + SetSettingsScalarBar(aScalarBar, Bold, Italic, Shadow, FontFamily, Orientation, + Width, Height, NumberOfColors, NumberOfLabels); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + theRenderer->AddActor2D(aScalarBar); + } + aScalarBar->SetLookupTable( wat ); + aScalarBar->SetTitle( type.latin1() ); + + scalars->Delete(); + // wat->Delete(); + DisplayScalarBar( true ); + } + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::SetSettingsScalarBar(vtkScalarBarActor* theScalarBar, + QString Bold, QString Italic, + QString Shadow, QString FontFamily, + QString Orientation, float Width, float Height, + int NbColors, int NbLabels ) +{ + if ( Bold.isNull() || Bold.isEmpty() || (Bold.compare( "true" ) == 0) ) + theScalarBar->BoldOn(); + else + theScalarBar->BoldOff(); + + if ( Italic.isNull() || Italic.isEmpty() || (Italic.compare( "true" ) == 0) ) + theScalarBar->ItalicOn(); + else + theScalarBar->ItalicOff(); + + if ( Shadow.isNull() || Shadow.isEmpty() || (Shadow.compare( "true" ) == 0) ) + theScalarBar->ShadowOn(); + else + theScalarBar->ShadowOff(); + + if ( FontFamily.compare( "Arial" ) == 0 ) + theScalarBar->SetFontFamilyToArial(); + else if ( FontFamily.compare( "Courier" ) == 0 ) + theScalarBar->SetFontFamilyToCourier(); + else if ( FontFamily.compare( "Times" ) == 0 ) + theScalarBar->SetFontFamilyToTimes(); + else + theScalarBar->SetFontFamilyToArial(); + + if ( Orientation.isNull() || Orientation.isEmpty() || (Orientation.compare( "Vertical" ) == 0) ) + theScalarBar->SetOrientationToVertical(); + else + theScalarBar->SetOrientationToHorizontal(); + + + theScalarBar->SetWidth((Width == 0)? 0.17 : Width); + theScalarBar->SetHeight((Height == 0)? 0.8 : Height); + + theScalarBar->SetNumberOfLabels((NbLabels == 0)? 5 : NbLabels); + theScalarBar->SetMaximumNumberOfColors((NbColors == 0)? 64 : NbColors); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplayScalarBar(bool visibility) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkScalarBarActor* aScalarBar = GetScalarBar(); + + if ( aScalarBar == NULL ) { + MESSAGE("myScalarBar is NULL"); + return; + } + + if ( visibility ) + aScalarBar->VisibilityOn(); + else { + aScalarBar->VisibilityOff(); + //Turn off mesh coloring (influences on all views) + vtkActorCollection* actorList=theRenderer->GetActors(); + actorList->InitTraversal(); + vtkActor *ac = actorList->GetNextActor(); + while(ac!=NULL) { + if (ac->GetMapper() != NULL) { + ac->GetMapper()->ScalarVisibilityOff(); + } + ac = actorList->GetNextActor(); + } + // Turn off ScalarBar in all views + /*QList aFrames = myActiveStudy->getStudyFrames(); + for ( QAD_StudyFrame* aFrame = aFrames.first(); aFrame; aFrame = aFrames.next() ) { + if (aFrame->getTypeView() == VIEW_VTK) { + vtkRenderer *aRenderer = ((VTKViewer_ViewFrame*) aFrame->getRightFrame()->getViewFrame())->getRenderer(); + vtkActor2DCollection* actor2DList = aRenderer->GetActors2D(); + actor2DList->InitTraversal(); + vtkActor2D* aActor2d = actor2DList->GetNextActor2D(); + while (aActor2d != NULL) { + if (aActor2d->IsA("vtkScalarBarActor")) { + aActor2d->VisibilityOff(); + break; + } + actor2DList->GetNextActor2D(); + } + } + }*/ + } + myActiveStudy->update3dViewers(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::UpdateScalarBar(float MinRange, float MaxRange) +{ + vtkScalarBarActor* aScalarBar = GetScalarBar(); + if ( aScalarBar == NULL ) { + MESSAGE("myScalarBar is NULL"); + return; + } + DisplayScalarBar(false); + + aScalarBar->GetLookupTable()->SetRange(MinRange, MaxRange); + vtkRenderer *aRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* aActorList = aRenderer->GetActors(); + aActorList->InitTraversal(); + vtkActor *aActor = aActorList->GetNextActor(); + while(aActor != NULL) { + if (aActor->IsA("SMESH_Actor")) { + SMESH_Actor* aMeshActor = SMESH_Actor::SafeDownCast(aActor); + vtkDataSetMapper* aMeshMapper = (vtkDataSetMapper*) (aMeshActor->getMapper()); + if ((aMeshMapper != NULL)) { + aMeshMapper->SetScalarRange( MinRange, MaxRange ); + aMeshMapper->ScalarVisibilityOn(); + } + } + aActor = aActorList->GetNextActor(); + } + DisplayScalarBar(true); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::SetDisplaySettings() +{ + EmitSignalDeactivateDialog() ; + SMESHGUI_Preferences_ColorDlg *aDlg = new SMESHGUI_Preferences_ColorDlg( QAD_Application::getDesktop(), "") ; + + QString SCr = QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed"); + QString SCg = QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen"); + QString SCb = QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue"); + QColor color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt()); + aDlg->SetColor(1,color); + + SCr = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed"); + SCg = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen"); + SCb = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue"); + color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt()); + aDlg->SetColor(2,color); + + SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed"); + SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen"); + SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue"); + color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt()); + aDlg->SetColor(3,color); + + QString SBr = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed"); + QString SBg = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen"); + QString SBb = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue"); + color = QColor (SBr.toInt(), SBg.toInt(), SBb.toInt()); + aDlg->SetColor(4,color); + + QString intValue = QAD_CONFIG->getSetting("SMESH:SettingsWidth"); + aDlg->SetIntValue(1,intValue.toInt()); + intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize"); + aDlg->SetIntValue(2,intValue.toInt()); + intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff"); + aDlg->SetIntValue(3,intValue.toInt()); + + if ( aDlg->exec() ) { + QColor colorFill = aDlg->GetColor( 1 ); + QAD_CONFIG->addSetting("SMESH:SettingsFillColorRed", colorFill.red()); + QAD_CONFIG->addSetting("SMESH:SettingsFillColorGreen", colorFill.green()); + QAD_CONFIG->addSetting("SMESH:SettingsFillColorBlue", colorFill.blue()); + + QColor colorOutline = aDlg->GetColor( 2 ); + QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorRed", colorOutline.red()); + QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorGreen", colorOutline.green()); + QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorBlue", colorOutline.blue()); + + QColor colorNode = aDlg->GetColor( 3 ); + QAD_CONFIG->addSetting("SMESH:SettingsNodeColorRed", colorNode.red()); + QAD_CONFIG->addSetting("SMESH:SettingsNodeColorGreen", colorNode.green()); + QAD_CONFIG->addSetting("SMESH:SettingsNodeColorBlue", colorNode.blue()); + + QColor colorBackFace = aDlg->GetColor( 4 ); + QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorRed", colorBackFace.red()); + QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorGreen", colorBackFace.green()); + QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorBlue", colorBackFace.blue()); + + int width = aDlg->GetIntValue( 1 ); + QAD_CONFIG->addSetting("SMESH:SettingsWidth", width); + + int nodes_size = aDlg->GetIntValue( 2 ); + QAD_CONFIG->addSetting("SMESH:SettingsNodesSize", nodes_size); + + int shrink_coeff = aDlg->GetIntValue( 3 ); + QAD_CONFIG->addSetting("SMESH:SettingsShrinkCoeff", shrink_coeff); + } + + delete aDlg; +} + +//======================================================================= +// function : Parameter() +// purpose : return a parameter (double) from a dialog box +// +// aValue : is a double used as a default value displayed +// aLabel : is the title for aValue1 +// aTitle : is the main title +// bottom : maximum value to be entered +// top : minimum value to be entered +// decimals : number of decimals +//======================================================================= +double SMESHGUI::Parameter( Standard_Boolean& res, + const double aValue, + const char* aLabel, + const char* aTitle, + const double bottom, + const double top, + const int decimals ) +{ + SMESHGUI_aParameterDlg* Dialog = + new SMESHGUI_aParameterDlg( QAD_Application::getDesktop(), + aTitle, + aLabel, + bottom, top, decimals, + TRUE ); + Dialog->setValue( aValue ); + double X = 0.0; + res = ( Dialog->exec() == QDialog::Accepted ); + if ( res ) + X = Dialog->getDblValue(); + return X; +} + +//======================================================================= +// function : Parameter() +// purpose : return a parameter (int) from a dialog box +// +// aValue : is a int used as a default value displayed +// aLabel : is the title for aValue1 +// aTitle : is the main title +// bottom : maximum value to be entered +// top : minimum value to be entered +//======================================================================= +int SMESHGUI::Parameter( Standard_Boolean& res, + const int aValue, + const char* aLabel, + const char* aTitle, + const int bottom, + const int top ) +{ + SMESHGUI_aParameterDlg* Dialog = + new SMESHGUI_aParameterDlg( QAD_Application::getDesktop(), + aTitle, + aLabel, + bottom, top, + TRUE ); + Dialog->setValue( aValue ); + int X = 0; + res = ( Dialog->exec() == QDialog::Accepted ); + if ( res ) + X = Dialog->getIntValue(); + return X; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplayEdges(SMESH_Actor* ac, bool visibility) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + if (ac->DataSource == NULL || ac->GetMapper() == NULL) + return; + + vtkGeometryFilter *gf = vtkGeometryFilter::New(); + gf->SetInput(ac->DataSource); + vtkFeatureEdges *edges = vtkFeatureEdges::New(); + edges->SetInput(gf->GetOutput()); + edges->BoundaryEdgesOn(); + edges->ManifoldEdgesOn(); + + vtkPolyDataMapper *edgeMapper = vtkPolyDataMapper::New(); + edgeMapper->SetInput(edges->GetOutput()); + edgeMapper->ScalarVisibilityOff(); + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* actorList=theRenderer->GetActors(); + + int test=actorList->IsItemPresent(ac->EdgeDevice); + if (test==0) { + vtkProperty* prop = vtkProperty::New(); + prop->SetColor( QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue").toFloat()/255. ) ; + prop->SetPointSize(QAD_CONFIG->getSetting("SMESH:SettingsNodesSize").toInt()); + prop->SetLineWidth( QAD_CONFIG->getSetting("SMESH:SettingsWidth").toInt() ); + ac->EdgeDevice->SetProperty(prop); + ac->SetEdgeColor( QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue").toFloat()/255. ); + ac->EdgeDevice->SetMapper(edgeMapper); + + theRenderer->AddActor(ac->EdgeDevice); + } else { + ac->EdgeDevice->SetMapper(edgeMapper); + edgeMapper->Update(); + } + + vtkShrinkFilter *shrink = vtkShrinkFilter::New(); + shrink->SetInput(ac->DataSource); + shrink->SetShrinkFactor(ac->GetShrinkFactor()); + vtkGeometryFilter *Shrinkgf = vtkGeometryFilter::New(); + Shrinkgf->SetInput( shrink->GetOutput() ); + vtkFeatureEdges *ShrinkEdges = vtkFeatureEdges::New(); + ShrinkEdges->SetInput(Shrinkgf->GetOutput()); + ShrinkEdges->BoundaryEdgesOn(); + ShrinkEdges->ManifoldEdgesOn(); + + vtkPolyDataMapper *ShrinkEdgeMapper = vtkPolyDataMapper::New(); + ShrinkEdgeMapper->SetInput(ShrinkEdges->GetOutput()); + ShrinkEdgeMapper->ScalarVisibilityOff(); + + test=actorList->IsItemPresent(ac->EdgeShrinkDevice); + if (test==0) { + vtkProperty* prop = vtkProperty::New(); + prop->SetColor( QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue").toFloat()/255. ) ; + prop->SetPointSize(QAD_CONFIG->getSetting("SMESH:SettingsNodesSize").toInt()); + prop->SetLineWidth( QAD_CONFIG->getSetting("SMESH:SettingsWidth").toInt() ); + ac->EdgeShrinkDevice->SetProperty(prop); + ac->SetEdgeColor( QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen").toFloat()/255., + QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue").toFloat()/255. ); + ac->EdgeShrinkDevice->SetMapper(ShrinkEdgeMapper); + + theRenderer->AddActor(ac->EdgeShrinkDevice); + } else { + ac->EdgeShrinkDevice->SetMapper(ShrinkEdgeMapper); + ShrinkEdgeMapper->Update(); + } + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::InitActor(SMESH::SMESH_Mesh_ptr aMesh) +{ + SALOMEDS::SObject_var aSO_M = myStudyAPI.FindMesh( aMesh ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if ( !aSO_M->_is_nil() ) { + if (aSO_M->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + Standard_Boolean result; + SMESH_Actor* MeshActor = smeshGUI->FindActorByEntry(aSO_M->GetID(), result, true); + if ( !result ) { + SMESH_Actor* amesh = SMESH_Actor::New(); + Handle(SALOME_InteractiveObject) IO = new SALOME_InteractiveObject(aSO_M->GetID(), + "MESH", + aName->Value()); + amesh->setIO( IO ); + amesh->setName( aName->Value() ); + DisplayActor(amesh, false); + } + } + } +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Update() +{ + if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { //VTK + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + int nbSel = Sel->IObjectCount(); + if ( nbSel == 0 ) { + vtkActorCollection* actorList=theRenderer->GetActors(); + actorList->InitTraversal(); + vtkActor *ac = actorList->GetNextActor(); + while(!(ac==NULL)) { + if ( ac->IsA("SMESH_Actor") ) { + SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( ac ); + if ( anActor->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = anActor->getIO(); + Update( IO ); + } + } + ac = actorList->GetNextActor(); + } + } else { + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for ( ; It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IO = It.Value(); + Update( IO ); + } + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); + } + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::Update(const Handle(SALOME_InteractiveObject)& IO) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + if ( IO->hasEntry() ) { + Standard_Boolean res; + SMESH::SMESH_Mesh_var aMesh = ConvertIOinMesh( IO, res ); + if ( res ) { + SMESH_Actor* ac = FindActorByEntry( IO->getEntry(), res, false ); + if ( res ) { + // Check whether the actor belongs to the active view + VTKViewer_RenderWindowInteractor* rwInter = + ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + // The actor belongs to inactive view -> create a copy and display it in the active view + if (!rwInter->isInViewer(IO)) { + SMESH_Actor* acCopy = SMESH_Actor::New(); + acCopy->ShallowCopy(ac); + + smeshGUI->DisplayActor( acCopy, false ); + } + ac = ReadScript( aMesh ); + if ( ac != NULL ) { +#ifdef TRACE + Dump( ac ); +#endif + DisplayActor( ac ); + DisplayEdges( ac ); + smeshGUI->ChangeRepresentation( ac, ac->getDisplayMode() ); + } + } + } + } +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +vtkActor* SMESHGUI::SimulationMoveNode(SMESH_Actor* Mactor, int idnode) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return NULL; + + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( Mactor->DataSource ); + vtkIdList *IdCells = vtkIdList::New(); + ugrid->GetPointCells( idnode, IdCells ); + + vtkPoints *Pts = vtkPoints::New(); + Pts = ugrid->GetPoints(); + + vtkUnstructuredGrid *ugridSimulation = vtkUnstructuredGrid::New(); + ugridSimulation->SetPoints( Pts ); + vtkIdList *IdPts = vtkIdList::New(); + for (int j=0; jGetNumberOfIds(); j++) { + ugrid->GetCellPoints( IdCells->GetId(j), IdPts ); + ugridSimulation->InsertNextCell( ugrid->GetCellType( IdCells->GetId(j) ), IdPts ); + } + + vtkProperty* prop = vtkProperty::New(); + prop->SetColor( 1., 0., 0. ); + prop->SetRepresentationToWireframe(); + + int Edgewidth = (int)Mactor->EdgeDevice->GetProperty()->GetLineWidth(); + if ( Edgewidth == 0 ) + Edgewidth = 1; + prop->SetLineWidth( Edgewidth+1 ); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( ugridSimulation ); + vtkActor* ac = vtkActor::New(); + ac->SetMapper( Mapper ); + ac->SetProperty( prop ); + + ac->GetMapper()->SetResolveCoincidentTopologyToShiftZBuffer(); + ac->GetMapper()->SetResolveCoincidentTopologyZShift(0.02); + + mySimulationActors->AddItem( ac ); + theRenderer->AddActor( ac ); + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); + + return ac; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + + if ( result ) { + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + + vtkPoints *Pts = ugrid->GetPoints(); + vtkPoints *newPts = vtkPoints::New(); + int nbPts = Pts->GetNumberOfPoints(); + for ( int i = 0; i < nbPts; i++ ) { + newPts->InsertPoint(i, Pts->GetPoint(i) ); + } + + newugrid->SetPoints(newPts); + newugrid->GetPoints()->InsertNextPoint( x, y, z ); + + vtkMaskPoints* verts = vtkMaskPoints::New(); + verts->SetInput(newugrid); + verts->SetGenerateVertices(1); + verts->SetOnRatio(1); + + vtkPolyDataMapper* vertMapper = vtkPolyDataMapper::New(); + vertMapper->SetInput( verts->GetOutput() ); + vertMapper->ScalarVisibilityOff(); + + vtkActor* node = vtkActor::New(); + node->SetMapper( vertMapper ); + + QString SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed"); + QString SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen"); + QString SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue"); + QColor nodecolor(SCr.toInt(), SCg.toInt(), SCb.toInt()); + if ( !nodecolor.isValid() ) + nodecolor = QColor(0.,1.,0.); + + node->GetProperty()->SetColor( float(nodecolor.red())/255., + float(nodecolor.green())/255., + float(nodecolor.blue())/255.); + + int intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize").toInt(); + if ( intValue < 1 ) + intValue == 1; + + node->GetProperty()->SetPointSize( intValue ); + + node->VisibilityOn(); + + mySimulationActors->AddItem( node ); + theRenderer->AddActor(node); + } + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationMoveNode( vtkActor* ac, int idnode, float x, float y, float z) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + float *pt = ac->GetMapper()->GetInput()->GetPoint(idnode); + pt[0] = x; pt[1] = y; pt[2] = z; + + ac->GetMapper()->ImmediateModeRenderingOn(); + ac->GetProperty()->SetRepresentationToWireframe(); + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::MoveNode( SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x, float y, float z) +{ + Standard_Boolean result; + + SMESH_Actor* MeshActor = FindActor(aMesh, result, true); + if ( result ) { + } +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::ScalarVisibilityOff() +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* actorList=theRenderer->GetActors(); + + actorList->InitTraversal(); + vtkActor *ac = actorList->GetNextActor(); + while(!(ac==NULL)) { + if ( ac->IsA("SMESH_Actor") ) { + SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( ac ); + if ( anActor->GetVisibility() == 1 ) { + vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (anActor->getMapper()); + meshMapper->ScalarVisibilityOff(); + meshMapper->SetInput( anActor->DataSource ); + ChangeRepresentation( anActor, anActor->getDisplayMode() ); + } + } + ac = actorList->GetNextActor(); + } + + theRenderer->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int idNodes[2]; + int pts[2]; + int i = 0; + vtkIdList *Ids = vtkIdList::New(); + for ( ; ite.More(); ite.Next() ) { + idNodes[i] = ite.Key(); + i++; + } + + Ids->InsertId( 0, idNodes[0] ); + pts[0] = idNodes[0]; + Ids->InsertId( 1, idNodes[1] ); + pts[1] = idNodes[1]; + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + newugrid->SetPoints( ugrid->GetPoints() ) ; + newugrid->InsertNextCell(VTK_LINE, 2, pts); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( newugrid ); + Mapper->Update(); + + vtkActor* edge = vtkActor::New(); + edge->SetMapper( Mapper ); + edge->SetProperty( ac->GetProperty() ); + edge->SetBackfaceProperty( ac->GetBackfaceProperty() ); + edge->VisibilityOn(); + mySimulationActors->AddItem( edge ); + theRenderer->AddActor(edge); + } + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationTriangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int idNodes[3]; + int pts[3]; + int i = 0; + vtkIdList *Ids = vtkIdList::New(); + for ( ; ite.More(); ite.Next() ) { + idNodes[i] = ite.Key(); + i++; + } + + if ( reverse ) { + Ids->InsertId( 0, idNodes[2] ); + pts[0] = idNodes[2]; + Ids->InsertId( 1, idNodes[1] ); + pts[1] = idNodes[1]; + Ids->InsertId( 2, idNodes[0] ); + pts[2] = idNodes[0]; + } else { + Ids->InsertId( 0, idNodes[0] ); + pts[0] = idNodes[0]; + Ids->InsertId( 1, idNodes[1] ); + pts[1] = idNodes[1]; + Ids->InsertId( 2, idNodes[2] ); + pts[2] = idNodes[2]; + } + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + newugrid->SetPoints( ugrid->GetPoints() ) ; + newugrid->InsertNextCell(VTK_TRIANGLE, 3, pts); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( newugrid ); + Mapper->Update(); + + vtkActor* tri = vtkActor::New(); + tri->SetMapper( Mapper ); + tri->SetProperty( ac->GetProperty() ); + tri->SetBackfaceProperty( ac->GetBackfaceProperty() ); + tri->VisibilityOn(); + mySimulationActors->AddItem( tri ); + theRenderer->AddActor(tri); + } + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationQuadrangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int i = 0; + int idNodes[4]; + vtkIdList *Ids = vtkIdList::New(); + for ( ; ite.More(); ite.Next() ) { + idNodes[i] = ite.Key(); + i++; + } + + float *p0 = ugrid->GetPoint(idNodes[0]); + float *p1 = ugrid->GetPoint(idNodes[1]); + float *p2 = ugrid->GetPoint(idNodes[2]); + float *p3 = ugrid->GetPoint(idNodes[3]); + + gp_Pnt P0(p0[0],p0[1],p0[2]); + + gp_Vec V1( P0, gp_Pnt(p1[0],p1[1],p1[2]) ); + gp_Vec V2( P0, gp_Pnt(p2[0],p2[1],p2[2]) ); + gp_Vec V3( P0, gp_Pnt(p3[0],p3[1],p3[2]) ); + + gp_Vec Cross1 = V1 ^ V2; + gp_Vec Cross2 = V2 ^ V3; + + int tmp; + if ( Cross1.Dot(Cross2) < 0 ) { + V1 = gp_Vec(P0, gp_Pnt(p2[0],p2[1],p2[2]) ); + V2 = gp_Vec(P0, gp_Pnt(p1[0],p1[1],p1[2]) ); + Cross1 = V1 ^ V2; + Cross2 = V2 ^ V3; + + if ( Cross1.Dot(Cross2) < 0 ) { + tmp = idNodes[2]; + idNodes[2] = idNodes[3]; + idNodes[3] = tmp; + } else { + tmp = idNodes[1]; + idNodes[1] = idNodes[2]; + idNodes[2] = tmp; + } + } + + if ( reverse ) { + Ids->InsertId( 0, idNodes[3] ); + Ids->InsertId( 1, idNodes[2] ); + Ids->InsertId( 2, idNodes[1] ); + Ids->InsertId( 3, idNodes[0] ); + } else { + Ids->InsertId( 0, idNodes[0] ); + Ids->InsertId( 1, idNodes[1] ); + Ids->InsertId( 2, idNodes[2] ); + Ids->InsertId( 3, idNodes[3] ); + } + + // vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + newugrid->SetPoints( ugrid->GetPoints() ) ; + newugrid->InsertNextCell(VTK_QUAD, Ids); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( newugrid ); + Mapper->Update(); + + vtkActor* quad = vtkActor::New(); + quad->SetMapper( Mapper ); + quad->SetProperty( ac->GetProperty() ); + quad->SetBackfaceProperty( ac->GetBackfaceProperty() ); + quad->VisibilityOn(); + mySimulationActors->AddItem( quad ); + theRenderer->AddActor(quad); + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationTetra( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int i = 0; + int idNodes[4]; + vtkIdList *Ids = vtkIdList::New(); + for ( ; ite.More(); ite.Next() ) { + idNodes[i] = ite.Key(); + i++; + } + + Ids->InsertId( 0, idNodes[0] ); + Ids->InsertId( 1, idNodes[1] ); + Ids->InsertId( 2, idNodes[2] ); + Ids->InsertId( 3, idNodes[3] ); + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + newugrid->SetPoints( ugrid->GetPoints() ) ; + newugrid->InsertNextCell(VTK_TETRA, Ids); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( newugrid ); + Mapper->Update(); + + vtkActor* tetra = vtkActor::New(); + tetra->SetMapper( Mapper ); + tetra->SetProperty( ac->GetProperty() ); + tetra->SetBackfaceProperty( ac->GetBackfaceProperty() ); + tetra->VisibilityOn(); + mySimulationActors->AddItem( tetra ); + theRenderer->AddActor(tetra); + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplaySimulationHexa( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors = vtkActorCollection::New(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + int i = 0; + int idNodes[8]; + vtkIdList *Ids = vtkIdList::New(); + for ( ; ite.More(); ite.Next() ) { + idNodes[i] = ite.Key(); + i++; + } + + Ids->InsertId( 0, idNodes[0] ); + Ids->InsertId( 1, idNodes[1] ); + Ids->InsertId( 2, idNodes[2] ); + Ids->InsertId( 3, idNodes[3] ); + Ids->InsertId( 4, idNodes[4] ); + Ids->InsertId( 5, idNodes[5] ); + Ids->InsertId( 6, idNodes[6] ); + Ids->InsertId( 7, idNodes[7] ); + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + vtkUnstructuredGrid* newugrid = vtkUnstructuredGrid::New(); + newugrid->SetPoints( ugrid->GetPoints() ) ; + newugrid->InsertNextCell(VTK_HEXAHEDRON, Ids); + + vtkDataSetMapper *Mapper = vtkDataSetMapper::New(); + Mapper->SetInput( newugrid ); + Mapper->Update(); + + vtkActor* hexa = vtkActor::New(); + hexa->SetMapper( Mapper ); + hexa->SetProperty( ac->GetProperty() ); + hexa->SetBackfaceProperty( ac->GetBackfaceProperty() ); + hexa->VisibilityOn(); + mySimulationActors->AddItem( hexa ); + theRenderer->AddActor(hexa); + } + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + renWin->Render(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddFace( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length(MapIndex.Extent()); + + int i = 0; + for ( ; ite.More(); ite.Next() ) { + anArrayOfIdeces[i] = ac->GetIdSMESHDSNode(ite.Key()); + i++; + } + + int tmp; + if ( MapIndex.Extent() == 4 ) { + int idNodes[4]; + int i = 0; + TColStd_MapIteratorOfMapOfInteger ite1( MapIndex ); + for ( ; ite1.More(); ite1.Next() ) { + idNodes[i] = ite1.Key(); + i++; + } + + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + float *p0 = ugrid->GetPoint(idNodes[0]); + float *p1 = ugrid->GetPoint(idNodes[1]); + float *p2 = ugrid->GetPoint(idNodes[2]); + float *p3 = ugrid->GetPoint(idNodes[3]); + + gp_Pnt P0(p0[0],p0[1],p0[2]); + + gp_Vec V1( P0, gp_Pnt(p1[0],p1[1],p1[2]) ); + gp_Vec V2( P0, gp_Pnt(p2[0],p2[1],p2[2]) ); + gp_Vec V3( P0, gp_Pnt(p3[0],p3[1],p3[2]) ); + + gp_Vec Cross1 = V1 ^ V2; + gp_Vec Cross2 = V2 ^ V3; + + if ( Cross1.Dot(Cross2) < 0 ) { + + V1 = gp_Vec(P0, gp_Pnt(p2[0],p2[1],p2[2]) ); + V2 = gp_Vec(P0, gp_Pnt(p1[0],p1[1],p1[2]) ); + Cross1 = V1 ^ V2; + Cross2 = V2 ^ V3; + + if ( Cross1.Dot(Cross2) < 0 ) { + tmp = anArrayOfIdeces[2]; + anArrayOfIdeces[2] = anArrayOfIdeces[3]; + anArrayOfIdeces[3] = tmp; + } else { + tmp = anArrayOfIdeces[1]; + anArrayOfIdeces[1] = anArrayOfIdeces[2]; + anArrayOfIdeces[2] = tmp; + } + } + } + + // int tmp; + if ( reverse ) { + for (i=0; i < (MapIndex.Extent()/2); i++) { + tmp = anArrayOfIdeces[i]; + anArrayOfIdeces[i] = anArrayOfIdeces[MapIndex.Extent()-i-1]; + anArrayOfIdeces[MapIndex.Extent()-i-1] = tmp; + } + } + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->AddFace(anArrayOfIdeces); + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); + } + } + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddVolume( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length(MapIndex.Extent()); + + int i = 0; + for ( ; ite.More(); ite.Next() ) { + anArrayOfIdeces[i] = ac->GetIdSMESHDSNode(ite.Key()); + i++; + } + + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->AddVolume(anArrayOfIdeces); + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); + } + } + QApplication::restoreOverrideCursor(); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + TColStd_MapIteratorOfMapOfInteger ite( MapIndex ); + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length(MapIndex.Extent()); + + int i = 0; + for ( ; ite.More(); ite.Next() ) { + anArrayOfIdeces[i] = ac->GetIdSMESHDSNode(ite.Key()); + i++; + } + + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->AddEdge(anArrayOfIdeces); + } + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); + } + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::AddNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z) +{ + QApplication::setOverrideCursor( Qt::waitCursor ); + Standard_Boolean result; + SMESH_Actor* ac = FindActor( aMesh, result, true ); + if ( result ) { + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->AddNode(x,y,z); + + if ( myAutomaticUpdate ) { + SMESH_Actor* Mesh = smeshGUI->ReadScript(aMesh); + if ( Mesh != NULL ) { + smeshGUI->DisplayActor( Mesh ); + smeshGUI->DisplayEdges( Mesh ); + smeshGUI->ChangeRepresentation( Mesh, Mesh->getDisplayMode() ); + AddActorInSelection( Mesh ); + } + } + } + QApplication::restoreOverrideCursor(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESHGUI::DisplayEdgesConnectivityLegendBox(vtkActor *ac) +{ + if (myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) + return; + + EraseSimulationActors(); + mySimulationActors2D = vtkActor2DCollection::New(); + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + + vtkGlyphSource2D *gs2 = vtkGlyphSource2D::New(); + gs2->SetGlyphTypeToTriangle(); + gs2->FilledOff(); + + vtkLegendBoxActor *legend = vtkLegendBoxActor::New(); + legend->GetPositionCoordinate()->SetValue(0.025, 0.025, 0.); + legend->GetPosition2Coordinate()->SetValue(0.3, 0.3, 0.); //relative to Position + + legend->SetNumberOfEntries(4); + legend->SetEntryString( 0, tr( "SMESH_BOUNDARYEDGES" ) ); + legend->SetEntrySymbol( 0, gs2->GetOutput() ); + legend->SetEntryColor(0, ac->GetMapper()->GetLookupTable()->GetColor(0.) ); + legend->SetEntryString( 1, tr( "SMESH_MANIFOLDEDGES" ) ); + legend->SetEntrySymbol( 1, gs2->GetOutput() ); + legend->SetEntryColor(1, ac->GetMapper()->GetLookupTable()->GetColor(0.666667) ); + legend->SetEntryString( 2, tr( "SMESH_NONMANIFOLDEDGES" ) ); + legend->SetEntrySymbol( 2, gs2->GetOutput() ); + legend->SetEntryColor(2, ac->GetMapper()->GetLookupTable()->GetColor(0.222222) ); + legend->SetEntryString( 3, tr( "SMESH_FEATUREEDGES" ) ); + legend->SetEntrySymbol( 3, gs2->GetOutput() ); + legend->SetEntryColor(3, ac->GetMapper()->GetLookupTable()->GetColor(0.444444) ); + legend->SetPadding( 5 ); + // legend->GetProperty()->SetColor(); + + mySimulationActors2D->AddItem( legend ); + theRenderer->AddActor2D( legend ); + + // Update the view + myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); +} + +//=============================================================================== +// function : OnEditDelete() +// purpose : +//=============================================================================== +void SMESHGUI::OnEditDelete() +{ + if ( QAD_MessageBox::warn2 + ( QAD_Application::getDesktop(), + tr ("SMESH_WRN_WARNING"), + tr ("SMESH_REALLY_DELETE"), + tr ("SMESH_BUT_YES"), tr ("SMESH_BUT_NO"), 1, 0, 0 ) != 1 ) + return; + + int nbSf = myActiveStudy->getStudyFramesCount(); + + Standard_Boolean found; + SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + + SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if ( IObject->hasEntry() ) { + SALOMEDS::SObject_var SO = myStudy->FindObjectID( IObject->getEntry() ); + + /* Erase child graphical objects */ + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var CSO= it->Value(); + if (CSO->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + + for ( int i = 0; i < nbSf; i++ ) { + QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); + if ( sf->getTypeView() == VIEW_VTK ) { + vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + SMESH_Actor* ac = smeshGUI->FindActorByEntry( CSO->GetID(), found, false ); + if ( found ) { + Renderer->RemoveActor(ac->EdgeDevice); + Renderer->RemoveActor(ac->EdgeShrinkDevice); + Renderer->RemoveActor(ac); + } + } + } + } + } + + /* Erase main graphical object */ + for ( int i = 0; i < nbSf; i++ ) { + QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); + if ( sf->getTypeView() == VIEW_VTK ) { + vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)smeshGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + SMESH_Actor* ac = smeshGUI->FindActorByEntry( IObject->getEntry(), found, false ); + if (found) { + Renderer->RemoveActor(ac->EdgeDevice); + Renderer->RemoveActor(ac->EdgeShrinkDevice); + } + myRenderInter->Remove( IObject ); + } + } + + /* Erase objects in Study */ + SALOMEDS::SObject_var obj = myStudy->FindObjectID( IObject->getEntry() ); + if ( !obj->_is_nil() ) { + QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); + op->start(); + aStudyBuilder->RemoveObject(obj); + op->finish(); + } + + } /* IObject->hasEntry() */ + } /* more/next */ + + /* Clear any previous selection */ + Sel->ClearIObjects() ; + myActiveStudy->updateObjBrowser(); +} diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h new file mode 100644 index 000000000..29ffb9702 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI.h @@ -0,0 +1,297 @@ +// File : SMESHGUI.h +// Created : Sun May 05 11:45:40 2002 +// Author : Nicolas REJNERI +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef SMESHGUI_HeaderFile +#define SMESHGUI_HeaderFile + +#include "TColStd_MapOfInteger.hxx" + +#include "SMESHDS_Document.hxx" + +// SALOME Includes +#include "QAD_Desktop.h" +#include "SALOME_Selection.h" +#include "SALOME_InteractiveObject.hxx" + +#include "SMESH_Actor.h" + +#include "SMESHGUI_StudyAPI.h" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +// QT Includes +#include + +// VTK Inlcudes +#include + +//================================================================================= +// class : SMESHGUI +// purpose : +//================================================================================= +class SMESHGUI : public QObject +{ + Q_OBJECT + +private : + + QAD_Desktop* myDesktop; + QAD_Study* myActiveStudy; + SMESH::SMESH_Gen_var myComponentMesh; + GEOM::GEOM_Gen_var myComponentGeom; + + QDialog* myActiveDialogBox; + int myNbMesh ; + int myState ; + + vtkActorCollection* mySimulationActors; + vtkActor2DCollection* mySimulationActors2D; + + SMESH_Actor* myCurrentMesh; + + SALOMEDS::Study_var myStudy; + int myStudyId; + + SMESHGUI_StudyAPI myStudyAPI; + + // vtkScalarBarActor* myScalarBar; + + Handle_SMESHDS_Document myDocument;//NBU + + bool myAutomaticUpdate; + +public : + + SMESHGUI(); + ~SMESHGUI(); + + static SMESHGUI* GetOrCreateSMESHGUI( QAD_Desktop* desktop ); + static SMESHGUI* GetSMESHGUI() ; + + QAD_Study* GetActiveStudy() ; + QAD_Desktop* GetDesktop() ; + SALOMEDS::Study_ptr GetStudy(); + SMESHGUI_StudyAPI GetStudyAPI(); + + vtkScalarBarActor* GetScalarBar(); + + QDialog* GetActiveDialogBox() ; + void SetActiveDialogBox(QDialog* aDlg) ; + + void SetState(int aState) ; + void ResetState() ; + bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ; + + + /* Managed by IAPP */ + Standard_EXPORT static bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ; + Standard_EXPORT static bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent, + QAD_StudyFrame* studyFrame ); + Standard_EXPORT static bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent, + QAD_StudyFrame* studyFrame ); + Standard_EXPORT static bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent, + QAD_StudyFrame* studyFrame ); + Standard_EXPORT static void activeStudyChanged ( QAD_Desktop* parent ); + Standard_EXPORT static bool SetSettings ( QAD_Desktop* parent ); + Standard_EXPORT static void DefinePopup( QString & theContext, + QString & theParent, + QString & theObject ); + Standard_EXPORT static bool CustomPopup ( QAD_Desktop* parent, + QPopupMenu* popup, + const QString& theContext, + const QString& theParent, + const QString& theObject ); + Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); + + void OnEditDelete(); + + /* Mesh Management */ + SMESH::SMESH_Mesh_ptr InitMesh( GEOM::GEOM_Shape_ptr aShape, QString NameMesh ); + SMESH::SMESH_subMesh_ptr AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh, GEOM::GEOM_Shape_ptr aShape, QString NameMesh ); + + /* Hypothesis Management */ + SMESH::SMESH_Hypothesis_ptr CreateHypothesis( QString TypeHypothesis, QString NameHypothesis ); + void AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) ; + void AddHypothesisOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) ; + + void RemoveHypothesisOrAlgorithmOnMesh( const Handle(SALOME_InteractiveObject)& IObject ) ; + void RemoveHypothesisOrAlgorithmOnMesh( SALOMEDS::SObject_ptr MorSM, SMESH::SMESH_Hypothesis_ptr anHyp ) ; + + void CreateLocalLength( QString TypeHypothesis, QString NameHypothesis, double Length ); + void CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, double nbSegments ); + void CreateMaxElementArea( QString TypeHypothesis, QString NameHypothesis, double MaxArea ); + void CreateMaxElementVolume( QString TypeHypothesis, QString NameHypothesis, double MaxVolume ); + + /* Algorithms Management */ + void AddAlgorithmOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ); + void AddAlgorithmOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp ); + void CreateAlgorithm( QString TypeAlgo, QString NameAlgo ); + + /* NODES */ + void ViewNodes(); + vtkActor* SimulationMoveNode(SMESH_Actor* Mactor, int idnode); + void MoveNode( SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x, float y, float z); + void AddNode(SMESH_Actor*, int idnode, float x, float y, float z) ; + void AddNodes( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + + void DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z); + void DisplaySimulationMoveNode( vtkActor* ac, int idnode, float x, float y, float z); + + void RemoveNode(SMESH_Actor*, int idnode) ; + void RemoveNodes(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ; + void RemoveNodes(SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + + /* EDGES */ + void AddEdge(SMESH_Actor*, int idedge, int idnode1, int idnode2) ; + void AddEdges( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void DisplayEdges(SMESH_Actor* ac, bool visibility = true); + void DisplayEdgesConnectivityLegendBox(vtkActor *ac); + void DisplaySimulationEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); + + /* TRIANGLES */ + void AddTriangle(SMESH_Actor*, int idtri, int idnode1, int idnode2, int idnode3) ; + void AddTriangles( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void DisplaySimulationTriangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ); + + /* QUADRANGLES */ + void AddQuadrangle(SMESH_Actor*, int idquad, int idnode1, int idnode2, + int idnode3, int idnode4) ; + void AddQuadrangles( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void DisplaySimulationQuadrangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ); + + /* VOLUMES */ + void AddTetra(SMESH_Actor*, int idtetra, int idnode1, int idnode2, + int idnode3, int idnode4) ; + void AddHexaedre(SMESH_Actor*, int idhexa, int idnode1, int idnode2, + int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) ; + void AddTetras( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void AddHexaedres( SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void DisplaySimulationTetra( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); + void DisplaySimulationHexa( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); + + /* ELEMENTS */ + void RemoveElement(SMESH_Actor*, int idnode); + void RemoveElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ; + void RemoveElements(SMESH_Actor* Mactor, int number, + const SMESH::double_array& coords, const SMESH::long_array& indexes); + void OrientationElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex); + void DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex); + + void AddFace( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ); + void AddEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); + void AddVolume( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); + void AddNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z); + + /* Simulation management */ + void EraseSimulationActors() ; + + /* Non modal dialog boxes magement */ + void EmitSignalDeactivateDialog() ; + void EmitSignalCloseAllDialogs() ; + + /* Selection management */ + int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ; + int GetNameOfSelectedNodes( SALOME_Selection* Sel, QString& aName ) ; + int GetNameOfSelectedElements( SALOME_Selection* Sel, QString& aName ) ; + int GetNameOfSelectedEdges( SALOME_Selection* Sel, QString& aName ) ; + + SMESH::SMESH_Hypothesis_ptr ConvertIOinSMESHHypothesis( const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult ) ; + + SMESH::SMESH_Mesh_ptr ConvertIOinMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ; + SMESH::SMESH_subMesh_ptr ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ; + + /* Geometry Client */ + GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, + Standard_Boolean& testResult ) ; + + /* Popup management */ + QString CheckTypeObject(const Handle(SALOME_InteractiveObject)& IO); + QString CheckHomogeneousSelection(); + + /* Scripts management */ + SMESH_Actor* ReadScript(SMESH::SMESH_Mesh_ptr aMesh); + + /* Actors management */ + void Dump(SMESH_Actor* Mactor); + + void SetViewMode(int commandId); + void ChangeRepresentation( SMESH_Actor* ac, int type ); + + SMESH_Actor* FindActor(SMESH::SMESH_Mesh_ptr aMesh, + Standard_Boolean& testResult, + bool onlyInActiveView); + SMESH_Actor* FindActorByEntry(QString entry, + Standard_Boolean& testResult, + bool onlyInActiveView); + + void InitActor(SMESH::SMESH_Mesh_ptr aMesh); + void DisplayActor(SMESH_Actor* ac, bool visibility = true); + void EraseActor(SMESH_Actor* ac); + bool AddActorInSelection(SMESH_Actor* ac); + + void UpdateView(); + + void Update(); + void Update(const Handle(SALOME_InteractiveObject)& IO); + + void ScalarVisibilityOff(); + + + /* Settings management */ + void SetSettingsScalarBar(vtkScalarBarActor* theScalarBar, + QString Bold, QString Italic, QString Shadow, QString Font, + QString Orientation, float Width, float Height, + int NbColors, int NbLabels); + void DisplayScalarBar(bool visibility); + void UpdateScalarBar(float MinRange, float MaxRange); + + void SetDisplaySettings(); + + SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ; + + /* Control management */ + void Control(int theCommandID); + + /* Parameter functions */ + double Parameter( Standard_Boolean& res, const double aValue, + const char* aLabel, const char* aTitle, + const double bottom, const double top, const int decimals ) ; + int Parameter( Standard_Boolean& res, const int aValue, + const char* aLabel, const char* aTitle, + const int bottom, const int top ) ; + + static void setOrb(); + + /* Import/Export */ //NBU + static void Import_Document(QAD_Desktop* parent, int theCommandID); + static void Export_Document(QAD_Desktop* parent, int theCommandID); + static void Import_Mesh(QAD_Desktop* parent, int theCommandID); + static void Export_Mesh(QAD_Desktop* parent, int theCommandID); + +signals: + void SignalDeactivateActiveDialog() ; + void SignalCloseAllDialogs() ; +}; + +#endif diff --git a/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx b/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx new file mode 100644 index 000000000..cc8a93076 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.cxx @@ -0,0 +1,448 @@ +using namespace std; +// File : SMESHGUI_AddAlgorithmDlg.cxx +// Created : Wed May 22 19:05:31 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESHGUI +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_AddAlgorithmDlg.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddAlgorithmDlg() +// purpose : Constructs a SMESHGUI_AddAlgorithmDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_AddAlgorithmDlg::SMESHGUI_AddAlgorithmDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_ADD_ALGORITHM"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_AddAlgorithmDlg" ); + resize( 322, 220 ); + setCaption( tr( "SMESH_ADD_ALGORITHM_TITLE" ) ); + setSizeGripEnabled( TRUE ); + + SMESHGUI_AddAlgorithmDlgLayout = new QGridLayout( this ); + SMESHGUI_AddAlgorithmDlgLayout->setSpacing( 6 ); + SMESHGUI_AddAlgorithmDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_ADD_ALGORITHM" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); + GroupConstructor1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupConstructor1->setColumnLayout(0, Qt::Vertical ); + GroupConstructor1->layout()->setSpacing( 0 ); + GroupConstructor1->layout()->setMargin( 0 ); + GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); + GroupConstructor1Layout->setAlignment( Qt::AlignTop ); + GroupConstructor1Layout->setSpacing( 6 ); + GroupConstructor1Layout->setMargin( 11 ); + LineEditC1A2Mesh = new QLineEdit( GroupConstructor1, "LineEditC1A2Mesh" ); + LineEditC1A2Mesh->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Mesh->sizePolicy().hasHeightForWidth() ) ); + GroupConstructor1Layout->addWidget( LineEditC1A2Mesh, 1, 2 ); + LineEditC1A1Hyp = new QLineEdit( GroupConstructor1, "LineEditC1A1Hyp" ); + LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) ); + GroupConstructor1Layout->addWidget( LineEditC1A1Hyp, 0, 2 ); + SelectButtonC1A1Hyp = new QPushButton( GroupConstructor1, "SelectButtonC1A1Hyp" ); + SelectButtonC1A1Hyp->setText( tr( "" ) ); + SelectButtonC1A1Hyp->setPixmap( image1 ); + GroupConstructor1Layout->addWidget( SelectButtonC1A1Hyp, 0, 1 ); + SelectButtonC1A2Mesh = new QPushButton( GroupConstructor1, "SelectButtonC1A2Mesh" ); + SelectButtonC1A2Mesh->setText( tr( "" ) ); + SelectButtonC1A2Mesh->setPixmap( image1 ); + GroupConstructor1Layout->addWidget( SelectButtonC1A2Mesh, 1, 1 ); + TextLabelC1A2Mesh = new QLabel( GroupConstructor1, "TextLabelC1A2Mesh" ); + TextLabelC1A2Mesh->setText( tr( "SMESH_OBJECT_MESHorSUBMESH" ) ); + TextLabelC1A2Mesh->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A2Mesh->setFrameShape( QLabel::NoFrame ); + TextLabelC1A2Mesh->setFrameShadow( QLabel::Plain ); + GroupConstructor1Layout->addWidget( TextLabelC1A2Mesh, 1, 0 ); + TextLabelC1A1Hyp = new QLabel( GroupConstructor1, "TextLabelC1A1Hyp" ); + TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_ALGORITHM" ) ); + TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain ); + GroupConstructor1Layout->addWidget( TextLabelC1A1Hyp, 0, 0 ); + SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupConstructor1, 1, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_1, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddAlgorithmDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /* Initialisation */ + Init( Sel ) ; +} + + +//================================================================================= +// function : ~SMESHGUI_AddAlgorithmDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddAlgorithmDlg::~SMESHGUI_AddAlgorithmDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ + this->destroy(TRUE, TRUE) ; +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::Init( SALOME_Selection* Sel ) +{ + mySelection = Sel ; + myConstructorId = 0 ; + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + + GroupConstructor1->show(); + myConstructorId = 0 ; + myEditCurrentArgument = LineEditC1A1Hyp ; + Constructor1->setChecked( TRUE ); + myOkMesh = myOkSubMesh = myOkAlgorithm = false ; + + myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM ); + myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH ); + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A2Mesh, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* Displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::ConstructorsClicked(int constructorId) +{ + switch (constructorId) + { + case 0: + { + GroupConstructor1->show(); + myConstructorId = constructorId ; + myEditCurrentArgument = LineEditC1A1Hyp ; + LineEditC1A2Mesh->setText(tr("")) ; + Constructor1->setChecked( TRUE ); + myOkMesh = myOkSubMesh = myOkAlgorithm = false ; + break; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkMesh && myOkAlgorithm ) { + SALOME_ListIteratorOfListIO It( AlgoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddAlgorithmOnMesh(myMesh, myAlgorithm) ; + } + } else if ( myOkSubMesh && myOkAlgorithm ) { + SALOME_ListIteratorOfListIO It( AlgoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, myAlgorithm) ; + } + } + break ; + } + } +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::ClickOnCancel() +{ + mySelection->ClearFilters() ; + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + QString aString = ""; + + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + + if ( myEditCurrentArgument == LineEditC1A2Mesh ) { + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject(); + QString aName = IObject->getName(); + Standard_Boolean testResult; + myOkMesh = true ; + myMesh = mySMESHGUI->ConvertIOinMesh(IObject, testResult) ; + if( !testResult ) { + myOkMesh = false; + myOkSubMesh = true; + mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IObject, testResult) ; + if( !testResult ) { + myOkSubMesh = false; + return ; + } + } + LineEditC1A2Mesh->setText(aString) ; + } + else { + myOkMesh = myOkSubMesh = false ; + return ; + } + } + else if ( myEditCurrentArgument == LineEditC1A1Hyp ) { + if ( nbSel >= 1 ) { + AlgoList.Clear(); // = mySelection->StoredIObjects() ; + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + AlgoList.Append(Itinit.Value()); + } + myOkAlgorithm = true ; + if (nbSel > 1) + aString = tr("%1 Algorithms").arg(nbSel) ; + LineEditC1A1Hyp->setText(aString) ; + } + else { + myOkAlgorithm = false ; + return ; + } + } + + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if( send == SelectButtonC1A1Hyp ) { + LineEditC1A1Hyp->setFocus() ; + myEditCurrentArgument = LineEditC1A1Hyp ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myAlgorithmFilter) ; + } + else if(send == SelectButtonC1A2Mesh) { + LineEditC1A2Mesh->setFocus() ; + myEditCurrentArgument = LineEditC1A2Mesh; + mySelection->ClearFilters() ; + mySelection->AddFilter(myMeshOrSubMeshFilter) ; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::LineEditReturnPressed() +{ + + return ; +} + + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + + GroupConstructors->setEnabled(false) ; + GroupConstructor1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + disconnect( mySelection, 0, this, 0 ); + } + return ; +} + + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; /* same than click on cancel button */ +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::enterEvent( QEvent * ) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; +} + + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddAlgorithmDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate any active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupConstructor1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h b/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h new file mode 100644 index 000000000..f82300f0a --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddAlgorithmDlg.h @@ -0,0 +1,112 @@ +// File : SMESHGUI_AddAlgorithmDlg.h +// Created : Wed May 22 19:05:13 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESHGUI +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ADD_ALGORITHM_H +#define DIALOGBOX_ADD_ALGORITHM_H + +#include "SALOME_Selection.h" +#include "SMESH_TypeFilter.hxx" +#include "SALOME_ListIO.hxx" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) + +// QT Includes +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QFrame; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_AddAlgorithmDlg +// purpose : +//================================================================================= +class SMESHGUI_AddAlgorithmDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddAlgorithmDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddAlgorithmDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESH::SMESH_Gen_var myCompMesh ; + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::SMESH_subMesh_var mySubMesh; + SMESH::SMESH_Hypothesis_var myAlgorithm; + + Handle(SMESH_TypeFilter) myAlgorithmFilter; + Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter; + + bool myOkMesh ; + bool myOkSubMesh ; + bool myOkAlgorithm; + + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SALOME_ListIO AlgoList; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + + QGroupBox* GroupConstructor1; + QLineEdit* LineEditC1A1Hyp; + QLineEdit* LineEditC1A2Mesh; + QPushButton* SelectButtonC1A1Hyp; + QPushButton* SelectButtonC1A2Mesh; + QLabel* TextLabelC1A2Mesh; + QLabel* TextLabelC1A1Hyp; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void LineEditReturnPressed() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_AddAlgorithmDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructor1Layout; +}; + +#endif // DIALOGBOX_ADD_ALGORITHM_H diff --git a/src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx b/src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx new file mode 100644 index 000000000..f2fe8f5c0 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddEdgeDlg.cxx @@ -0,0 +1,370 @@ +using namespace std; +// File : SMESHGUI_AddEdgeDlg.cxx +// Created : Wed Jun 26 21:00:14 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_AddEdgeDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddEdgeDlg() +// purpose : +//================================================================================= +SMESHGUI_AddEdgeDlg::SMESHGUI_AddEdgeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + myNodes = 2; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_LINE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_AddEdgeDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_ADD_EDGE_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_AddEdgeDlgLayout = new QGridLayout( this ); + SMESHGUI_AddEdgeDlgLayout->setSpacing( 6 ); + SMESHGUI_AddEdgeDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_EDGE" ) ); + + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_AddEdgeDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddEdgeDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ADD_EDGE" ) ); + + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + SMESHGUI_AddEdgeDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_AddEdgeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddEdgeDlg::~SMESHGUI_AddEdgeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkNodes = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddEdgeDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkNodes) { + mySMESHGUI->EraseSimulationActors(); + mySMESHGUI->AddEdge( myMesh, myMapIndex ) ; + mySMESHGUI->ViewNodes(); + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_AddEdgeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkNodes = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes < 1) + return ; + + if ( mySelection->SelectionMode() != 1 ) { + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + + if ( myNodes == 2 && nbNodes == 2 ) { + mySMESHGUI->DisplaySimulationEdge(myMesh, myMapIndex); + myOkNodes = true ; + } else { + // mySMESHGUI->EraseSimulationActors(); + myOkNodes = false ; + } + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + mySMESHGUI->EraseSimulationActors() ; + mySMESHGUI->ResetState() ; + mySMESHGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddEdgeDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + diff --git a/src/SMESHGUI/SMESHGUI_AddEdgeDlg.h b/src/SMESHGUI/SMESHGUI_AddEdgeDlg.h new file mode 100644 index 000000000..aa82b6d94 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddEdgeDlg.h @@ -0,0 +1,97 @@ +// File : SMESHGUI_AddEdgeDlg.h +// Created : Wed Jun 26 21:00:41 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ADD_EDGE_H +#define DIALOGBOX_ADD_EDGE_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QCheckBox; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_AddEdgeDlg +// purpose : +//================================================================================= +class SMESHGUI_AddEdgeDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddEdgeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddEdgeDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkNodes ; /* to check when arguments is defined */ + + int myNodes ; + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_AddEdgeDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_ADD_EDGE_H diff --git a/src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx b/src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx new file mode 100644 index 000000000..f870c2765 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddFaceDlg.cxx @@ -0,0 +1,414 @@ +using namespace std; +// File : SMESHGUI_AddFaceDlg.cxx +// Created : Wed Jun 26 21:00:14 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_AddFaceDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddFaceDlg() +// purpose : +//================================================================================= +SMESHGUI_AddFaceDlg::SMESHGUI_AddFaceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + int nbNodes, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + myNodes = nbNodes; + QPixmap image0; + if ( myNodes == 3 ) + image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_TRIANGLE"))); + else if ( myNodes == 4 ) + image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_QUADRANGLE"))); + + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_AddFaceDlg" ); + resize( 303, 185 ); + if ( myNodes == 3 ) + setCaption( tr( "SMESH_ADD_TRIANGLE_TITLE" ) ); + else if ( myNodes == 4 ) + setCaption( tr( "SMESH_ADD_QUADRANGLE_TITLE" ) ); + + setSizeGripEnabled( TRUE ); + SMESHGUI_AddFaceDlgLayout = new QGridLayout( this ); + SMESHGUI_AddFaceDlgLayout->setSpacing( 6 ); + SMESHGUI_AddFaceDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + if ( myNodes == 3 ) + GroupConstructors->setTitle( tr( "SMESH_TRIANGLE" ) ); + else if ( myNodes == 4 ) + GroupConstructors->setTitle( tr( "SMESH_QUADRANGLE" ) ); + + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_AddFaceDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddFaceDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + if ( myNodes == 3 ) + GroupC1->setTitle( tr( "SMESH_ADD_TRIANGLE" ) ); + else if ( myNodes == 4 ) + GroupC1->setTitle( tr( "SMESH_ADD_QUADRANGLE" ) ); + + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + Reverse = new QCheckBox( GroupC1, "Reverse" ); + Reverse->setText( tr( "SMESH_REVERSE" ) ); + GroupC1Layout->addWidget( Reverse, 1, 0 ); + + SMESHGUI_AddFaceDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_AddFaceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddFaceDlg::~SMESHGUI_AddFaceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkNodes = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + connect( Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) ); + + reverse = false; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddFaceDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkNodes) { + mySMESHGUI->EraseSimulationActors(); + mySMESHGUI->AddFace( myMesh, myMapIndex, reverse ) ; + mySMESHGUI->ViewNodes(); + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_AddFaceDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkNodes = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes < 1) + return ; + + if ( mySelection->SelectionMode() != 1 ) { + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex ); + + if ( myNodes == 3 && nbNodes == 3 ) { + mySMESHGUI->DisplaySimulationTriangle(myMesh, myMapIndex, reverse); + myOkNodes = true ; + } else if ( myNodes == 4 && nbNodes == 4 ) { + mySMESHGUI->DisplaySimulationQuadrangle(myMesh, myMapIndex, reverse); + myOkNodes = true ; + } else { + // mySMESHGUI->EraseSimulationActors(); + myOkNodes = false ; + } + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + mySMESHGUI->EraseSimulationActors() ; + mySMESHGUI->ResetState() ; + mySMESHGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddFaceDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + +void SMESHGUI_AddFaceDlg::CheckBox( int state ) +{ + if( Reverse->isOn() ) reverse = true; + else reverse = false; + + if ( myOkNodes == false ) + return; + + if ( state >= 0 ) { + mySMESHGUI->EraseSimulationActors(); + if ( myNodes == 3 ) + mySMESHGUI->DisplaySimulationTriangle( myMesh, myMapIndex, reverse); + else if ( myNodes == 4 ) { + mySMESHGUI->DisplaySimulationQuadrangle( myMesh, myMapIndex, reverse); + } + } +} diff --git a/src/SMESHGUI/SMESHGUI_AddFaceDlg.h b/src/SMESHGUI/SMESHGUI_AddFaceDlg.h new file mode 100644 index 000000000..d99bf7729 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddFaceDlg.h @@ -0,0 +1,102 @@ +// File : SMESHGUI_AddFaceDlg.h +// Created : Wed Jun 26 21:00:41 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ADD_FACE_H +#define DIALOGBOX_ADD_FACE_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QCheckBox; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_AddFaceDlg +// purpose : +//================================================================================= +class SMESHGUI_AddFaceDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddFaceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, + int nbNode = 3, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddFaceDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkNodes ; /* to check when arguments is defined */ + + int myNodes ; + bool reverse ; + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QCheckBox* Reverse; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void CheckBox( int ); + +protected: + QGridLayout* SMESHGUI_AddFaceDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_ADD_FACE_H diff --git a/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx b/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx new file mode 100644 index 000000000..a11d1ad51 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.cxx @@ -0,0 +1,449 @@ +using namespace std; +// File : SMESHGUI_AddHypothesisDlg.cxx +// Created : Wed May 22 19:05:31 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESHGUI +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_AddHypothesisDlg.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddHypothesisDlg() +// purpose : Constructs a SMESHGUI_AddHypothesisDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_AddHypothesisDlg::SMESHGUI_AddHypothesisDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_ADD_HYPOTHESIS"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_AddHypothesisDlg" ); + resize( 322, 220 ); + setCaption( tr( "SMESH_ADD_HYPOTHESIS_TITLE" ) ); + setSizeGripEnabled( TRUE ); + + SMESHGUI_AddHypothesisDlgLayout = new QGridLayout( this ); + SMESHGUI_AddHypothesisDlgLayout->setSpacing( 6 ); + SMESHGUI_AddHypothesisDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_ADD_HYPOTHESIS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); + GroupConstructor1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupConstructor1->setColumnLayout(0, Qt::Vertical ); + GroupConstructor1->layout()->setSpacing( 0 ); + GroupConstructor1->layout()->setMargin( 0 ); + GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); + GroupConstructor1Layout->setAlignment( Qt::AlignTop ); + GroupConstructor1Layout->setSpacing( 6 ); + GroupConstructor1Layout->setMargin( 11 ); + LineEditC1A2Mesh = new QLineEdit( GroupConstructor1, "LineEditC1A2Mesh" ); + LineEditC1A2Mesh->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Mesh->sizePolicy().hasHeightForWidth() ) ); + GroupConstructor1Layout->addWidget( LineEditC1A2Mesh, 1, 2 ); + LineEditC1A1Hyp = new QLineEdit( GroupConstructor1, "LineEditC1A1Hyp" ); + LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) ); + GroupConstructor1Layout->addWidget( LineEditC1A1Hyp, 0, 2 ); + SelectButtonC1A1Hyp = new QPushButton( GroupConstructor1, "SelectButtonC1A1Hyp" ); + SelectButtonC1A1Hyp->setText( tr( "" ) ); + SelectButtonC1A1Hyp->setPixmap( image1 ); + GroupConstructor1Layout->addWidget( SelectButtonC1A1Hyp, 0, 1 ); + SelectButtonC1A2Mesh = new QPushButton( GroupConstructor1, "SelectButtonC1A2Mesh" ); + SelectButtonC1A2Mesh->setText( tr( "" ) ); + SelectButtonC1A2Mesh->setPixmap( image1 ); + GroupConstructor1Layout->addWidget( SelectButtonC1A2Mesh, 1, 1 ); + TextLabelC1A2Mesh = new QLabel( GroupConstructor1, "TextLabelC1A2Mesh" ); + TextLabelC1A2Mesh->setText( tr( "SMESH_OBJECT_MESHorSUBMESH" ) ); + TextLabelC1A2Mesh->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A2Mesh->setFrameShape( QLabel::NoFrame ); + TextLabelC1A2Mesh->setFrameShadow( QLabel::Plain ); + GroupConstructor1Layout->addWidget( TextLabelC1A2Mesh, 1, 0 ); + TextLabelC1A1Hyp = new QLabel( GroupConstructor1, "TextLabelC1A1Hyp" ); + TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) ); + TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain ); + GroupConstructor1Layout->addWidget( TextLabelC1A1Hyp, 0, 0 ); + SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupConstructor1, 1, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_1, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddHypothesisDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /* Initialisation */ + Init( Sel ) ; +} + + +//================================================================================= +// function : ~SMESHGUI_AddHypothesisDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddHypothesisDlg::~SMESHGUI_AddHypothesisDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ + this->destroy(TRUE, TRUE) ; +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::Init( SALOME_Selection* Sel ) +{ + mySelection = Sel ; + myConstructorId = 0 ; + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + + GroupConstructor1->show(); + myConstructorId = 0 ; + myEditCurrentArgument = LineEditC1A1Hyp ; + Constructor1->setChecked( TRUE ); + myOkMesh = myOkSubMesh = myOkHypothesis = false ; + + myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS ); + myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH ); + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A2Mesh, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* Displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddHypothesisDlg::ConstructorsClicked(int constructorId) +{ + switch (constructorId) + { + case 0: + { + GroupConstructor1->show(); + myConstructorId = constructorId ; + myEditCurrentArgument = LineEditC1A1Hyp ; + LineEditC1A2Mesh->setText(tr("")) ; + Constructor1->setChecked( TRUE ); + myOkMesh = myOkSubMesh = myOkHypothesis = false ; + break; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkMesh && myOkHypothesis ) { + SALOME_ListIteratorOfListIO It( HypoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddHypothesisOnMesh(myMesh, myHypothesis) ; + } + } else if( myOkSubMesh && myOkHypothesis ) { + SALOME_ListIteratorOfListIO It( HypoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, myHypothesis) ; + } + } + break ; + } + } +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::ClickOnCancel() +{ + mySelection->ClearFilters() ; + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void SMESHGUI_AddHypothesisDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + QString aString = ""; + + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + + if ( myEditCurrentArgument == LineEditC1A2Mesh ) { + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject(); + QString aName = IObject->getName(); + Standard_Boolean testResult; + myOkMesh = true ; + myMesh = mySMESHGUI->ConvertIOinMesh(IObject, testResult) ; + if( !testResult ) { + myOkMesh = false; + myOkSubMesh = true; + mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IObject, testResult) ; + if( !testResult ) { + myOkSubMesh = false; + return ; + } + } + LineEditC1A2Mesh->setText(aString) ; + } + else { + myOkMesh = myOkSubMesh = false ; + return ; + } + } + else if ( myEditCurrentArgument == LineEditC1A1Hyp ) { + if ( nbSel >= 1 ) { + HypoList.Clear(); // = mySelection->StoredIObjects() ; + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + HypoList.Append(Itinit.Value()); + } + myOkHypothesis = true ; + if (nbSel > 1) + aString = tr("%1 Hypothesis").arg(nbSel) ; + LineEditC1A1Hyp->setText(aString) ; + } + else { + myOkHypothesis = false ; + return ; + } + } + + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if( send == SelectButtonC1A1Hyp ) { + myEditCurrentArgument = LineEditC1A1Hyp ; + LineEditC1A1Hyp->setFocus() ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myHypothesisFilter) ; + } + else if(send == SelectButtonC1A2Mesh) { + myEditCurrentArgument = LineEditC1A2Mesh; + LineEditC1A2Mesh->setFocus() ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myMeshOrSubMeshFilter) ; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::LineEditReturnPressed() +{ + + return ; +} + + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + + GroupConstructors->setEnabled(false) ; + GroupConstructor1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + disconnect( mySelection, 0, this, 0 ); + } + return ; +} + + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; /* same than click on cancel button */ +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void SMESHGUI_AddHypothesisDlg::enterEvent( QEvent * ) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; +} + + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddHypothesisDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate any active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupConstructor1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h b/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h new file mode 100644 index 000000000..b12103593 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddHypothesisDlg.h @@ -0,0 +1,114 @@ +// File : SMESHGUI_AddHypothesisDlg.h +// Created : Wed May 22 19:05:13 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESHGUI +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ADD_HYPOTHESIS_H +#define DIALOGBOX_ADD_HYPOTHESIS_H + +#include "SALOME_Selection.h" +#include "SALOME_TypeFilter.hxx" +#include "SMESH_TypeFilter.hxx" +#include "SALOME_ListIO.hxx" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) + +// QT Includes +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QFrame; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_AddHypothesisDlg +// purpose : +//================================================================================= +class SMESHGUI_AddHypothesisDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddHypothesisDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddHypothesisDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESH::SMESH_Gen_var myCompMesh ; + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::SMESH_subMesh_var mySubMesh; + + SMESH::SMESH_Hypothesis_var myHypothesis; + + Handle(SMESH_TypeFilter) myHypothesisFilter; + Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter; + + bool myOkMesh ; + bool myOkSubMesh ; + bool myOkHypothesis; + + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SALOME_ListIO HypoList; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + + QGroupBox* GroupConstructor1; + QLineEdit* LineEditC1A1Hyp; + QLineEdit* LineEditC1A2Mesh; + QPushButton* SelectButtonC1A1Hyp; + QPushButton* SelectButtonC1A2Mesh; + QLabel* TextLabelC1A2Mesh; + QLabel* TextLabelC1A1Hyp; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void LineEditReturnPressed() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_AddHypothesisDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructor1Layout; +}; + +#endif // DIALOGBOX_ADD_HYPOTHESIS_H diff --git a/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx new file mode 100644 index 000000000..ea806f0ab --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx @@ -0,0 +1,516 @@ +using namespace std; +// File : SMESHGUI_AddSubMeshDlg.cxx +// Created : Mon May 27 10:20:11 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_AddSubMeshDlg.h" +#include "SMESHGUI.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddSubMeshDlg() +// purpose : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_ADD_SUBMESH"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + if ( !name ) + setName( "SMESHGUI_AddSubMeshDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_ADD_SUBMESH" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); + SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 ); + SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_SUBMESH" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image1 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_OBJECT_MESH" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image0 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); + TextLabelC1A2->setText( tr( "SMESH_OBJECT_GEOM" ) ); + TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A2->setFrameShape( QLabel::NoFrame ); + TextLabelC1A2->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); + SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); + SelectButtonC1A2->setText( tr( "" ) ); + SelectButtonC1A2->setPixmap( image0 ); + SelectButtonC1A2->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); + LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); + GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); + + TextLabel_NameMesh = new QLabel( GroupC1, "TextLabel_NameMesh" ); + TextLabel_NameMesh->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameMesh, 2, 0 ); + LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" ); + GroupC1Layout->addWidget( LineEdit_NameMesh, 2, 2 ); + + TextLabelC1A1Hyp = new QLabel( GroupC1, "TextLabelC1A1Hyp" ); + TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) ); + TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 ); + SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" ); + SelectButtonC1A1Hyp->setText( tr( "" ) ); + SelectButtonC1A1Hyp->setPixmap( image0 ); + GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 ); + LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" ); + LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) ); + GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 ); + + TextLabelC1A1Algo = new QLabel( GroupC1, "TextLabelC1A1Algo" ); + TextLabelC1A1Algo->setText( tr( "SMESH_OBJECT_ALGORITHM" ) ); + TextLabelC1A1Algo->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Algo->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Algo->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 ); + SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" ); + SelectButtonC1A1Algo->setText( tr( "" ) ); + SelectButtonC1A1Algo->setPixmap( image0 ); + GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 ); + LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" ); + LineEditC1A1Algo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Algo->sizePolicy().hasHeightForWidth() ) ); + GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 ); + + SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 ); + /***************************************************************/ + + Init(Sel) ; +} + + +//================================================================================= +// function : ~SMESHGUI_AddSubMeshDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel ) +{ + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + myGeomFilter = new SALOME_TypeFilter( "GEOM" ); + myMeshFilter = new SMESH_TypeFilter( MESH ); + + myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM ); + myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS ); + + myNameSubMesh = "SubMesh"; + + myGeomShape = GEOM::GEOM_Shape::_nil(); + myMesh = SMESH::SMESH_Mesh::_nil(); + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( LineEdit_NameMesh, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A1Algo, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddSubMeshDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if ( !myNameSubMesh.isEmpty() && !myNameSubMesh.isNull() && + !myGeomShape->_is_nil() && !myMesh->_is_nil()) { + mySubMesh = mySMESHGUI->AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ; + } + + if( myOkHypothesis && !mySubMesh->_is_nil() ) { + SALOME_ListIteratorOfListIO It( HypoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, myHypothesis) ; + } + } + + if( myOkAlgorithm && !mySubMesh->_is_nil() ) { + SALOME_ListIteratorOfListIO It( AlgoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, myAlgorithm) ; + } + } + + break ; + } + } +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::ClickOnCancel() +{ + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySelection->ClearFilters() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + QString aString = ""; + + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + + switch (myConstructorId) + { + case 0: + { + if ( myEditCurrentArgument == LineEditC1A1 ) { + if ( nbSel != 1 ) { + myOkHypothesis = false; + myOkAlgorithm = false; + return ; + } else { + Standard_Boolean testResult ; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ; + if( !testResult ) { + myMesh = SMESH::SMESH_Mesh::_nil(); + return ; + } + } + } else if ( myEditCurrentArgument == LineEditC1A2 ) { + if ( nbSel != 1 ) { + myOkHypothesis = false; + myOkAlgorithm = false; + return ; + } else { + Standard_Boolean testResult ; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ; + if( !testResult ) { + myGeomShape = GEOM::GEOM_Shape::_nil(); + return ; + } + } + } else if ( myEditCurrentArgument == LineEditC1A1Hyp ) { + if ( nbSel >= 1 ) { + HypoList.Clear(); + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + HypoList.Append(Itinit.Value()); + } + myOkHypothesis = true ; + if (nbSel > 1) + aString = tr("%1 Hypothesis").arg(nbSel) ; + LineEditC1A1Hyp->setText(aString) ; + } + else { + myOkHypothesis = false ; + return ; + } + } else if ( myEditCurrentArgument == LineEditC1A1Algo ) { + if ( nbSel >= 1 ) { + AlgoList.Clear(); + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + AlgoList.Append(Itinit.Value()); + } + myOkAlgorithm = true ; + if (nbSel > 1) + aString = tr("%1 Algorithms").arg(nbSel) ; + LineEditC1A1Algo->setText(aString) ; + } + else { + myOkAlgorithm = false ; + return ; + } + } + break; + } + } + + myEditCurrentArgument->setText(aString) ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + mySelection->ClearFilters() ; + mySelection->AddFilter(myMeshFilter) ; + } else if (send == SelectButtonC1A2) { + LineEditC1A2->setFocus() ; + myEditCurrentArgument = LineEditC1A2; + mySelection->ClearFilters() ; + mySelection->AddFilter(myGeomFilter) ; + } else if( send == SelectButtonC1A1Hyp ) { + LineEditC1A1Hyp->setFocus() ; + myEditCurrentArgument = LineEditC1A1Hyp ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myHypothesisFilter) ; + } else if( send == SelectButtonC1A1Algo ) { + LineEditC1A1Algo->setFocus() ; + myEditCurrentArgument = LineEditC1A1Algo ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myAlgorithmFilter) ; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + disconnect( mySelection, 0, this, 0 ); + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_AddSubMeshDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameMesh) { + myNameSubMesh = newText; + } + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h b/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h new file mode 100644 index 000000000..fc6eaf27d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddSubMeshDlg.h @@ -0,0 +1,126 @@ +// File : SMESHGUI_AddSubMeshDlg.h +// Created : Mon May 27 10:23:17 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_ADD_SUBMESH_H +#define DIALOGBOX_ADD_SUBMESH_H + +#include "SALOME_Selection.h" +#include "SALOME_TypeFilter.hxx" +#include "SMESH_TypeFilter.hxx" + +// QT Includes +#include +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include CORBA_SERVER_HEADER(GEOM_Shape) +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_AddSubMeshDlg +// purpose : +//================================================================================= +class SMESHGUI_AddSubMeshDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddSubMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddSubMeshDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + + GEOM::GEOM_Shape_var myGeomShape ; + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::SMESH_subMesh_var mySubMesh; + + QString myNameSubMesh ; + + Handle(SALOME_TypeFilter) myGeomFilter; + Handle(SMESH_TypeFilter) myMeshFilter; + Handle(SMESH_TypeFilter) myHypothesisFilter; + Handle(SMESH_TypeFilter) myAlgorithmFilter; + + SALOME_ListIO HypoList; + SALOME_ListIO AlgoList; + + bool myOkHypothesis; + bool myOkAlgorithm; + + SMESH::SMESH_Hypothesis_var myHypothesis; + SMESH::SMESH_Hypothesis_var myAlgorithm; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabel_NameMesh ; + QLineEdit* LineEdit_NameMesh ; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + QLabel* TextLabelC1A2; + QPushButton* SelectButtonC1A2; + QLineEdit* LineEditC1A2; + + QLabel* TextLabelC1A1Hyp; + QPushButton* SelectButtonC1A1Hyp; + QLineEdit* LineEditC1A1Hyp; + + QLabel* TextLabelC1A1Algo; + QPushButton* SelectButtonC1A1Algo; + QLineEdit* LineEditC1A1Algo; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + +protected: + QGridLayout* SMESHGUI_AddSubMeshDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_ADD_SUBMESH_H diff --git a/src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx new file mode 100644 index 000000000..6ed711d25 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddVolumeDlg.cxx @@ -0,0 +1,388 @@ +using namespace std; +// File : SMESHGUI_AddVolumeDlg.cxx +// Created : Wed Jun 26 21:00:14 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_AddVolumeDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_AddVolumeDlg() +// purpose : +//================================================================================= +SMESHGUI_AddVolumeDlg::SMESHGUI_AddVolumeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + int nbNodes, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + myNodes = nbNodes; + QPixmap image0; + if ( myNodes == 4 ) + image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_TETRAS"))); + else if ( myNodes == 8 ) + image0 = QPixmap(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_HEXAS"))); + + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_AddVolumeDlg" ); + resize( 303, 185 ); + if ( myNodes == 4 ) + setCaption( tr( "SMESH_ADD_TETRAS_TITLE" ) ); + else if ( myNodes == 8 ) + setCaption( tr( "SMESH_ADD_HEXAS_TITLE" ) ); + + setSizeGripEnabled( TRUE ); + SMESHGUI_AddVolumeDlgLayout = new QGridLayout( this ); + SMESHGUI_AddVolumeDlgLayout->setSpacing( 6 ); + SMESHGUI_AddVolumeDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + if ( myNodes == 4 ) + GroupConstructors->setTitle( tr( "SMESH_TETRAS" ) ); + else if ( myNodes == 8 ) + GroupConstructors->setTitle( tr( "SMESH_HEXAS" ) ); + + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_AddVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_AddVolumeDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + if ( myNodes == 4 ) + GroupC1->setTitle( tr( "SMESH_ADD_TETRAS" ) ); + else if ( myNodes == 8 ) + GroupC1->setTitle( tr( "SMESH_ADD_HEXAS" ) ); + + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + SMESHGUI_AddVolumeDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_AddVolumeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_AddVolumeDlg::~SMESHGUI_AddVolumeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkNodes = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_AddVolumeDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkNodes) { + mySMESHGUI->EraseSimulationActors(); + mySMESHGUI->AddVolume( myMesh, myMapIndex ) ; + mySMESHGUI->ViewNodes(); + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_AddVolumeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkNodes = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes < 1) + return ; + + if ( mySelection->SelectionMode() != 1 ) { + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + + if ( myNodes == 4 && nbNodes == 4 ) { + mySMESHGUI->DisplaySimulationTetra(myMesh, myMapIndex); + myOkNodes = true ; + } else if ( myNodes == 8 && nbNodes == 8 ) { + mySMESHGUI->DisplaySimulationHexa(myMesh, myMapIndex); + myOkNodes = true ; + } else { + // mySMESHGUI->EraseSimulationActors(); + myOkNodes = false ; + } + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + mySMESHGUI->EraseSimulationActors() ; + mySMESHGUI->ResetState() ; + mySMESHGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_AddVolumeDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + diff --git a/src/SMESHGUI/SMESHGUI_AddVolumeDlg.h b/src/SMESHGUI/SMESHGUI_AddVolumeDlg.h new file mode 100644 index 000000000..c09c9e502 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_AddVolumeDlg.h @@ -0,0 +1,98 @@ +// File : SMESHGUI_AddVolumeDlg.h +// Created : Wed Jun 26 21:00:41 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ADD_VOLUME_H +#define DIALOGBOX_ADD_VOLUME_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QCheckBox; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_AddVolumeDlg +// purpose : +//================================================================================= +class SMESHGUI_AddVolumeDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_AddVolumeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, + int nbNode = 4, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_AddVolumeDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkNodes ; /* to check when arguments is defined */ + + int myNodes ; + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_AddVolumeDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_ADD_VOLUME_H diff --git a/src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx b/src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx new file mode 100644 index 000000000..4f7decb2e --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_ComputeScalarValue.cxx @@ -0,0 +1,409 @@ +using namespace std; +// File : SMESHGUI_ComputeScalarValue.cxx +// Created : Mon Jun 24 14:06:00 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_ComputeScalarValue.h" +#include "utilities.h" +#include + + + + +//============================================================================= +/*! + * + */ +//============================================================================= +static double ComputeLength(float* p1, float* p2) { + float a1,a2,a3,b1,b2,b3; + a1 = p1[0]; + a2 = p1[1]; + a3 = p1[2]; + b1 = p2[0]; + b2 = p2[1]; + b3 = p2[2]; + // MESSAGE( a1 << " "<< a2 << " "<< a3 << " " << b1 << " "<< b2 << " "<< b3 ); + float X1,Y1,Z1,X2,Z2,Y2; + X1 = b1 - a1; + Y1 = b2 - a2; + Z1 = b3 - a3; + // MESSAGE( X1 << " "<< Y1 << " "<< Z1 ); + float e1; + e1 = sqrt( X1*X1 + Y1*Y1 + Z1*Z1 ) ; + // MESSAGE( "Length = " << e1 ); + return e1; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double SMESHGUI_ComputeScalarValue::LengthEdges(vtkCell* theCell) { + int num_points = theCell->GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points != 2 ) return 0; + float* pnt1 = points->GetPoint(0); + float* pnt2 = points->GetPoint(1); + return ComputeLength(pnt1,pnt2); +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +static double ComputeAreaOfTriangle(float* p1, float* p2, float* p3) { + double a1,a2,a3,b1,b2,b3,c1,c2,c3; + a1 = p1[0]; + a2 = p1[1]; + a3 = p1[2]; + b1 = p2[0]; + b2 = p2[1]; + b3 = p2[2]; + c1 = p3[0]; + c2 = p3[1]; + c3 = p3[2]; + + float e1, e2, e3; + e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ; + e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ; + e3 = sqrt( (c1-a1)*(c1-a1) + (c2-a2)*(c2-a2) + (c3-a3)*(c3-a3) ) ; + + // MESSAGE( "e = " << e1 << " " << e2 <<" " << e3 ); + float s = (e1+e2+e3)/2; + double area = sqrt(s*(s-e1)*(s-e2)*(s-e3)); + // MESSAGE( "area = " << area ); + return area; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double SMESHGUI_ComputeScalarValue::AreaElements(vtkCell* theCell){ + // MESSAGE ( " SMESHGUI_ComputeScalarValue::AreaElements " ) + int num_points = theCell->GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + // MESSAGE( "num_points = "<< num_points ); + for (int j = 0; j < theCell->GetNumberOfPoints (); j++) { + float* pnt = points->GetPoint(j); + // MESSAGE( pnt[0] << " " << pnt[1] << " " << pnt[2] ); + } + if (num_points < 3 ) return 0; + if (num_points == 3) { + float* p1 = points->GetPoint(0); + float* p2 = points->GetPoint(1); + float* p3 = points->GetPoint(2); + double area = ComputeAreaOfTriangle(p1,p2,p3); + return area; + } else if (num_points == 4) { + float* p1 = points->GetPoint(0); + float* p2 = points->GetPoint(1); + float* p3 = points->GetPoint(2); + float* p4 = points->GetPoint(3); + double area1 = ComputeAreaOfTriangle(p1,p2,p3); + double area2 = ComputeAreaOfTriangle(p3,p4,p1); + return area1+area2; + } +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +double SMESHGUI_ComputeScalarValue::Taper(vtkCell* theCell){ + int num_points = theCell->GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points != 4 ) return 0; + float* p1 = points->GetPoint(0); + float* p2 = points->GetPoint(1); + float* p3 = points->GetPoint(2); + float* p4 = points->GetPoint(3); + double A1 = ComputeAreaOfTriangle(p4,p1,p2); + double A2 = ComputeAreaOfTriangle(p3,p1,p2); + double A3 = ComputeAreaOfTriangle(p2,p3,p4); + double A4 = ComputeAreaOfTriangle(p3,p4,p1); + double JA = 0.25 * (A1 + A2 + A3 + A4); + double taper = fabs(A1/(JA-1)); + if (fabs(A2/(JA-1)) > taper) taper = fabs(A2/(JA-1)); + if (fabs(A3/(JA-1)) > taper) taper = fabs(A3/(JA-1)); + if (fabs(A4/(JA-1)) > taper) taper = fabs(A4/(JA-1)); + // MESSAGE( "Taper = " << taper); + return taper; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +double SMESHGUI_ComputeScalarValue::AspectRatio(vtkCell* theCell) { + int num_points = theCell->GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points < 3 ) return 0; + if (num_points == 3) { + float a1,a2,a3,b1,b2,b3,c1,c2,c3; + float* pnt = points->GetPoint(0); + a1 = pnt[0]; + a2 = pnt[1]; + a3 = pnt[2]; + pnt = points->GetPoint(1); + b1 = pnt[0]; + b2 = pnt[1]; + b3 = pnt[2]; + pnt = points->GetPoint(2); + c1 = pnt[0]; + c2 = pnt[1]; + c3 = pnt[2]; + + float e1, e2, e3; + e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ; + e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ; + e3 = sqrt( (c1-a1)*(c1-a1) + (c2-a2)*(c2-a2) + (c3-a3)*(c3-a3) ) ; + + float amax,p,s; + + amax=e1; + if (e2>amax) amax=e2; + if (e3>amax) amax=e3; + + p=(e1+e2+e3)/2; + s=AreaElements(theCell); + + double aspectRatio=amax*p*sqrt(double(3))/(s*6); + // MESSAGE( "aspectRatio = " << aspectRatio ); + return(aspectRatio); + } + else if (num_points == 4) { + float a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3; + float* pnt = points->GetPoint(0); + a1 = pnt[0]; + a2 = pnt[1]; + a3 = pnt[2]; + pnt = points->GetPoint(1); + b1 = pnt[0]; + b2 = pnt[1]; + b3 = pnt[2]; + pnt = points->GetPoint(2); + c1 = pnt[0]; + c2 = pnt[1]; + c3 = pnt[2]; + pnt = points->GetPoint(3); + d1 = pnt[0]; + d2 = pnt[1]; + d3 = pnt[2]; + + float e1, e2, e3, e4; + float len_min, len_max; + e1 = sqrt( (a1-b1)*(a1-b1) + (a2-b2)*(a2-b2) + (a3-b3)*(a3-b3) ) ; + e2 = sqrt( (b1-c1)*(b1-c1) + (b2-c2)*(b2-c2) + (b3-c3)*(b3-c3) ) ; + e3 = sqrt( (c1-d1)*(c1-d1) + (c2-d2)*(c2-d2) + (c3-d3)*(c3-d3) ) ; + e4 = sqrt( (d1-a1)*(d1-a1) + (d2-a2)*(d2-a2) + (d3-a3)*(d3-a3) ) ; + + len_min = e1; len_max = e1; + + if (e2 >len_max ) len_max = e2; + if (e3 >len_max ) len_max = e3; + if (e4 >len_max ) len_max = e4; + if (e2 GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points < 3 ) return 0; + float* pnt1 = points->GetPoint(0); + float* pnt2 = points->GetPoint(1); + float* pnt3 = points->GetPoint(2); + if (num_points == 3) { + double a1,a2,a3,amin; + a1=fabs(ComputeAngle(pnt1,pnt2,pnt3)); + amin=a1; + a2=fabs(ComputeAngle(pnt2,pnt3,pnt1)); + if (a2GetPoint(3); + double a1,a2,a3,a4,amin; + a1=fabs(ComputeAngle(pnt1,pnt2,pnt3)); + amin=a1; + a2=fabs(ComputeAngle(pnt2,pnt3,pnt4)); + if (a2GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points < 3 ) return 0; + //triangle case + if (num_points == 3) { + float* pnt1 = points->GetPoint(0); + float* pnt2 = points->GetPoint(1); + float* pnt3 = points->GetPoint(2); + double a1,a2,a3,amax; + a1=fabs(60 - fabs(ComputeAngle(pnt1,pnt2,pnt3))); + amax=a1; + a2=fabs(60 - fabs(ComputeAngle(pnt2,pnt3,pnt1))); + if (a2>amax) amax=a2; + a3=fabs(60 - fabs(ComputeAngle(pnt3,pnt1,pnt2))); + if (a3>amax) amax=a3; + // MESSAGE( "Skew = " << amax ); + return amax; + } + //quadrangle case + else if (num_points == 4) { + float* pnt1 = points->GetPoint(0); + float* pnt2 = points->GetPoint(1); + float* pnt3 = points->GetPoint(2); + float* pnt4 = points->GetPoint(3); + + double a1,a2,a3,a4,amax; + a1=fabs(90 - fabs(ComputeAngle(pnt1,pnt2,pnt3))); + amax=a1; + a2=fabs(90 - fabs(ComputeAngle(pnt2,pnt3,pnt4))); + if (a2>amax) amax=a2; + a3=fabs(90 - fabs(ComputeAngle(pnt3,pnt4,pnt1))); + if (a3>amax) amax=a3; + a4=fabs(90 - fabs(ComputeAngle(pnt4,pnt1,pnt2))); + if (a4>amax) amax=a4; + // MESSAGE( "Skew = " << amax ); + return amax; + } +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +static double ComputeA(float* p1, float* p2, float* p3, float* G) { + double e1 = sqrt(pow(p2[0]-p1[0], 2)+pow(p2[1]-p1[1], 2)+pow(p2[2]-p1[2], 2)); + double e2 = sqrt(pow(p3[0]-p2[0], 2)+pow(p3[1]-p2[1], 2)+pow(p3[2]-p2[2], 2)); + double l; + if (e1 < e2) l = 0.5*e1; + else l = 0.5*e2; + float GI[3], GJ[3], N[3];; + GI[0] = (p2[0]-p1[0])/2-G[0]; + GI[1] = (p2[1]-p1[1])/2-G[1]; + GI[2] = (p2[2]-p1[2])/2-G[2]; + + GJ[0] = (p3[0]-p2[0])/2-G[0]; + GJ[1] = (p3[1]-p2[1])/2-G[1]; + GJ[2] = (p3[2]-p2[2])/2-G[2]; + + N[0] = GI[1]*GJ[2] - GI[2]*GJ[1]; + N[1] = GI[2]*GJ[0] - GI[0]*GJ[2]; + N[2] = GI[0]*GJ[1] - GI[1]*GJ[0]; + + double H; + float T[3]; + T[0] = (p1[0]-G[0])*N[0]; + T[1] = (p1[1]-G[1])*N[1]; + T[2] = (p1[2]-G[2])*N[2]; + + H = sqrt(pow(T[0],2)+pow(T[1],2)+pow(T[2],2))/sqrt(pow(N[0],2)+pow(N[1],2)+pow(N[2],2)); + double A = H/l; + return A; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double SMESHGUI_ComputeScalarValue::Warp(vtkCell* theCell) { + int num_points = theCell->GetNumberOfPoints (); + vtkPoints* points = theCell->GetPoints(); + if (num_points != 4 ) return 0; + float* p1 = points->GetPoint(0); + float* p2 = points->GetPoint(1); + float* p3 = points->GetPoint(2); + float* p4 = points->GetPoint(3); + double G1, G2, G3; + float G[3]; + G[0] = (p1[0]+p2[0]+p3[0]+p4[0])/4; + G[1] = (p1[1]+p2[1]+p3[1]+p4[1])/4; + G[2] = (p1[2]+p2[2]+p3[2]+p4[2])/4; + double amax = ComputeA(p1, p2, p3, G); + double nextA = ComputeA(p2, p3, p4, G); + if (nextA > amax) amax = nextA; + nextA = ComputeA(p3, p4, p1, G); + if (nextA > amax) amax = nextA; + nextA = ComputeA(p4, p1, p2, G); + if (nextA > amax) amax = nextA; + // MESSAGE( "Warp = " << amax ); + return amax; +} diff --git a/src/SMESHGUI/SMESHGUI_ComputeScalarValue.h b/src/SMESHGUI/SMESHGUI_ComputeScalarValue.h new file mode 100644 index 000000000..25d05e676 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_ComputeScalarValue.h @@ -0,0 +1,26 @@ +// File : SMESHGUI_ComputeScalarValue.h +// Created : Mon Jun 24 14:06:00 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef SMESHGUI_CONTROLALGORITHMS_H +#define SMESHGUI_CONTROLALGORITHMS_H + +#include + +class SMESHGUI_ComputeScalarValue { + public: + static double LengthEdges(vtkCell* theCell); + static double AreaElements(vtkCell* theCell); + static double Taper(vtkCell* theCell); + static double AspectRatio(vtkCell* theCell); + static double MinimumAngle(vtkCell* theCell); + static double Skew(vtkCell* theCell); + static double Warp(vtkCell* theCell); +}; + +#endif diff --git a/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.cxx b/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.cxx new file mode 100644 index 000000000..98d6f955b --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.cxx @@ -0,0 +1,351 @@ +using namespace std; +// File : SMESHGUI_DiagonalInversionDlg.cxx +// Created : +// Author : Damien COQUERET + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_DiagonalInversionDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_DiagonalInversionDlg() +// purpose : +//================================================================================= +SMESHGUI_DiagonalInversionDlg::SMESHGUI_DiagonalInversionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_MESH_DIAGONAL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_DiagonalInversionDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_DIAGONAL_INVERSION_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_DiagonalInversionDlgLayout = new QGridLayout( this ); + SMESHGUI_DiagonalInversionDlgLayout->setSpacing( 6 ); + SMESHGUI_DiagonalInversionDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_DIAGONAL" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_DIAGONAL" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_DIAGONAL" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + SMESHGUI_DiagonalInversionDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_DiagonalInversionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_DiagonalInversionDlg::~SMESHGUI_DiagonalInversionDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkElements = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkElements) { + mySMESHGUI->DiagonalInversion( myMesh, myMapIndex ) ; + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkElements = false; + QString aString = ""; + + if ( mySelection->SelectionMode() != 2 ) { + return; + } + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbElements = mySMESHGUI->GetNameOfSelectedEdges(mySelection, aString) ; + if(nbElements < 1) + return ; + MESSAGE( "DCQ : nb. elements = " << nbElements ) + + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + myOkElements = true ; + myEditCurrentArgument->setText(aString) ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_DiagonalInversionDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + diff --git a/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h b/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h new file mode 100644 index 000000000..cd2dde34f --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_DiagonalInversionDlg.h @@ -0,0 +1,94 @@ +// File : SMESHGUI_DiagonalInversionDlg.h +// Created : +// Author : Damien COQUERET + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_DIAGONAL_INVERSION_H +#define DIALOGBOX_DIAGONAL_INVERSION_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_DiagonalInversionDlg +// purpose : +//================================================================================= +class SMESHGUI_DiagonalInversionDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_DiagonalInversionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_DiagonalInversionDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkElements ; /* to check when arguments is defined */ + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_DiagonalInversionDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_DIAGONAL_INVERSION_H diff --git a/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.cxx b/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.cxx new file mode 100644 index 000000000..893230a21 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.cxx @@ -0,0 +1,429 @@ +using namespace std; +// File : SMESHGUI_EdgesConnectivityDlg.cxx +// Created : Tue Jun 25 21:22:12 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_EdgesConnectivityDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK Include +#include + +//================================================================================= +// class : SMESHGUI_EdgesConnectivityDlg() +// purpose : +//================================================================================= +SMESHGUI_EdgesConnectivityDlg::SMESHGUI_EdgesConnectivityDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_CONNECTIVITY"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_EdgesConnectivityDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_EDGES_CONNECTIVITY_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_EdgesConnectivityDlgLayout = new QGridLayout( this ); + SMESHGUI_EdgesConnectivityDlgLayout->setSpacing( 6 ); + SMESHGUI_EdgesConnectivityDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_EDGES_CONNECTIVITY" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + //buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + //buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + //buttonOk->setAutoDefault( TRUE ); + //buttonOk->setDefault( TRUE ); + //GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_EDGES_CONNECTIVITY" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_MESH" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + BoundaryEdges = new QCheckBox( GroupC1, "BoundaryEdges" ); + BoundaryEdges->setText( tr( "SMESH_BOUNDARYEDGES" ) ); + GroupC1Layout->addWidget( BoundaryEdges, 1, 0 ); + + ManifoldEdges = new QCheckBox( GroupC1, "ManifoldEdges" ); + ManifoldEdges->setText( tr( "SMESH_MANIFOLDEDGES" ) ); + GroupC1Layout->addWidget( ManifoldEdges, 2, 0 ); + + NonManifoldEdges = new QCheckBox( GroupC1, "NonManifoldEdges" ); + NonManifoldEdges->setText( tr( "SMESH_NONMANIFOLDEDGES" ) ); + GroupC1Layout->addWidget( NonManifoldEdges, 1, 2 ); + + FeatureEdges = new QCheckBox( GroupC1, "FeatureEdges" ); + FeatureEdges->setText( tr( "SMESH_FEATUREEDGES" ) ); + GroupC1Layout->addWidget( FeatureEdges, 2, 2 ); + + FeatureAngle= new QLabel( GroupC1, "FeatureAngle" ); + FeatureAngle->setText( tr( "SMESH_FEATUREANGLE" ) ); + FeatureAngle->setMinimumSize( QSize( 50, 0 ) ); + FeatureAngle->setFrameShape( QLabel::NoFrame ); + FeatureAngle->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( FeatureAngle, 3, 0 ); + + SpinBox_FeatureAngle = new SMESHGUI_SpinBox( GroupC1, "SpinBox_FeatureAngle" ) ; + GroupC1Layout->addWidget( SpinBox_FeatureAngle , 3, 2 ); + + SMESHGUI_EdgesConnectivityDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_EdgesConnectivityDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_EdgesConnectivityDlg::~SMESHGUI_EdgesConnectivityDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkActor = false ; + + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 5.0 ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_FeatureAngle->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_FeatureAngle->SetValue( 30.0 ) ; + + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + //connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( BoundaryEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) ); + connect( ManifoldEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) ); + connect( NonManifoldEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) ); + connect( FeatureEdges, SIGNAL(stateChanged(int)), SLOT(CheckBox(int)) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkActor) { + Standard_Boolean res; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if ( !IO->hasEntry() ) + break; + + SMESH_Actor* ac = mySMESHGUI->FindActorByEntry( IO->getEntry(), res, true ); + if ( !res ) + break; + + mySMESHGUI->ChangeRepresentation( ac, 0 ); + + vtkGeometryFilter *gf = vtkGeometryFilter::New(); + gf->SetInput(ac->DataSource); + vtkFeatureEdges *edges = vtkFeatureEdges::New(); + edges->SetInput( gf->GetOutput() ); + edges->ColoringOn(); + if ( BoundaryEdges->isOn() ) edges->BoundaryEdgesOn(); + else edges->BoundaryEdgesOff(); + if ( ManifoldEdges->isOn() ) edges->ManifoldEdgesOn(); + else edges->ManifoldEdgesOff(); + if ( NonManifoldEdges->isOn() ) edges->NonManifoldEdgesOn(); + else edges->NonManifoldEdgesOff(); + if ( FeatureEdges->isOn() ) edges->FeatureEdgesOn(); + else edges->FeatureEdgesOff(); + + double angle = SpinBox_FeatureAngle->GetValue() ; + edges->SetFeatureAngle( angle ); + + vtkDataSetMapper *EdgeMapper = vtkDataSetMapper::New(); + EdgeMapper->SetInput( edges->GetOutput() ); + EdgeMapper->SetScalarModeToUseCellData(); + ac->SetMapper(EdgeMapper); + + mySMESHGUI->DisplayEdgesConnectivityLegendBox(ac); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::ClickOnCancel() +{ + mySMESHGUI->ScalarVisibilityOff(); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + mySMESHGUI->ScalarVisibilityOff(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkActor = false; + QString aString = ""; + + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + if(nbSel != 1) { + mySMESHGUI->ScalarVisibilityOff(); + return; + } + + myEditCurrentArgument->setText(aString) ; + myOkActor = true ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_EdgesConnectivityDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + +void SMESHGUI_EdgesConnectivityDlg::CheckBox( int state ) +{ + QCheckBox* send = (QCheckBox*)sender(); + if( send == BoundaryEdges ) { + } else if( send == ManifoldEdges ) { + } else if( send == NonManifoldEdges ) { + } else { + } +} + diff --git a/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h b/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h new file mode 100644 index 000000000..13544f273 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EdgesConnectivityDlg.h @@ -0,0 +1,104 @@ +// File : SMESHGUI_EdgesConnectivityDlg.h +// Created : Tue Jun 25 21:22:54 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_EDGES_CONNECTIVITY_H +#define DIALOGBOX_EDGES_CONNECTIVITY_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QCheckBox; +class SMESHGUI; +class SMESHGUI_SpinBox; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_EdgesConnectivityDlg +// purpose : +//================================================================================= +class SMESHGUI_EdgesConnectivityDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_EdgesConnectivityDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_EdgesConnectivityDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + bool myOkActor ; + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QCheckBox* BoundaryEdges; + QCheckBox* ManifoldEdges; + QCheckBox* NonManifoldEdges; + QCheckBox* FeatureEdges; + + QLabel* FeatureAngle; + SMESHGUI_SpinBox* SpinBox_FeatureAngle ; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + + void CheckBox( int ); + +protected: + QGridLayout* SMESHGUI_EdgesConnectivityDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; + + QHBoxLayout* hbox_2; + QVBoxLayout* vbox; + QVBoxLayout* vbox_2; +}; + +#endif // DIALOGBOX_EDGES_CONNECTIVITY_H diff --git a/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx b/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx new file mode 100644 index 000000000..f839d12e9 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx @@ -0,0 +1,824 @@ +using namespace std; +// File : SMESHGUI_EditHypothesesDlg.cxx +// Created : Fri Aug 02 09:14:56 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_EditHypothesesDlg.h" +#include "SMESHGUI.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//VRV: porting on Qt 3.0.5 +#if QT_VERSION >= 0x030005 +#include +#endif +//VRV: porting on Qt 3.0.5 + +//================================================================================= +// class : SMESHGUI_EditHypothesesDlg() +// purpose : Constructs a SMESHGUI_EditHypothesesDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_EDIT_MESH"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + if ( !name ) + setName( "SMESHGUI_EditHypothesesDlg" ); + resize( 417, 573 ); + setCaption( tr( "SMESH_EDIT_HYPOTHESES" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_EditHypothesesDlgLayout = new QGridLayout( this ); + SMESHGUI_EditHypothesesDlgLayout->setSpacing( 6 ); + SMESHGUI_EditHypothesesDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_HYPOTHESES" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image1 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 96 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + buttonCancel->setDefault( TRUE ); + buttonCancel->setEnabled( TRUE ) ; + + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + buttonApply->setDefault( FALSE ); + buttonApply->setEnabled( FALSE ) ; + + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( FALSE ); + buttonOk->setEnabled( FALSE ) ; + + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupButtons, 5, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_OBJECT_MESHorSUBMESH" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image0 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); + TextLabelC1A2->setText( tr( "SMESH_OBJECT_GEOM" ) ); + TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A2->setFrameShape( QLabel::NoFrame ); + TextLabelC1A2->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); + SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); + SelectButtonC1A2->setText( tr( "" ) ); + SelectButtonC1A2->setPixmap( image0 ); + SelectButtonC1A2->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); + LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); + GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); + + GroupHypotheses = new QGroupBox( this, "GroupHypotheses" ); + GroupHypotheses->setTitle( tr( "SMESH_HYPOTHESES" ) ); + GroupHypotheses->setColumnLayout(0, Qt::Vertical ); + GroupHypotheses->layout()->setSpacing( 0 ); + GroupHypotheses->layout()->setMargin( 0 ); + grid_3 = new QGridLayout( GroupHypotheses->layout() ); + grid_3->setGeometry( QRect( 12, 18, 139, 110 ) ); + grid_3->setAlignment( Qt::AlignTop ); + grid_3->setSpacing( 6 ); + grid_3->setMargin( 11 ); + + hbox_2 = new QHBoxLayout; + hbox_2->setSpacing( 6 ); + hbox_2->setMargin( 0 ); + + vbox = new QVBoxLayout; + vbox->setSpacing( 6 ); + vbox->setMargin( 0 ); + + TextHypDefinition = new QLabel( GroupHypotheses, "TextHypDefinition" ); + TextHypDefinition->setText( tr( "SMESH_AVAILABLE" ) ); + vbox->addWidget( TextHypDefinition ); + + ListHypDefinition = new QListBox( GroupHypotheses, "ListHypDefinition" ); + ListHypDefinition->setMinimumSize( 100, 50); +// ListHypDefinition->setRowMode(4); +// ListHypDefinition->setRowMode( QListBox::FixedNumber ); +// ListHypDefinition->setLineWidth( 4 ); +// ListHypDefinition->setColumnMode( QListBox::Variable ); +// ListHypDefinition->setVariableHeight( FALSE ); +// ListHypDefinition->insertItem( tr( "New Item" ) ); + vbox->addWidget( ListHypDefinition ); + hbox_2->addLayout( vbox ); + + vbox_2 = new QVBoxLayout; + vbox_2->setSpacing( 6 ); + vbox_2->setMargin( 0 ); + + TextHypAssignation = new QLabel( GroupHypotheses, "TextHypAssignation" ); + TextHypAssignation->setText( tr( "SMESH_EDIT_USED" ) ); + vbox_2->addWidget( TextHypAssignation ); + + ListHypAssignation = new QListBox( GroupHypotheses, "ListHypAssignation" ); + ListHypAssignation->setMinimumSize( 100, 50); +// ListHypAssignation->setRowMode(4); +// ListHypAssignation->setRowMode( QListBox::FixedNumber ); +// ListHypAssignation->setLineWidth( 4 ); +// ListHypAssignation->setColumnMode( QListBox::Variable ); +// ListHypAssignation->setVariableHeight( FALSE ); +// ListHypAssignation->insertItem( tr( "New Item" ) ); + vbox_2->addWidget( ListHypAssignation ); + hbox_2->addLayout( vbox_2 ); + + grid_3->addLayout( hbox_2, 0, 0 ); + + SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupHypotheses, 2, 0 ); + + GroupAlgorithms = new QGroupBox( this, "GroupAlgorithms" ); + GroupAlgorithms->setTitle( tr( "SMESH_ADD_ALGORITHM" ) ); + GroupAlgorithms->setColumnLayout(0, Qt::Vertical ); + GroupAlgorithms->layout()->setSpacing( 0 ); + GroupAlgorithms->layout()->setMargin( 0 ); + grid_4 = new QGridLayout( GroupAlgorithms->layout() ); + grid_4->setGeometry( QRect( 12, 18, 139, 110 ) ); + grid_4->setAlignment( Qt::AlignTop ); + grid_4->setSpacing( 6 ); + grid_4->setMargin( 11 ); + + hbox_3 = new QHBoxLayout; + hbox_3->setSpacing( 6 ); + hbox_3->setMargin( 0 ); + + vbox_3 = new QVBoxLayout; + vbox_3->setSpacing( 6 ); + vbox_3->setMargin( 0 ); + + TextAlgoDefinition = new QLabel( GroupAlgorithms, "TextAlgoDefinition" ); + TextAlgoDefinition->setText( tr( "SMESH_AVAILABLE" ) ); + vbox_3->addWidget( TextAlgoDefinition ); + + ListAlgoDefinition = new QListBox( GroupAlgorithms, "ListAlgoDefinition" ); + ListAlgoDefinition->setMinimumSize( 100, 50); +// ListAlgoDefinition->setRowMode(4); +// ListAlgoDefinition->setRowMode( QListBox::FixedNumber ); +// ListAlgoDefinition->setLineWidth( 4 ); +// ListAlgoDefinition->setColumnMode( QListBox::Variable ); +// ListAlgoDefinition->setVariableHeight( FALSE ); +// ListAlgoDefinition->insertItem( tr( "New Item" ) ); + vbox_3->addWidget( ListAlgoDefinition ); + hbox_3->addLayout( vbox_3 ); + + vbox_4 = new QVBoxLayout; + vbox_4->setSpacing( 6 ); + vbox_4->setMargin( 0 ); + + TextAlgoAssignation = new QLabel( GroupAlgorithms, "TextAlgoAssignation" ); + TextAlgoAssignation->setText( tr( "SMESH_EDIT_USED" ) ); + vbox_4->addWidget( TextAlgoAssignation ); + + ListAlgoAssignation = new QListBox( GroupAlgorithms, "ListAlgoAssignation" ); + ListAlgoAssignation ->setMinimumSize( 100, 50); +// ListAlgoAssignation->setRowMode(4); +// ListAlgoAssignation->setRowMode( QListBox::FixedNumber ); +// ListAlgoAssignation->setLineWidth( 4 ); +// ListAlgoAssignation->setColumnMode( QListBox::Variable ); +// ListAlgoAssignation->setVariableHeight( FALSE ); +// ListAlgoAssignation->insertItem( tr( "New Item" ) ); + vbox_4->addWidget( ListAlgoAssignation ); + hbox_3->addLayout( vbox_4 ); + + grid_4->addLayout( hbox_3, 0, 0 ); + SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupAlgorithms, 3, 0 ); + + SMESHGUI_EditHypothesesDlgLayout->addWidget( GroupC1, 1, 0 ); + /***************************************************************/ + + Init(Sel) ; + +} + + +//================================================================================= +// function : ~SMESHGUI_EditHypothesesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_EditHypothesesDlg::~SMESHGUI_EditHypothesesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::Init( SALOME_Selection* Sel ) +{ + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + InitHypDefinition(); + InitAlgoDefinition(); + + InitHypAssignation(); + InitAlgoAssignation(); + + myGeomFilter = new SALOME_TypeFilter( "GEOM" ); + myMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH ); + + myGeomShape = GEOM::GEOM_Shape::_nil(); + myMesh = SMESH::SMESH_Mesh::_nil(); + mySubMesh = SMESH::SMESH_subMesh::_nil(); + + /* signals and slots connections */ + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + connect( ListHypAssignation, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( removeItem(QListBoxItem*) ) ); + connect( ListAlgoAssignation, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( removeItem(QListBoxItem*) ) ); + + connect( ListHypDefinition, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( addItem(QListBoxItem*) ) ); + connect( ListAlgoDefinition, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( addItem(QListBoxItem*) ) ); + + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_EditHypothesesDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::ClickOnCancel() +{ + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySelection->ClearFilters() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_EditHypothesesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + QString aString = ""; + + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + + switch (myConstructorId) + { + case 0: + { + if ( myEditCurrentArgument == LineEditC1A1 ) { + if ( nbSel != 1 ) { + myOkHypothesis = false; + myOkAlgorithm = false; + myMesh = SMESH::SMESH_Mesh::_nil(); + mySubMesh = SMESH::SMESH_subMesh::_nil(); + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + return ; + } else { + Standard_Boolean testResult ; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ; + if( !testResult ) { + myMesh = SMESH::SMESH_Mesh::_nil(); + + mySubMesh = mySMESHGUI->ConvertIOinSubMesh(IO, testResult) ; + if( !testResult ) { + mySubMesh = SMESH::SMESH_subMesh::_nil(); + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + return ; + } + } + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + } + } else if ( myEditCurrentArgument == LineEditC1A2 ) { + if ( nbSel != 1 ) { + myOkHypothesis = false; + myOkAlgorithm = false; + myGeomShape = GEOM::GEOM_Shape::_nil(); + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + return ; + } else { + Standard_Boolean testResult ; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ; + if( !testResult ) { + myGeomShape = GEOM::GEOM_Shape::_nil(); + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + return ; + } + InitHypAssignation(); + InitAlgoAssignation(); + InitGeom(); + } + } + break; + } + } + + myEditCurrentArgument->setText(aString) ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + mySelection->ClearFilters() ; + mySelection->AddFilter(myMeshOrSubMeshFilter) ; + } else if (send == SelectButtonC1A2) { + LineEditC1A2->setFocus() ; + myEditCurrentArgument = LineEditC1A2; + mySelection->ClearFilters() ; + mySelection->AddFilter(myGeomFilter) ; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + disconnect( mySelection, 0, this, 0 ); + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + return ; +} + +void SMESHGUI_EditHypothesesDlg::removeItem(QListBoxItem* i) +{ + if (!i) return; + + SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI(); + int index = ListHypAssignation->index( i ); + if ( index != -1 ) { + if (mapNameIOR.find( string(i->text()) ) != mapNameIOR.end()) { + SMESH::SMESH_Hypothesis_var Hyp = + SMESH::SMESH_Hypothesis::_narrow( myStudyAPI.StringToIOR( mapNameIOR[ string(i->text()) ].c_str() ) ); + + if ( !myMesh->_is_nil() ) { + SALOMEDS::SObject_var aMesh = myStudyAPI.FindMesh(myMesh); + mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh(aMesh, Hyp); + // mySMESHGUI->GetStudyAPI().ModifiedMesh( aMesh, false ); + mySMESHGUI->GetActiveStudy()->updateObjBrowser(); + } + if ( !mySubMesh->_is_nil() ) { + SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindSubMesh(mySubMesh); + mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh(aSubMesh, Hyp); + // mySMESHGUI->GetStudyAPI().ModifiedMesh( aSubMesh, false ); + mySMESHGUI->GetActiveStudy()->updateObjBrowser(); + } + + ListHypAssignation->removeItem( index ); + } + return; + } + index = ListAlgoAssignation->index( i ); + if ( index != -1 ) { + if (mapNameIOR.find( string(i->text()) ) != mapNameIOR.end()) { + SMESH::SMESH_Hypothesis_var Hyp = + SMESH::SMESH_Hypothesis::_narrow( myStudyAPI.StringToIOR(mapNameIOR[ string(i->text()) ].c_str()) ); + + if ( !myMesh->_is_nil() ) { + SALOMEDS::SObject_var aMesh = myStudyAPI.FindMesh(myMesh); + mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh(aMesh, Hyp); + // mySMESHGUI->GetStudyAPI().ModifiedMesh( aMesh, false ); + mySMESHGUI->GetActiveStudy()->updateObjBrowser(); + } + if ( !mySubMesh->_is_nil() ) { + SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindSubMesh(mySubMesh); + mySMESHGUI->RemoveHypothesisOrAlgorithmOnMesh(aSubMesh, Hyp); + // mySMESHGUI->GetStudyAPI().ModifiedMesh( aSubMesh, false ); + mySMESHGUI->GetActiveStudy()->updateObjBrowser(); + } + + ListAlgoAssignation->removeItem( index ); + } + } +} + + +//================================================================================= +// function : addItem() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::addItem(QListBoxItem* i) +{ + if (!i) return; + + SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI(); + if ( ListHypDefinition->findItem( i->text() ) ) { + if ( !ListHypAssignation->findItem( i->text() ) ) { + ListHypAssignation->insertItem( i->text() ); + + if (mapNameIOR.find( string(i->text()) ) != mapNameIOR.end()) { + SMESH::SMESH_Hypothesis_var Hyp = + SMESH::SMESH_Hypothesis::_narrow( myStudyAPI.StringToIOR(mapNameIOR[ string(i->text()) ].c_str()) ); + + if ( !myMesh->_is_nil() ) + mySMESHGUI->AddHypothesisOnMesh(myMesh, Hyp); + if ( !mySubMesh->_is_nil() ) + mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, Hyp); + } + } + return; + } + if ( ListAlgoDefinition->findItem( i->text() ) ) { + if ( !ListAlgoAssignation->findItem( i->text() ) ) { + ListAlgoAssignation->insertItem( i->text() ); + + if (mapNameIOR.find( string(i->text()) ) != mapNameIOR.end()) { + SMESH::SMESH_Hypothesis_var Hyp = + SMESH::SMESH_Hypothesis::_narrow( myStudyAPI.StringToIOR(mapNameIOR[ string(i->text()) ].c_str()) ); + + if ( !myMesh->_is_nil() ) + mySMESHGUI->AddAlgorithmOnMesh(myMesh, Hyp); + if ( !mySubMesh->_is_nil() ) + mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, Hyp); + } + } + } + mySMESHGUI->GetActiveStudy()->updateObjBrowser(); +} + + +//================================================================================= +// function : InitHypDefinition() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::InitHypDefinition() +{ + SALOMEDS::SComponent_var father = mySMESHGUI->GetStudy()->FindComponent("MESH"); + SALOMEDS::SObject_var HypothesisRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + int Tag_HypothesisRoot = 1; + if (father->FindSubObject (1, HypothesisRoot)) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(HypothesisRoot); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if (Obj->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListHypDefinition->insertItem(aName->Value()); + + if (Obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + mapNameIOR[ aName->Value() ] = anIOR->Value(); + } + } + } + } +} + +//================================================================================= +// function : InitHypAssignation() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::InitHypAssignation() +{ + MESSAGE ( " InitHypAssignation " << myMesh->_is_nil() ) + MESSAGE ( " InitHypAssignation " << mySubMesh->_is_nil() ) + ListHypAssignation->clear(); + SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI(); + int Tag_RefOnAppliedHypothesis = 2; + SALOMEDS::SObject_var AHR, aRef; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + + if ( !myMesh->_is_nil() ) { + SALOMEDS::SObject_var aMesh = myStudyAPI.FindMesh( myMesh ); + if ( aMesh->FindSubObject (2, AHR)) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListHypAssignation->insertItem(aName->Value()); + } + } + } + } + } + if ( !mySubMesh->_is_nil() ) { + SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindSubMesh( mySubMesh ); + if ( aSubMesh->FindSubObject (2, AHR)) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListHypAssignation->insertItem(aName->Value()); + } + } + } + } + } +} + +//================================================================================= +// function : InitAlgoDefinition() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::InitAlgoDefinition() +{ + SALOMEDS::SComponent_var father = mySMESHGUI->GetStudy()->FindComponent("MESH"); + SALOMEDS::SObject_var AlgorithmsRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + int Tag_AlgorithmsRoot = 2; + if (father->FindSubObject (2, AlgorithmsRoot)) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AlgorithmsRoot); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if (Obj->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListAlgoDefinition->insertItem(aName->Value()); + + if (Obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + mapNameIOR[ aName->Value() ] = anIOR->Value(); + } + } + } + } +} + + +//================================================================================= +// function : InitAlgoAssignation() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::InitAlgoAssignation() +{ + MESSAGE ( " InitAlgoAssignation " << myMesh->_is_nil() ) + MESSAGE ( " InitAlgoAssignation " << mySubMesh->_is_nil() ) + ListAlgoAssignation->clear(); + SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI(); + int Tag_RefOnAppliedAlgorithms = 3; + SALOMEDS::SObject_var AHR, aRef; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + + if ( !myMesh->_is_nil() ) { + SALOMEDS::SObject_var aMesh = myStudyAPI.FindMesh( myMesh ); + if ( aMesh->FindSubObject (3, AHR) ) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListAlgoAssignation->insertItem(aName->Value()); + } + } + } + } + } + if ( !mySubMesh->_is_nil() ) { + SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindSubMesh( mySubMesh ); + if ( aSubMesh->FindSubObject (3, AHR) ) { + SALOMEDS::ChildIterator_var it = mySMESHGUI->GetStudy()->NewChildIterator(AHR); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( Obj->ReferencedObject(aRef) ) { + if (aRef->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + ListAlgoAssignation->insertItem(aName->Value()); + } + } + } + } + } +} + +//================================================================================= +// function : InitGeom() +// purpose : +//================================================================================= +void SMESHGUI_EditHypothesesDlg::InitGeom() +{ + LineEditC1A2->setText("") ; + SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI(); + + if ( !myMesh->_is_nil() ) { + SALOMEDS::SObject_var aMesh = myStudyAPI.FindMesh( myMesh ); + if ( !aMesh->_is_nil() ) + myGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh(aMesh); + } + if ( !mySubMesh->_is_nil() ) { + SALOMEDS::SObject_var aSubMesh = myStudyAPI.FindSubMesh( mySubMesh ); + if ( !aSubMesh->_is_nil() ) + myGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh(aSubMesh); + } + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if ( !myGeomShape->_is_nil() && (!myMesh->_is_nil() || !mySubMesh->_is_nil()) ) { + SALOMEDS::SObject_var aSO = mySMESHGUI->GetStudy()->FindObjectIOR( myGeomShape->Name() ); + if ( !aSO->_is_nil() ) { + if (aSO->FindAttribute(anAttr, "AttributeName") ) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + LineEditC1A2->setText( QString(aName->Value()) ) ; + } + } + } +} diff --git a/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h b/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h new file mode 100644 index 000000000..76788d743 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h @@ -0,0 +1,158 @@ +// File : SMESHGUI_EditHypothesesDlg.h +// Created : Fri Aug 02 09:15:40 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SALOMEDS +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_EDIT_HYPOTHESES_H +#define DIALOGBOX_EDIT_HYPOTHESES_H + +#include "SALOME_Selection.h" +#include "SALOME_TypeFilter.hxx" +#include "SMESH_TypeFilter.hxx" + +// QT Includes +#include +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include CORBA_SERVER_HEADER(GEOM_Shape) +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +#include +#include + +using namespace std; + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QListBox; +class QListBoxItem; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_EditHypothesesDlg +// purpose : +//================================================================================= +class SMESHGUI_EditHypothesesDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_EditHypothesesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_EditHypothesesDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + void InitHypDefinition(); + void InitAlgoDefinition(); + void InitHypAssignation(); + void InitAlgoAssignation(); + + void InitGeom(); + + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + + GEOM::GEOM_Shape_var myGeomShape ; + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::SMESH_subMesh_var mySubMesh; + + Handle(SALOME_TypeFilter) myGeomFilter; + Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter; + + map mapNameIOR; + + SALOME_ListIO HypoList; + SALOME_ListIO AlgoList; + + bool myOkHypothesis; + bool myOkAlgorithm; + + SMESH::SMESH_Hypothesis_var myHypothesis; + SMESH::SMESH_Hypothesis_var myAlgorithm; + + SMESH::ListOfHypothesis_var myLHypothesis; + SMESH::ListOfHypothesis_var myLAlgorithm; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QLabel* TextLabelC1A2; + QPushButton* SelectButtonC1A2; + QLineEdit* LineEditC1A2; + + QGroupBox* GroupHypotheses; + QLabel* TextHypDefinition; + QListBox* ListHypDefinition; + QLabel* TextHypAssignation; + QListBox* ListHypAssignation; + + QGroupBox* GroupAlgorithms; + QLabel* TextAlgoDefinition; + QListBox* ListAlgoDefinition; + QLabel* TextAlgoAssignation; + QListBox* ListAlgoAssignation; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnCancel(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + + void removeItem(QListBoxItem*); + void addItem(QListBoxItem*); + +protected: + QGridLayout* SMESHGUI_EditHypothesesDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; + + QGridLayout* grid_3; + QGridLayout* grid_4; + + QHBoxLayout* hbox_2; + QHBoxLayout* hbox_3; + + QVBoxLayout* vbox; + QVBoxLayout* vbox_2; + QVBoxLayout* vbox_3; + QVBoxLayout* vbox_4; + +}; + +#endif // DIALOGBOX_EDIT_HYPOTHESES_H diff --git a/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx new file mode 100644 index 000000000..c5ba0d13e --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.cxx @@ -0,0 +1,127 @@ +using namespace std; +// File : SMESHGUI_EditScalarBarDlg.cxx +// Created : Wed Jun 12 12:01:26 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_EditScalarBarDlg.h" +#include "SMESHGUI.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a SMESHGUI_EditScalarBarDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +SMESHGUI_EditScalarBarDlg::SMESHGUI_EditScalarBarDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + if ( !name ) + setName( "SMESHGUI_EditScalarBarDlg" ); + resize( 124, 122 ); + setCaption( tr( "SMESH_SCALARBAR" ) ); + setSizeGripEnabled( TRUE ); + grid = new QGridLayout( this ); + grid->setSpacing( 6 ); + grid->setMargin( 11 ); + + grid_2 = new QGridLayout; + grid_2->setSpacing( 6 ); + grid_2->setMargin( 0 ); + + PushButtonUpdateView = new QPushButton( this, "PushButtonUpdateView" ); + PushButtonUpdateView->setText( tr( "SMESH_UPDATEVIEW" ) ); + + grid_2->addWidget( PushButtonUpdateView, 1, 0 ); + + grid_3 = new QGridLayout; + grid_3->setSpacing( 6 ); + grid_3->setMargin( 0 ); + + grid_4 = new QGridLayout; + grid_4->setSpacing( 6 ); + grid_4->setMargin( 0 ); + + grid_5 = new QGridLayout; + grid_5->setSpacing( 6 ); + grid_5->setMargin( 0 ); + + LineEditMax = new QLineEdit( this, "LineEditMax" ); + + grid_5->addWidget( LineEditMax, 0, 0 ); + + LineEditMin = new QLineEdit( this, "LineEditMin" ); + + grid_5->addWidget( LineEditMin, 1, 0 ); + + grid_4->addLayout( grid_5, 0, 1 ); + + grid_6 = new QGridLayout; + grid_6->setSpacing( 6 ); + grid_6->setMargin( 0 ); + + TextLabelMax = new QLabel( this, "TextLabelMax" ); + TextLabelMax->setText( tr( "SMESH_MAX" ) ); + + grid_6->addWidget( TextLabelMax, 0, 0 ); + + TextLabelMin = new QLabel( this, "TextLabelMin" ); + TextLabelMin->setText( tr( "SMESH_MIN" ) ); + + grid_6->addWidget( TextLabelMin, 1, 0 ); + + grid_4->addLayout( grid_6, 0, 0 ); + + grid_3->addLayout( grid_4, 0, 0 ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + + grid_3->addWidget( Line1, 1, 0 ); + + grid_2->addLayout( grid_3, 0, 0 ); + + grid->addLayout( grid_2, 0, 0 ); + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + if ( mySMESHGUI && mySMESHGUI->GetScalarBar() && mySMESHGUI->GetScalarBar()->GetLookupTable() ) { + float *range = mySMESHGUI->GetScalarBar()->GetLookupTable()->GetRange(); + LineEditMin->setText( QString("%1").arg(range[0]) ); + LineEditMax->setText( QString("%1").arg(range[1]) ); + } + + // signals and slots connections + connect( PushButtonUpdateView, SIGNAL( clicked() ), this, SLOT( updateView() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( reject() ) ) ; +} + +/* + * Destroys the object and frees any allocated resources + */ +SMESHGUI_EditScalarBarDlg::~SMESHGUI_EditScalarBarDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +void SMESHGUI_EditScalarBarDlg::updateView() +{ + float MinRange = LineEditMin->text().toFloat(); + float MaxRange = LineEditMax->text().toFloat(); + mySMESHGUI->UpdateScalarBar(MinRange,MaxRange); +} diff --git a/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h new file mode 100644 index 000000000..d95406d7b --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_EditScalarBarDlg.h @@ -0,0 +1,54 @@ +// File : SMESHGUI_EditScalarBarDlg.h +// Created : Wed Jun 12 12:01:39 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef SMESHGUI_EDITSCALARBARDLG_H +#define SMESHGUI_EDITSCALARBARDLG_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QLineEdit; +class QPushButton; + +class SMESHGUI; + +class SMESHGUI_EditScalarBarDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_EditScalarBarDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_EditScalarBarDlg(); + + QPushButton* PushButtonUpdateView; + QLineEdit* LineEditMax; + QLineEdit* LineEditMin; + QLabel* TextLabelMax; + QLabel* TextLabelMin; + QFrame* Line1; + + SMESHGUI *mySMESHGUI; + +public slots: + void updateView(); + +protected: + QGridLayout* grid; + QGridLayout* grid_2; + QGridLayout* grid_3; + QGridLayout* grid_4; + QGridLayout* grid_5; + QGridLayout* grid_6; +}; + +#endif // SMESHGUI_EDITSCALARBARDLG_H diff --git a/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx new file mode 100644 index 000000000..f51fbf94a --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx @@ -0,0 +1,473 @@ +using namespace std; +// File : SMESHGUI_InitMeshDlg.cxx +// Created : Mon May 27 10:20:11 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_InitMeshDlg.h" +#include "SMESHGUI.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_InitMeshDlg() +// purpose : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_INIT_MESH"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + if ( !name ) + setName( "SMESHGUI_InitMeshDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_INIT_MESH" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_InitMeshDlgLayout = new QGridLayout( this ); + SMESHGUI_InitMeshDlgLayout->setSpacing( 6 ); + SMESHGUI_InitMeshDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_INIT" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image1 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_InitMeshDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_InitMeshDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_OBJECT_GEOM" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image0 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + TextLabel_NameMesh = new QLabel( GroupC1, "TextLabel_NameMesh" ); + TextLabel_NameMesh->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameMesh, 1, 0 ); + LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" ); + GroupC1Layout->addWidget( LineEdit_NameMesh, 1, 2 ); + + TextLabelC1A1Hyp = new QLabel( GroupC1, "TextLabelC1A1Hyp" ); + TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) ); + TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1Hyp, 2, 0 ); + SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" ); + SelectButtonC1A1Hyp->setText( tr( "" ) ); + SelectButtonC1A1Hyp->setPixmap( image0 ); + GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 2, 1 ); + LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" ); + LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) ); + GroupC1Layout->addWidget( LineEditC1A1Hyp, 2, 2 ); + + TextLabelC1A1Algo = new QLabel( GroupC1, "TextLabelC1A1Algo" ); + TextLabelC1A1Algo->setText( tr( "SMESH_OBJECT_ALGORITHM" ) ); + TextLabelC1A1Algo->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1Algo->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1Algo->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1Algo, 3, 0 ); + SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" ); + SelectButtonC1A1Algo->setText( tr( "" ) ); + SelectButtonC1A1Algo->setPixmap( image0 ); + GroupC1Layout->addWidget( SelectButtonC1A1Algo, 3, 1 ); + LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" ); + LineEditC1A1Algo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Algo->sizePolicy().hasHeightForWidth() ) ); + GroupC1Layout->addWidget( LineEditC1A1Algo, 3, 2 ); + + SMESHGUI_InitMeshDlgLayout->addWidget( GroupC1, 1, 0 ); + /***************************************************************/ + + Init(Sel) ; +} + + +//================================================================================= +// function : ~SMESHGUI_InitMeshDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_InitMeshDlg::~SMESHGUI_InitMeshDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::Init( SALOME_Selection* Sel ) +{ + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + myGeomFilter = new SALOME_TypeFilter( "GEOM" ); + myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM ); + myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS ); + + myNameMesh = "Mesh"; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( LineEdit_NameMesh, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( SelectButtonC1A1Algo, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_InitMeshDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + MESSAGE ( " myNameMesh " << myNameMesh.isEmpty() ) + MESSAGE ( " myGeomShape " << myGeomShape->_is_nil() ) + if ( !myNameMesh.isEmpty() && !myNameMesh.isNull() && !myGeomShape->_is_nil() ) + myMesh = mySMESHGUI->InitMesh( myGeomShape, myNameMesh ) ; + + MESSAGE ( " myMesh " << myMesh->_is_nil() ) + MESSAGE ( " myOkHypothesis " ) + MESSAGE ( " myOkAlgorithm " ) + if( myOkHypothesis && !myMesh->_is_nil() ) { + SALOME_ListIteratorOfListIO It( HypoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddHypothesisOnMesh(myMesh, myHypothesis) ; + } + } + + if( myOkAlgorithm && !myMesh->_is_nil() ) { + SALOME_ListIteratorOfListIO It( AlgoList ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean testResult; + myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; + if( testResult ) + mySMESHGUI->AddAlgorithmOnMesh(myMesh, myAlgorithm) ; + } + } + break ; + } + } +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::ClickOnCancel() +{ + mySelection->ClearFilters() ; + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_InitMeshDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + QString aString = ""; + int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + if ( myEditCurrentArgument == LineEditC1A1 ) { + if ( nbSel != 1 ) { + myOkHypothesis = false; + myOkAlgorithm = false; + myGeomShape = GEOM::GEOM_Shape::_nil(); + return ; + } else { + Standard_Boolean testResult ; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ; + if( !testResult ) { + myOkHypothesis = false; + myOkAlgorithm = false; + return ; + } + } + } + else if ( myEditCurrentArgument == LineEditC1A1Hyp ) { + if ( nbSel >= 1 ) { + HypoList.Clear(); + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + HypoList.Append(Itinit.Value()); + } + myOkHypothesis = true ; + if (nbSel > 1) + aString = tr("%1 Hypothesis").arg(nbSel) ; + LineEditC1A1Hyp->setText(aString) ; + } + else { + myOkHypothesis = false ; + return ; + } + } else if ( myEditCurrentArgument == LineEditC1A1Algo ) { + if ( nbSel >= 1 ) { + AlgoList.Clear(); + SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() ); + for (; Itinit.More(); Itinit.Next()) { + AlgoList.Append(Itinit.Value()); + } + myOkAlgorithm = true ; + if (nbSel > 1) + aString = tr("%1 Algorithms").arg(nbSel) ; + LineEditC1A1Algo->setText(aString) ; + } + else { + myOkAlgorithm = false ; + return ; + } + } + + myEditCurrentArgument->setText(aString) ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + mySelection->ClearFilters() ; + mySelection->AddFilter(myGeomFilter) ; + } else if( send == SelectButtonC1A1Hyp ) { + LineEditC1A1Hyp->setFocus() ; + myEditCurrentArgument = LineEditC1A1Hyp ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myHypothesisFilter) ; + } else if( send == SelectButtonC1A1Algo ) { + LineEditC1A1Algo->setFocus() ; + myEditCurrentArgument = LineEditC1A1Algo ; + mySelection->ClearFilters() ; + mySelection->AddFilter(myAlgorithmFilter) ; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + disconnect( mySelection, 0, this, 0 ); + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameMesh) { + myNameMesh = newText; + } + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_InitMeshDlg.h b/src/SMESHGUI/SMESHGUI_InitMeshDlg.h new file mode 100644 index 000000000..24ea166a5 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_InitMeshDlg.h @@ -0,0 +1,121 @@ +// File : SMESHGUI_InitMeshDlg.h +// Created : Mon May 27 10:23:17 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_INIT_MESH_H +#define DIALOGBOX_INIT_MESH_H + +#include "SALOME_Selection.h" +#include "SALOME_TypeFilter.hxx" +#include "SMESH_TypeFilter.hxx" + +// QT Includes +#include +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include CORBA_SERVER_HEADER(GEOM_Shape) +#include CORBA_SERVER_HEADER(SMESH_Gen) + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_InitMeshDlg +// purpose : +//================================================================================= +class SMESHGUI_InitMeshDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_InitMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_InitMeshDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + SALOME_Selection* mySelection ; + + GEOM::GEOM_Shape_var myGeomShape ; + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QString myNameMesh ; + + Handle(SALOME_TypeFilter) myGeomFilter; + Handle(SMESH_TypeFilter) myHypothesisFilter; + Handle(SMESH_TypeFilter) myAlgorithmFilter; + + SALOME_ListIO HypoList; + SALOME_ListIO AlgoList; + + bool myOkHypothesis; + bool myOkAlgorithm; + + SMESH::SMESH_Hypothesis_var myHypothesis; + SMESH::SMESH_Hypothesis_var myAlgorithm; + + SMESH::SMESH_Mesh_var myMesh; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabel_NameMesh ; + QLineEdit* LineEdit_NameMesh ; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QLabel* TextLabelC1A1Hyp; + QPushButton* SelectButtonC1A1Hyp; + QLineEdit* LineEditC1A1Hyp; + + QLabel* TextLabelC1A1Algo; + QPushButton* SelectButtonC1A1Algo; + QLineEdit* LineEditC1A1Algo; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + +protected: + QGridLayout* SMESHGUI_InitMeshDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_INIT_MESH_H diff --git a/src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx b/src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx new file mode 100644 index 000000000..c94f34dda --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_LocalLengthDlg.cxx @@ -0,0 +1,315 @@ +using namespace std; +// File : SMESHGUI_LocalLengthDlg.cxx +// Created : Mon May 27 11:38:27 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_LocalLengthDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : SMESHGUI_LocalLengthDlg() +// purpose : Constructs a SMESHGUI_LocalLengthDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_LocalLengthDlg::SMESHGUI_LocalLengthDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_LOCAL_LENGTH"))); + + if ( !name ) + setName( "SMESHGUI_LocalLengthDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_LOCAL_LENGTH_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_LocalLengthDlgLayout = new QGridLayout( this ); + SMESHGUI_LocalLengthDlgLayout->setSpacing( 6 ); + SMESHGUI_LocalLengthDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_LocalLengthDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_LOCAL_LENGTH_HYPOTHESIS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); + SMESHGUI_LocalLengthDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabel_Length = new QLabel(GroupC1 , "TextLabel_Length" ); + TextLabel_Length->setText( tr( "SMESH_LENGTH" ) ); + GroupC1Layout->addWidget( TextLabel_Length, 1, 0 ); + TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" ); + TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 ); + + SpinBox_Length = new SMESHGUI_SpinBox( GroupC1, "SpinBox_Length" ) ; + GroupC1Layout->addWidget( SpinBox_Length, 1, 1 ); + + LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" ); + GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); + GroupC1Layout->addItem( spacer1, 1, 3 ); + SMESHGUI_LocalLengthDlgLayout->addWidget(GroupC1 , 1, 0 ); + + /***************************************************************/ + + Init() ; +} + + +//================================================================================= +// function : ~SMESHGUI_LocalLengthDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_LocalLengthDlg::~SMESHGUI_LocalLengthDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::Init() +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEdit_NameHypothesis ; + + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 1.0 ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_Length->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; + SpinBox_Length->SetValue( 1.0 ) ; /* is myLength */ + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + LineEdit_NameHypothesis->setText("") ; + + myLength = 1.0 ; + myNameHypothesis = "" ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_LocalLengthDlg::ConstructorsClicked(int constructorId) +{ + return; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + myLength = SpinBox_Length->GetValue() ; + mySMESHGUI->CreateLocalLength( "LocalLength", myNameHypothesis, myLength ); + break ; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::ClickOnCancel() +{ + mySMESHGUI->ResetState() ; + reject() ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameHypothesis) { + myNameHypothesis = newText ; + } + return ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_LocalLengthDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_LocalLengthDlg.h b/src/SMESHGUI/SMESHGUI_LocalLengthDlg.h new file mode 100644 index 000000000..dddd00256 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_LocalLengthDlg.h @@ -0,0 +1,89 @@ +// File : SMESHGUI_LocalLengthDlg.h +// Created : Mon May 27 11:38:37 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_LOCAL_LENGTH_H +#define DIALOGBOX_LOCAL_LENGTH_H + +// QT Includes +#include +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; +class SMESHGUI_SpinBox; + + +//================================================================================= +// class : SMESHGUI_LocalLengthDlg +// purpose : +//================================================================================= +class SMESHGUI_LocalLengthDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_LocalLengthDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_LocalLengthDlg(); + +private: + + void Init() ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + + QString myNameHypothesis ; + double myLength ; + bool myOkNameHypothesis ; + bool myOkLength ; + + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupC1; + QLabel* TextLabel_NameHypothesis ; + QLabel* TextLabel_Length ; + QLineEdit* LineEdit_NameHypothesis ; + SMESHGUI_SpinBox* SpinBox_Length ; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + +protected: + QGridLayout* SMESHGUI_LocalLengthDlgLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupC1Layout; + QGridLayout* GroupC2Layout; +}; + +#endif // DIALOGBOX_LOCAL_LENGTH_H diff --git a/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx b/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx new file mode 100644 index 000000000..a95b5d1e0 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.cxx @@ -0,0 +1,315 @@ +using namespace std; +// File : SMESHGUI_MaxElementAreaDlg.cxx +// Created : Mon May 27 11:38:27 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_MaxElementAreaDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : SMESHGUI_MaxElementAreaDlg() +// purpose : Constructs a SMESHGUI_MaxElementAreaDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_MaxElementAreaDlg::SMESHGUI_MaxElementAreaDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_MAX_ELEMENT_AREA"))); + + if ( !name ) + setName( "SMESHGUI_MaxElementAreaDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_MAX_ELEMENT_AREA_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_MaxElementAreaDlgLayout = new QGridLayout( this ); + SMESHGUI_MaxElementAreaDlgLayout->setSpacing( 6 ); + SMESHGUI_MaxElementAreaDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_MaxElementAreaDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_MAX_ELEMENT_AREA_HYPOTHESIS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); + SMESHGUI_MaxElementAreaDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabel_MaxElementArea = new QLabel(GroupC1 , "TextLabel_MaxElementArea" ); + TextLabel_MaxElementArea->setText( tr( "SMESH_MAX_ELEMENT_AREA" ) ); + GroupC1Layout->addWidget( TextLabel_MaxElementArea, 1, 0 ); + TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" ); + TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 ); + + SpinBox_MaxElementArea = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementArea" ) ; + GroupC1Layout->addWidget( SpinBox_MaxElementArea, 1, 1 ); + + LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" ); + GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); + GroupC1Layout->addItem( spacer1, 1, 3 ); + SMESHGUI_MaxElementAreaDlgLayout->addWidget(GroupC1 , 1, 0 ); + + /***************************************************************/ + + Init() ; +} + + +//================================================================================= +// function : ~SMESHGUI_MaxElementAreaDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_MaxElementAreaDlg::~SMESHGUI_MaxElementAreaDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::Init() +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEdit_NameHypothesis ; + + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 1.0 ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_MaxElementArea->setPrecision( 10 ); + SpinBox_MaxElementArea->RangeStepAndValidator( 0.001, 999999.999, step, 3 ) ; + SpinBox_MaxElementArea->SetValue( 1.0 ) ; /* is myMaxElementArea */ + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + LineEdit_NameHypothesis->setText("") ; + myNameHypothesis = "" ; + myMaxElementArea = 1.0 ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::ConstructorsClicked(int constructorId) +{ + return; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + myMaxElementArea = SpinBox_MaxElementArea->GetValue() ; + mySMESHGUI->CreateMaxElementArea( "MaxElementArea", myNameHypothesis, myMaxElementArea ); + break ; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::ClickOnCancel() +{ + mySMESHGUI->ResetState() ; + reject() ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameHypothesis) { + myNameHypothesis = newText ; + } + return ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementAreaDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h b/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h new file mode 100644 index 000000000..6c9b4a33b --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MaxElementAreaDlg.h @@ -0,0 +1,89 @@ +// File : SMESHGUI_MaxElementAreaDlg.h +// Created : Mon May 27 11:38:37 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_MAX_ELEMENT_AREA_H +#define DIALOGBOX_MAX_ELEMENT_AREA_H + +// QT Includes +#include +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; +class SMESHGUI_SpinBox; + + +//================================================================================= +// class : SMESHGUI_MaxElementAreaDlg +// purpose : +//================================================================================= +class SMESHGUI_MaxElementAreaDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_MaxElementAreaDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_MaxElementAreaDlg(); + +private: + + void Init() ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + + QString myNameHypothesis ; + double myMaxElementArea ; + bool myOkNameHypothesis ; + bool myOkMaxElementArea ; + + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupC1; + QLabel* TextLabel_NameHypothesis ; + QLabel* TextLabel_MaxElementArea ; + QLineEdit* LineEdit_NameHypothesis ; + SMESHGUI_SpinBox* SpinBox_MaxElementArea ; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + +protected: + QGridLayout* SMESHGUI_MaxElementAreaDlgLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupC1Layout; + QGridLayout* GroupC2Layout; +}; + +#endif // DIALOGBOX_MAX_ELEMENT_AREA_H diff --git a/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx new file mode 100644 index 000000000..135e7cd81 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.cxx @@ -0,0 +1,319 @@ +using namespace std; +// File : SMESHGUI_MaxElementVolumeDlg.cxx +// Created : Wed Jun 12 21:17:51 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_MaxElementVolumeDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : SMESHGUI_MaxElementVolumeDlg() +// purpose : Constructs a SMESHGUI_MaxElementVolumeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_MaxElementVolumeDlg::SMESHGUI_MaxElementVolumeDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_MAX_ELEMENT_VOLUME"))); + + if ( !name ) + setName( "SMESHGUI_MaxElementVolumeDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_MAX_ELEMENT_VOLUME_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_MaxElementVolumeDlgLayout = new QGridLayout( this ); + SMESHGUI_MaxElementVolumeDlgLayout->setSpacing( 6 ); + SMESHGUI_MaxElementVolumeDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_MaxElementVolumeDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); + SMESHGUI_MaxElementVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabel_MaxElementVolume = new QLabel(GroupC1 , "TextLabel_MaxElementVolume" ); + TextLabel_MaxElementVolume->setText( tr( "SMESH_MAX_ELEMENT_VOLUME" ) ); + GroupC1Layout->addWidget( TextLabel_MaxElementVolume, 1, 0 ); + TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" ); + TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 ); + + // LineEdit_MaxElementVolume = new QLineEdit(GroupC1 , "LineEdit_MaxElementVolume" ); + // GroupC1Layout->addWidget( LineEdit_MaxElementVolume, 1, 1 ); + SpinBox_MaxElementVolume = new SMESHGUI_SpinBox( GroupC1, "SpinBox_MaxElementVolume" ) ; + GroupC1Layout->addWidget( SpinBox_MaxElementVolume, 1, 1 ); + + LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" ); + GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); + GroupC1Layout->addItem( spacer1, 1, 3 ); + SMESHGUI_MaxElementVolumeDlgLayout->addWidget(GroupC1 , 1, 0 ); + + /***************************************************************/ + + Init() ; +} + + +//================================================================================= +// function : ~SMESHGUI_MaxElementVolumeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_MaxElementVolumeDlg::~SMESHGUI_MaxElementVolumeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::Init() +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEdit_NameHypothesis ; + + + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 1.0 ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_MaxElementVolume->setPrecision( 10 ); + SpinBox_MaxElementVolume->RangeStepAndValidator( 0.001, 999999.999, step, 3 ) ; + SpinBox_MaxElementVolume->SetValue( 1.0 ) ; /* is myMaxElementVolume */ + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + LineEdit_NameHypothesis->setText("") ; + + myNameHypothesis = "" ; + myMaxElementVolume = 1.0 ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::ConstructorsClicked(int constructorId) +{ + return; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + myMaxElementVolume = SpinBox_MaxElementVolume->GetValue() ; + mySMESHGUI->CreateMaxElementVolume( "MaxElementVolume", myNameHypothesis, myMaxElementVolume ); + break ; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::ClickOnCancel() +{ + mySMESHGUI->ResetState() ; + reject() ; +} + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameHypothesis) { + myNameHypothesis = newText ; + } + return ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_MaxElementVolumeDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h b/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h new file mode 100644 index 000000000..582f5d5f9 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MaxElementVolumeDlg.h @@ -0,0 +1,89 @@ +// File : SMESHGUI_MaxElementVolumeDlg.h +// Created : Wed Jun 12 21:18:15 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_MAX_ELEMENT_VOLUME_H +#define DIALOGBOX_MAX_ELEMENT_VOLUME_H + +// QT Includes +#include +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; +class SMESHGUI_SpinBox; + + +//================================================================================= +// class : SMESHGUI_MaxElementVolumeDlg +// purpose : +//================================================================================= +class SMESHGUI_MaxElementVolumeDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_MaxElementVolumeDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_MaxElementVolumeDlg(); + +private: + + void Init() ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + + QString myNameHypothesis ; + double myMaxElementVolume ; + bool myOkNameHypothesis ; + bool myOkMaxElementVolume ; + + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupC1; + QLabel* TextLabel_NameHypothesis ; + QLabel* TextLabel_MaxElementVolume ; + QLineEdit* LineEdit_NameHypothesis ; + SMESHGUI_SpinBox* SpinBox_MaxElementVolume ; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + +protected: + QGridLayout* SMESHGUI_MaxElementVolumeDlgLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupC1Layout; + QGridLayout* GroupC2Layout; +}; + +#endif // DIALOGBOX_MAX_ELEMENT_VOLUME_H diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx new file mode 100644 index 000000000..ed5e38efe --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx @@ -0,0 +1,428 @@ +using namespace std; +// File : SMESHGUI_MeshInfosDlg.cxx +// Created : Sat Jun 08 15:31:16 2002 +// Author : Nicolas BARBEROU + +// Project : SALOME +// Module : SMESH +// Copyright : EADS CCR 2002 +// $Header$ + +#include "SMESHGUI_MeshInfosDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a SMESHGUI_MeshInfosDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + if ( !name ) + setName( "SMESHGUI_MeshInfosDlg" ); + setCaption( tr( "SMESH_MESHINFO_TITLE" ) ); + setSizeGripEnabled( TRUE ); + + SMESHGUI_MeshInfosDlgLayout = new QVBoxLayout( this ); + SMESHGUI_MeshInfosDlgLayout->setSpacing( 6 ); + SMESHGUI_MeshInfosDlgLayout->setMargin( 11 ); + + /****************************************************************/ + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( tr( "SMESH_MESHINFO_NB1D" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 0 ); + GroupBox1->layout()->setMargin( 0 ); + QGridLayout* GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + GroupBox1Layout->setSpacing( 6 ); + GroupBox1Layout->setMargin( 11 ); + + TextLabel11 = new QLabel( GroupBox1, "TextLabel11" ); + TextLabel11->setMinimumWidth( 100 ); + TextLabel11->setText( tr( "SMESH_MESHINFO_NODES" ) ); + GroupBox1Layout->addWidget( TextLabel11, 0, 0 ); + + TextLabel12 = new QLabel( GroupBox1, "TextLabel12" ); + TextLabel12->setMinimumWidth( 100 ); + TextLabel12->setText( tr( "SMESH_MESHINFO_EDGES" ) ); + GroupBox1Layout->addWidget( TextLabel12, 1, 0 ); + + TextLabel13 = new QLabel( GroupBox1, "TextLabel13" ); + TextLabel13->setMinimumWidth( 100 ); + GroupBox1Layout->addWidget( TextLabel13, 0, 1 ); + + TextLabel14 = new QLabel( GroupBox1, "TextLabel14" ); + TextLabel14->setMinimumWidth( 100 ); + GroupBox1Layout->addWidget( TextLabel14, 1, 1 ); + SMESHGUI_MeshInfosDlgLayout->addWidget( GroupBox1 ); + + /****************************************************************/ + GroupBox2 = new QGroupBox( this, "GroupBox2" ); + GroupBox2->setTitle( tr( "SMESH_MESHINFO_NB2D" ) ); + GroupBox2->setColumnLayout(0, Qt::Vertical ); + GroupBox2->layout()->setSpacing( 0 ); + GroupBox2->layout()->setMargin( 0 ); + QGridLayout* GroupBox2Layout = new QGridLayout( GroupBox2->layout() ); + GroupBox2Layout->setAlignment( Qt::AlignTop ); + GroupBox2Layout->setSpacing( 6 ); + GroupBox2Layout->setMargin( 11 ); + + TextLabel21 = new QLabel( GroupBox2, "TextLabel21" ); + TextLabel21->setMinimumWidth( 100 ); + TextLabel21->setText( tr( "SMESH_MESHINFO_TRIANGLES" ) ); + GroupBox2Layout->addWidget( TextLabel21, 0, 0 ); + + TextLabel22 = new QLabel( GroupBox2, "TextLabel22" ); + TextLabel22->setMinimumWidth( 100 ); + TextLabel22->setText( tr( "SMESH_MESHINFO_QUADRANGLES" ) ); + GroupBox2Layout->addWidget( TextLabel22, 1, 0 ); + + TextLabel23 = new QLabel( GroupBox2, "TextLabel23" ); + TextLabel23->setMinimumWidth( 100 ); + GroupBox2Layout->addWidget( TextLabel23, 0, 1 ); + + TextLabel24 = new QLabel( GroupBox2, "TextLabel24" ); + TextLabel24->setMinimumWidth( 100 ); + GroupBox2Layout->addWidget( TextLabel24, 1, 1 ); + SMESHGUI_MeshInfosDlgLayout->addWidget( GroupBox2 ); + + /****************************************************************/ + GroupBox3 = new QGroupBox( this, "GroupBox3" ); + GroupBox3->setTitle( tr( "SMESH_MESHINFO_NB3D" ) ); + GroupBox3->setColumnLayout(0, Qt::Vertical ); + GroupBox3->layout()->setSpacing( 0 ); + GroupBox3->layout()->setMargin( 0 ); + QGridLayout* GroupBox3Layout = new QGridLayout( GroupBox3->layout() ); + GroupBox3Layout->setAlignment( Qt::AlignTop ); + GroupBox3Layout->setSpacing( 6 ); + GroupBox3Layout->setMargin( 11 ); + + TextLabel31 = new QLabel( GroupBox3, "TextLabel31" ); + TextLabel31->setMinimumWidth( 100 ); + TextLabel31->setText( tr( "SMESH_MESHINFO_TETRAS" ) ); + GroupBox3Layout->addWidget( TextLabel31, 0, 0 ); + + TextLabel32 = new QLabel( GroupBox3, "TextLabel32" ); + TextLabel32->setMinimumWidth( 100 ); + TextLabel32->setText( tr( "SMESH_MESHINFO_HEXAS" ) ); + GroupBox3Layout->addWidget( TextLabel32, 1, 0 ); + + TextLabel33 = new QLabel( GroupBox3, "TextLabel33" ); + TextLabel33->setMinimumWidth( 100 ); + GroupBox3Layout->addWidget( TextLabel33, 0, 1 ); + + TextLabel34 = new QLabel( GroupBox3, "TextLabel34" ); + TextLabel34->setMinimumWidth( 100 ); + GroupBox3Layout->addWidget( TextLabel34, 1, 1 ); + SMESHGUI_MeshInfosDlgLayout->addWidget( GroupBox3 ); + + /****************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 0 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 ); + SMESHGUI_MeshInfosDlgLayout->addWidget( GroupButtons ); + /****************************************************************/ + + Init( Sel ) ; +} + +/* + * Destroys the object and frees any allocated resources + */ +SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::Init( SALOME_Selection* Sel ) +{ + mySelection = Sel ; + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + myStudy = mySMESHGUI->GetActiveStudy()->getStudyDocument(); + + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "SMESH"); + myCompMesh = SMESH::SMESH_Gen::_narrow(comp); + + int nbSel = mySelection->IObjectCount(); + + TextLabel13->setText( "0" ); + TextLabel14->setText( "0" ); + TextLabel23->setText( "0" ); + TextLabel24->setText( "0" ); + TextLabel33->setText( "0" ); + TextLabel34->setText( "0" ); + + //gets the selected mesh + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject(); + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( IObject, res ); + if ( res ) + DumpMeshInfos(); + } + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* Displays Dialog */ + + return ; +} + +//================================================================================= +// function : genEdgeKey +// purpose : edge counting helper; +// packs two long integers into one 8-byte value (treated as double by the caller); +// the order of arguments is insignificant +//================================================================================= +void genEdgeKey(long a, long b, void* key) +{ + long* lKey = (long*)key; + *lKey = (a < b) ? a : b; + *(++lKey) = (a < b) ? b : a; +} + +//================================================================================= +// function : DumpMeshInfos() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::DumpMeshInfos() +{ + int nbOfNodes = myMesh->NbNodes(); + int nbOfEdges = myMesh->NbEdges(); + int nbOfTriangles = myMesh->NbTriangles(); + int nbOfQuadrangles = myMesh->NbQuadrangles(); + int nbOfTetras = myMesh->NbTetras(); + int nbOfHexas = myMesh->NbHexas(); + + /* + int nbOfNodes = 0 ; + int nbOfEdges = 0 ; + int nbOfTriangles = 0 ; + int nbOfQuadrangles = 0 ; + int nbOfTetras = 0 ; + int nbOfHexas = 0 ; + int nbCells = 0 ; + int CellType = 0 ; + QMap aMapOfEdges; + + Standard_Boolean result; + SMESH_Actor* MeshActor = mySMESHGUI->FindActor(myMesh, result, true); + + if ( result ) { + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( MeshActor->DataSource ); + vtkPoints *Pts = ugrid->GetPoints(); + nbOfNodes = Pts->GetNumberOfPoints(); + int nbCells = ugrid->GetNumberOfCells(); + + for ( int i = 0; i < nbCells; i++ ) { + vtkCell* cellPtr = ugrid->GetCell(i); + CellType = cellPtr->GetCellType(); + switch (CellType) + { + case 3: //Edges + { + nbOfEdges++; + break; + } + case 5: //Triangles + { + nbOfTriangles++; + + for (int edgeNum = 0; edgeNum < 3; edgeNum++) { + vtkCell* edgePtr = cellPtr->GetEdge(edgeNum); + double anEdgeKey; + genEdgeKey(edgePtr->GetPointId(0), edgePtr->GetPointId(1), &anEdgeKey); + if (!aMapOfEdges.contains(anEdgeKey)) { + nbOfEdges++; + aMapOfEdges.insert(anEdgeKey, 0); + } + } + break; + } + case 9: //Quadrangles + { + nbOfQuadrangles++; + + for (int edgeNum = 0; edgeNum < 4; edgeNum++) { + vtkCell* edgePtr = cellPtr->GetEdge(edgeNum); + double anEdgeKey; + genEdgeKey(edgePtr->GetPointId(0), edgePtr->GetPointId(1), &anEdgeKey); + if (!aMapOfEdges.contains(anEdgeKey)) { + nbOfEdges++; + aMapOfEdges.insert(anEdgeKey, 0); + } + } + break; + } + case 10: //Tetraedras + { + nbOfTetras++; + + for (int edgeNum = 0; edgeNum < 6; edgeNum++) { + vtkCell* edgePtr = cellPtr->GetEdge(edgeNum); + double anEdgeKey; + genEdgeKey(edgePtr->GetPointId(0), edgePtr->GetPointId(1), &anEdgeKey); + if (!aMapOfEdges.contains(anEdgeKey)) { + nbOfEdges++; + aMapOfEdges.insert(anEdgeKey, 0); + } + } + break; + } + case 12: //Hexahedras + { + nbOfHexas++; + + for (int edgeNum = 0; edgeNum < 12; edgeNum++) { + vtkCell* edgePtr = cellPtr->GetEdge(edgeNum); + double anEdgeKey; + genEdgeKey(edgePtr->GetPointId(0), edgePtr->GetPointId(1), &anEdgeKey); + if (!aMapOfEdges.contains(anEdgeKey)) { + nbOfEdges++; + aMapOfEdges.insert(anEdgeKey, 0); + } + } + break; + } + } + } + } + */ + TextLabel13->setText( tr( "%1" ).arg(nbOfNodes) ); + TextLabel14->setText( tr( "%1" ).arg(nbOfEdges) ); + TextLabel23->setText( tr( "%1" ).arg(nbOfTriangles) ); + TextLabel24->setText( tr( "%1" ).arg(nbOfQuadrangles) ); + TextLabel33->setText( tr( "%1" ).arg(nbOfTetras) ); + TextLabel34->setText( tr( "%1" ).arg(nbOfHexas) ); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::ClickOnOk() +{ + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void SMESHGUI_MeshInfosDlg::SelectionIntoArgument() +{ + TextLabel13->setText( "0" ); + TextLabel14->setText( "0" ); + TextLabel23->setText( "0" ); + TextLabel24->setText( "0" ); + TextLabel33->setText( "0" ); + TextLabel34->setText( "0" ); + + int nbSel = mySelection->IObjectCount(); + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject(); + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( IObject, res ); + if ( res ) + DumpMeshInfos(); + } + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::closeEvent( QCloseEvent* e ) +{ + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void SMESHGUI_MeshInfosDlg::enterEvent( QEvent * ) +{ + ActivateThisDialog() ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog() +{ + disconnect( mySelection, 0, this, 0 ); + + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_MeshInfosDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate any active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + + return ; +} + diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h new file mode 100644 index 000000000..e2a352678 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h @@ -0,0 +1,83 @@ +// File : SMESHGUI_MeshInfosDlg.h +// Created : Sat Jun 08 15:31:16 2002 +// Author : Nicolas BARBEROU + +// Project : SALOME +// Module : SMESH +// Copyright : EADS CCR 2002 2002 +// $Header$ + +#ifndef SMESHGUI_MESHINFOSDLG_H +#define SMESHGUI_MESHINFOSDLG_H + +#include "SALOME_Selection.h" +#include "QAD_Study.h" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +// QT Includes +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class SMESHGUI; + +class SMESHGUI_MeshInfosDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_MeshInfosDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_MeshInfosDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + void DumpMeshInfos(); + + SMESH::SMESH_Gen_var myCompMesh ; + SMESHGUI* mySMESHGUI ; + SMESH::SMESH_Mesh_var myMesh ; + SALOME_Selection* mySelection ; + SALOMEDS::Study_var myStudy; + + QGroupBox* GroupBox1; + QLabel* TextLabel12; + QLabel* TextLabel11; + QLabel* TextLabel13; + QLabel* TextLabel14; + QGroupBox* GroupBox2; + QLabel* TextLabel21; + QLabel* TextLabel22; + QLabel* TextLabel23; + QLabel* TextLabel24; + QGroupBox* GroupBox3; + QLabel* TextLabel31; + QLabel* TextLabel32; + QLabel* TextLabel33; + QLabel* TextLabel34; + QPushButton* buttonOk; + +private slots: + + void ClickOnOk(); + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QVBoxLayout* SMESHGUI_MeshInfosDlgLayout; + QHBoxLayout* Layout1; + +}; + +#endif // SMESHGUI_MESHINFOSDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx new file mode 100644 index 000000000..8c2c18f22 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -0,0 +1,467 @@ +using namespace std; +// File : SMESHGUI_MoveNodesDlg.cxx +// Created : Thu Jun 20 22:30:09 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_MoveNodesDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Open CASCADE Include +#include + +// VTK Include +#include + +//================================================================================= +// class : SMESHGUI_MoveNodesDlg() +// purpose : +//================================================================================= +SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_MOVE_NODE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_MoveNodesDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_MOVE_NODES_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_MoveNodesDlgLayout = new QGridLayout( this ); + SMESHGUI_MoveNodesDlgLayout->setSpacing( 6 ); + SMESHGUI_MoveNodesDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_NODES" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_MoveNodesDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_MoveNodesDlgLayout->addWidget( GroupButtons, 3, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_MOVE" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + + SMESHGUI_MoveNodesDlgLayout->addWidget( GroupC1, 1, 0 ); + + /***************************************************************/ + GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); + GroupCoordinates->setTitle( tr( "SMESH_COORDINATES" ) ); + GroupCoordinates->setColumnLayout(0, Qt::Vertical ); + GroupCoordinates->layout()->setSpacing( 0 ); + GroupCoordinates->layout()->setMargin( 0 ); + GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); + GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); + GroupCoordinatesLayout->setSpacing( 6 ); + GroupCoordinatesLayout->setMargin( 11 ); + TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" ); + TextLabel_X->setText( tr( "SMESH_X" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 ); + TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" ); + TextLabel_Y->setText( tr( "SMESH_Y" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 ); + + SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_X" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 ); + + SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Y" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 ); + + SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Z" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 ); + + + TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" ); + TextLabel_Z->setText( tr( "SMESH_Z" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 ); + + SMESHGUI_MoveNodesDlgLayout->addWidget( GroupCoordinates, 2, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_MoveNodesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::Init( SALOME_Selection* Sel ) +{ + + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 25.0 ; + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkNodes = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_X->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_Y->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_Z->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_X->SetValue( 0.0 ) ; + SpinBox_Y->SetValue( 0.0 ) ; + SpinBox_Z->SetValue( 0.0 ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_MoveNodesDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkNodes) { + mySMESHGUI->EraseSimulationActors(); +// mySMESHGUI->MoveNode( myMesh, myIdnode, LineEdit_X->text().toFloat(), LineEdit_Y->text().toFloat(), LineEdit_Z->text().toFloat() ) ; +// mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_MoveNodesDlg::SelectionIntoArgument() +{ + + disconnect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + disconnect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + disconnect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + + mySMESHGUI->EraseSimulationActors(); + + myEditCurrentArgument->setText("") ; + myOkNodes = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return ; + + int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes != 1) { + SpinBox_X->SetValue(0.0) ; + SpinBox_Y->SetValue(0.0) ; + SpinBox_Z->SetValue(0.0) ; + return ; + } + + if ( mySelection->SelectionMode() != 1 ){ + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + SMESH_Actor* ac = mySMESHGUI->FindActorByEntry( mySelection->firstIObject()->getEntry(), res, false ); + if ( !res ) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + + TColStd_MapIteratorOfMapOfInteger ite( myMapIndex ); + if ( ite.More() ) { + myIdnode = ite.Key(); + mySimulationActor = mySMESHGUI->SimulationMoveNode( ac, myIdnode ); + } else + return ; + + MESSAGE ( " myIdnode " << myIdnode ); + + float *pt = ac->GetMapper()->GetInput()->GetPoint(myIdnode); + MESSAGE ( " pt " << pt[0] << ";" << pt[1] << ";" << pt[2] ) + + SpinBox_X->SetValue( (double)pt[0] ) ; + SpinBox_Y->SetValue( (double)pt[1] ) ; + SpinBox_Z->SetValue( (double)pt[2] ) ; + + connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + + myOkNodes = true ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + mySMESHGUI->EraseSimulationActors() ; + mySMESHGUI->ResetState() ; + mySMESHGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void SMESHGUI_MoveNodesDlg::ValueChangedInSpinBox( double newValue ) +{ + double vx = SpinBox_X->GetValue() ; + double vy = SpinBox_Y->GetValue() ; + double vz = SpinBox_Z->GetValue() ; + + mySMESHGUI->DisplaySimulationMoveNode( mySimulationActor, myIdnode, vx, vy , vz ); +} diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h new file mode 100644 index 000000000..d1c733138 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h @@ -0,0 +1,111 @@ +// File : SMESHGUI_MoveNodesDlg.h +// Created : Thu Jun 20 22:30:22 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_MOVE_NODES_H +#define DIALOGBOX_MOVE_NODES_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; +class SMESHGUI_SpinBox; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +// VTK Include +#include + +//================================================================================= +// class : SMESHGUI_MoveNodesDlg +// purpose : +//================================================================================= +class SMESHGUI_MoveNodesDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_MoveNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_MoveNodesDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkNodes ; /* to check when arguments is defined */ + int myConstructorId ; /* Current constructor id = radio button id */ + int myIdnode; + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + vtkActor *mySimulationActor; + + QGroupBox* GroupCoordinates; + QLabel* TextLabel_X; + QLabel* TextLabel_Y; + QLabel* TextLabel_Z; + SMESHGUI_SpinBox* SpinBox_X; + SMESHGUI_SpinBox* SpinBox_Y; + SMESHGUI_SpinBox* SpinBox_Z; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void ValueChangedInSpinBox( double newValue ) ; + +protected: + QGridLayout* SMESHGUI_MoveNodesDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; + QGridLayout* GroupCoordinatesLayout; +}; + +#endif // DIALOGBOX_MOVE_NODES_H diff --git a/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx b/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx new file mode 100644 index 000000000..aa6826383 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.cxx @@ -0,0 +1,310 @@ +using namespace std; +// File : SMESHGUI_NbSegmentsDlg.cxx +// Created : Mon May 27 11:38:27 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_NbSegmentsDlg.h" +#include "SMESHGUI.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : SMESHGUI_NbSegmentsDlg() +// purpose : Constructs a SMESHGUI_NbSegmentsDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +SMESHGUI_NbSegmentsDlg::SMESHGUI_NbSegmentsDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_NB_SEGMENTS"))); + + if ( !name ) + setName( "SMESHGUI_NbSegmentsDlg" ); + resize( 303, 175 ); + setCaption( tr( "SMESH_NB_SEGMENTS_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_NbSegmentsDlgLayout = new QGridLayout( this ); + SMESHGUI_NbSegmentsDlgLayout->setSpacing( 6 ); + SMESHGUI_NbSegmentsDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_NbSegmentsDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_NB_SEGMENTS_HYPOTHESIS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); + SMESHGUI_NbSegmentsDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabel_NbSeg = new QLabel(GroupC1 , "TextLabel_NbSeg" ); + TextLabel_NbSeg->setText( tr( "SMESH_SEGMENTS" ) ); + GroupC1Layout->addWidget( TextLabel_NbSeg, 1, 0 ); + TextLabel_NameHypothesis = new QLabel( GroupC1, "TextLabel_NameHypothesis" ); + TextLabel_NameHypothesis->setText( tr( "SMESH_NAME" ) ); + GroupC1Layout->addWidget( TextLabel_NameHypothesis, 0, 0 ); + + SpinBox_NbSeg = new QSpinBox( GroupC1, "SpinBox_NbSeg" ); + GroupC1Layout->addWidget( SpinBox_NbSeg, 1, 1 ); + + LineEdit_NameHypothesis = new QLineEdit( GroupC1, "LineEdit_NameHypothesis" ); + GroupC1Layout->addWidget( LineEdit_NameHypothesis, 0, 1 ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); + GroupC1Layout->addItem( spacer1, 1, 3 ); + SMESHGUI_NbSegmentsDlgLayout->addWidget(GroupC1 , 1, 0 ); + + /***************************************************************/ + + Init() ; +} + + +//================================================================================= +// function : ~SMESHGUI_NbSegmentsDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_NbSegmentsDlg::~SMESHGUI_NbSegmentsDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::Init() +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEdit_NameHypothesis ; + + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + LineEdit_NameHypothesis->setText("") ; + + SpinBox_NbSeg->setMinValue( 1 ); + SpinBox_NbSeg->setMaxValue( 9999 ); + SpinBox_NbSeg->setValue(3) ; /* myNbSeg */ + + myNbSeg = 3.0 ; + myNameHypothesis = "" ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( LineEdit_NameHypothesis, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_NbSegmentsDlg::ConstructorsClicked(int constructorId) +{ + return; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + myNbSeg = SpinBox_NbSeg->value() ; + mySMESHGUI->CreateNbSegments( "NumberOfSegments", myNameHypothesis, myNbSeg ); + break ; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::ClickOnCancel() +{ + mySMESHGUI->ResetState() ; + reject() ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } +} + + +//================================================================================= +// function : TextChangedInLineEdit() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::TextChangedInLineEdit(const QString& newText) +{ + QLineEdit* send = (QLineEdit*)sender(); + QString newT = strdup(newText) ; + + if (send == LineEdit_NameHypothesis) { + myNameHypothesis = newText ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::ActivateThisDialog() +{ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_NbSegmentsDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h b/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h new file mode 100644 index 000000000..4ceedc2b4 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_NbSegmentsDlg.h @@ -0,0 +1,89 @@ +// File : SMESHGUI_NbSegmentsDlg.h +// Created : Mon May 27 11:38:37 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_NB_SEGMENTS_H +#define DIALOGBOX_NB_SEGMENTS_H + +// QT Includes +#include +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QSpinBox; +class QPushButton; +class QRadioButton; +class SMESHGUI; + + +//================================================================================= +// class : SMESHGUI_NbSegmentsDlg +// purpose : +//================================================================================= +class SMESHGUI_NbSegmentsDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_NbSegmentsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_NbSegmentsDlg(); + +private: + + void Init() ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; + + SMESHGUI* mySMESHGUI ; + + QString myNameHypothesis ; + double myNbSeg ; + bool myOkNameHypothesis ; + QDoubleValidator *myVa ; + + int myConstructorId ; + QLineEdit* myEditCurrentArgument; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupC1; + QLabel* TextLabel_NameHypothesis ; + QLabel* TextLabel_NbSeg ; + QLineEdit* LineEdit_NameHypothesis ; + QSpinBox* SpinBox_NbSeg ; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void DeactivateActiveDialog() ; + void TextChangedInLineEdit(const QString& newText) ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_NbSegmentsDlgLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupC1Layout; + QGridLayout* GroupC2Layout; +}; + +#endif // DIALOGBOX_NB_SEGMENTS_H diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx new file mode 100644 index 000000000..e8121447e --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -0,0 +1,397 @@ +using namespace std; +// File : SMESHGUI_NodesDlg.cxx +// Created : Tue May 14 21:35:46 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_NodesDlg.h" +#include "SMESHGUI.h" +#include "SMESHGUI_SpinBox.h" + +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "utilities.h" +#include "QAD_MessageBox.h" + +#include "SMESH_Actor.h" +#include +#include + +// VTK Includes +#include +#include +#include +#include +#include +#include + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_NodesDlg() +// purpose : +//================================================================================= +SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( QWidget* parent, + const char* name, + SALOME_Selection* Sel, + bool modal, + WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_NODE"))); + if ( !name ) + setName( "SMESHGUI_NodesDlg" ); + resize( 303, 185 ); + setCaption( tr( "MESH_NODE_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_NodesDlgLayout = new QGridLayout( this ); + SMESHGUI_NodesDlgLayout->setSpacing( 6 ); + SMESHGUI_NodesDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_NodesDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "MESH_NODE" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); + SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); + GroupCoordinates->setTitle( tr( "SMESH_COORDINATES" ) ); + GroupCoordinates->setColumnLayout(0, Qt::Vertical ); + GroupCoordinates->layout()->setSpacing( 0 ); + GroupCoordinates->layout()->setMargin( 0 ); + GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); + GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); + GroupCoordinatesLayout->setSpacing( 6 ); + GroupCoordinatesLayout->setMargin( 11 ); + TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" ); + TextLabel_X->setText( tr( "SMESH_X" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 ); + TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" ); + TextLabel_Y->setText( tr( "SMESH_Y" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 ); + + TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" ); + TextLabel_Z->setText( tr( "SMESH_Z" ) ); + GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 ); + + SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_X" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 ); + + SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Y" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 ); + + SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates, "SpinBox_Z" ) ; + GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 ); + + SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates, 1, 0 ); + + /* Initialisation and display */ + Init(Sel) ; +} + + +//======================================================================= +// function : ~SMESHGUI_NodesDlg() +// purpose : Destructor +//======================================================================= +SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg() +{} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::Init(SALOME_Selection* Sel) +{ + /* Get setting of step value from file configuration */ + double step ; + // QString St = QAD_CONFIG->getSetting( "xxxxxxxxxxxxx" ) ; TODO + // step = St.toDouble() ; TODO + step = 25.0 ; + + /* min, max, step and decimals for spin boxes */ + SpinBox_X->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_Y->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_Z->RangeStepAndValidator( -999.999, +999.999, step, 3 ) ; + SpinBox_X->SetValue( 0.0 ) ; + SpinBox_Y->SetValue( 0.0 ) ; + SpinBox_Z->SetValue( 0.0 ) ; + + mySelection = Sel ; + myMeshGUI = SMESHGUI::GetSMESHGUI() ; + myMeshGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + + connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( myMeshGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + /* to close dialog if study change */ + connect( myMeshGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + myMeshGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; + + SelectionIntoArgument(); +} + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue ) +{ + double vx = SpinBox_X->GetValue() ; + double vy = SpinBox_Y->GetValue() ; + double vz = SpinBox_Z->GetValue() ; + myMeshGUI->DisplaySimulationNode( myMesh, vx, vy, vz ); + //myMeshGUI->ViewNodes(); + + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//======================================================================= +// function : ClickOnApply() +// purpose : +//======================================================================= +void SMESHGUI_NodesDlg::ClickOnApply() +{ + if ( myMeshGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) { + return; + } + + if ( Constructor1->isChecked() ) { + /* Recup args and call method */ + double x = SpinBox_X->GetValue() ; + double y = SpinBox_Y->GetValue() ; + double z = SpinBox_Z->GetValue() ; + myMeshGUI->EraseSimulationActors() ; + myMeshGUI->AddNode( myMesh, x, y, z ) ; + myMeshGUI->ViewNodes(); + mySelection->ClearIObjects(); + } +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void SMESHGUI_NodesDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + myMeshGUI->ResetState() ; + myMeshGUI->EraseSimulationActors() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_NodesDlg::SelectionIntoArgument() +{ + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) { + SpinBox_X->SetValue(0.0) ; + SpinBox_Y->SetValue(0.0) ; + SpinBox_Z->SetValue(0.0) ; + return; + } + + Standard_Boolean res; + myMesh = myMeshGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) { + SpinBox_X->SetValue(0.0) ; + SpinBox_Y->SetValue(0.0) ; + SpinBox_Z->SetValue(0.0) ; + return ; + } + + if ( mySelection->SelectionMode() != 1 ) { + SpinBox_X->SetValue(0.0) ; + SpinBox_Y->SetValue(0.0) ; + SpinBox_Z->SetValue(0.0) ; + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + QString aString = ""; + int nbNodes = myMeshGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes != 1) { + SpinBox_X->SetValue(0.0) ; + SpinBox_Y->SetValue(0.0) ; + SpinBox_Z->SetValue(0.0) ; + return ; + } + + if ( nbNodes == 1 ) { + TColStd_MapOfInteger myMapIndex; + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + TColStd_MapIteratorOfMapOfInteger ite( myMapIndex ); + int idNodes[1]; + for ( ; ite.More(); ite.Next() ) { + idNodes[0] = ite.Key(); + } + + Standard_Boolean result; + SMESH_Actor* ac = myMeshGUI->FindActor( myMesh, result, true ); + vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast( ac->DataSource ); + float *p0 = ugrid->GetPoint(idNodes[0]); + + SpinBox_X->SetValue( p0[0] ) ; + SpinBox_Y->SetValue( p0[1] ) ; + SpinBox_Z->SetValue( p0[2] ) ; + + myMeshGUI->DisplaySimulationNode( myMesh, p0[0], p0[1], p0[2] ); + // myMeshGUI->ViewNodes(); + } + + return ; +} + + +//======================================================================= +// function : closeEvent() +// purpose : +//======================================================================= +void SMESHGUI_NodesDlg::closeEvent(QCloseEvent* e) +{ + this->ClickOnCancel() ; /* same than click on cancel button */ + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : to reactivate this dialog box when mouse enter onto the window +//================================================================================= +void SMESHGUI_NodesDlg::enterEvent( QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void SMESHGUI_NodesDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupCoordinates->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + myMeshGUI->EraseSimulationActors() ; + myMeshGUI->ResetState() ; + myMeshGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_NodesDlg::ActivateThisDialog( ) +{ + myMeshGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupCoordinates->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h new file mode 100644 index 000000000..ee70b7a80 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -0,0 +1,96 @@ +// File : SMESHGUI_NodesDlg.h +// Created : Tue May 14 21:36:44 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_NODES_H +#define DIALOGBOX_NODES_H + +#include "SALOME_Selection.h" + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QFrame; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; +class SMESHGUI_SpinBox; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_NodesDlg +// purpose : +//================================================================================= +class SMESHGUI_NodesDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_NodesDlg( QWidget* parent = 0, const char* name = 0, + SALOME_Selection* Sel = 0, + bool modal = FALSE, + WFlags fl = 0 ); + + ~SMESHGUI_NodesDlg(); + +private : + + SALOME_Selection* mySelection ; + SMESHGUI* myMeshGUI ; + + SMESH::SMESH_Mesh_var myMesh; + + void Init(SALOME_Selection* Sel) ; + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e) ; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupCoordinates; + SMESHGUI_SpinBox* SpinBox_X; + SMESHGUI_SpinBox* SpinBox_Y; + SMESHGUI_SpinBox* SpinBox_Z; + + QLabel* TextLabel_X; + QLabel* TextLabel_Y; + QLabel* TextLabel_Z; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + +private slots: + + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + void SelectionIntoArgument() ; + void ValueChangedInSpinBox( double newValue ) ; + +protected: + QGridLayout* SMESHGUI_NodesDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupCoordinatesLayout; + QGridLayout* GroupButtonsLayout; +}; + +#endif // DIALOGBOX_NODES_H + diff --git a/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.cxx new file mode 100644 index 000000000..a08361407 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.cxx @@ -0,0 +1,354 @@ +using namespace std; +// File : SMESHGUI_OrientationElementsDlg.cxx +// Created : Tue Jun 25 14:28:17 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_OrientationElementsDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_OrientationElementsDlg() +// purpose : +//================================================================================= +SMESHGUI_OrientationElementsDlg::SMESHGUI_OrientationElementsDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_MESH_ORIENTATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_OrientationElementsDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_ORIENTATION_ELEMENTS_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_OrientationElementsDlgLayout = new QGridLayout( this ); + SMESHGUI_OrientationElementsDlgLayout->setSpacing( 6 ); + SMESHGUI_OrientationElementsDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_ELEMENTS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_ORIENTATION" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_ELEMENTS" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + SMESHGUI_OrientationElementsDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_OrientationElementsDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_OrientationElementsDlg::~SMESHGUI_OrientationElementsDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkElements = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_OrientationElementsDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkElements) { + mySMESHGUI->OrientationElements( myMesh, myMapIndex ) ; + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_OrientationElementsDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkElements = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbElements = mySMESHGUI->GetNameOfSelectedElements(mySelection, aString) ; + if(nbElements < 1) + return ; + + if ( mySelection->SelectionMode() != 3 ) { + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_ELEMENTS"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + myOkElements = true ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_OrientationElementsDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + diff --git a/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.h b/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.h new file mode 100644 index 000000000..22a2a1f8d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_OrientationElementsDlg.h @@ -0,0 +1,94 @@ +// File : SMESHGUI_OrientationElementsDlg.h +// Created : Tue Jun 25 14:30:34 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_ORIENTATION_ELEMENTS_H +#define DIALOGBOX_ORIENTATION_ELEMENTS_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_OrientationElementsDlg +// purpose : +//================================================================================= +class SMESHGUI_OrientationElementsDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_OrientationElementsDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_OrientationElementsDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkElements ; /* to check when arguments is defined */ + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_OrientationElementsDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_ORIENTATION_ELEMENTS_H diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx new file mode 100644 index 000000000..a978d821e --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx @@ -0,0 +1,375 @@ +using namespace std; +// File : SMESHGUI_Preferences_ColorDlg.cxx +// Created : Mon Jun 17 19:11:27 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_Preferences_ColorDlg.h" +#include "SMESHGUI.h" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a SMESHGUI_Preferences_ColorDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( QWidget* parent, const char* name ) + : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + if ( !name ) + setName( "SMESHGUI_Preferences_ColorDlg" ); + setCaption( tr( "Preferences - Set Color" ) ); + setSizeGripEnabled( TRUE ); + QGridLayout* SMESHGUI_Preferences_ColorDlgLayout = new QGridLayout( this ); + SMESHGUI_Preferences_ColorDlgLayout->setSpacing( 6 ); + SMESHGUI_Preferences_ColorDlgLayout->setMargin( 11 ); + + ButtonGroup1 = new QButtonGroup( tr( "Elements" ), this, "ButtonGroup1" ); + ButtonGroup1->setColumnLayout(0, Qt::Vertical ); + ButtonGroup1->layout()->setSpacing( 0 ); + ButtonGroup1->layout()->setMargin( 0 ); + QGridLayout* ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() ); + ButtonGroup1Layout->setAlignment( Qt::AlignTop ); + ButtonGroup1Layout->setSpacing( 6 ); + ButtonGroup1Layout->setMargin( 11 ); + + TextLabel_Fill = new QLabel( tr( "Fill" ), ButtonGroup1, "TextLabel_2D_Fill" ); + ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 ); + + btnFillColor = new QPushButton( ButtonGroup1, "btnFillColor" ); + btnFillColor->setFixedSize( QSize( 25, 25 ) ); + ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 ); + + TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1, "TextLabel_2D_Outine" ); + ButtonGroup1Layout->addWidget( TextLabel_Outine, 0, 2 ); + + btnOutlineColor = new QPushButton( ButtonGroup1, "btnOutlineColor" ); + btnOutlineColor->setFixedSize( QSize( 25, 25 ) ); + ButtonGroup1Layout->addWidget( btnOutlineColor, 0, 3 ); + + TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1, "TextLabel_2D_Width" ); + ButtonGroup1Layout->addWidget( TextLabel_Width, 0, 4 ); + + SpinBox_Width = new QSpinBox( 0, 5, 1, ButtonGroup1, "SpinBox_Width" ); + SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Width->setWrapping( FALSE ); + SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus ); + ButtonGroup1Layout->addWidget( SpinBox_Width, 0, 5 ); + + TextLabel_BackFace = new QLabel( tr( "Back Face" ), ButtonGroup1, "TextLabel_BackFace" ); + ButtonGroup1Layout->addWidget( TextLabel_BackFace, 1, 0 ); + + btnBackFaceColor = new QPushButton( ButtonGroup1, "btnBackFaceColor" ); + btnBackFaceColor->setFixedSize( QSize( 25, 25 ) ); + ButtonGroup1Layout->addWidget( btnBackFaceColor, 1, 1 ); + + TextLabel_ShrinkCoeff = new QLabel( tr( "Shrink coef." ), ButtonGroup1, "TextLabel_ShrinkCoeff" ); + ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 2, 0 ); + + SpinBox_Shrink = new QSpinBox( 20, 100, 1, ButtonGroup1, "SpinBox_Shrink" ); + SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus ); + ButtonGroup1Layout->addMultiCellWidget( SpinBox_Shrink, 2, 2, 1, 5); + + SMESHGUI_Preferences_ColorDlgLayout->addWidget( ButtonGroup1, 0, 0 ); + + ButtonGroup2 = new QButtonGroup( tr( "Nodes" ), this, "ButtonGroup2" ); + ButtonGroup2->setColumnLayout(0, Qt::Vertical ); + ButtonGroup2->layout()->setSpacing( 0 ); + ButtonGroup2->layout()->setMargin( 0 ); + QGridLayout* ButtonGroup2Layout = new QGridLayout( ButtonGroup2->layout() ); + ButtonGroup2Layout->setAlignment( Qt::AlignTop ); + ButtonGroup2Layout->setSpacing( 6 ); + ButtonGroup2Layout->setMargin( 11 ); + + TextLabel_Nodes_Color = new QLabel( tr( "Color" ), ButtonGroup2, "TextLabel_Nodes_Color" ); + ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color, 0, 0 ); + + btnNodeColor = new QPushButton( ButtonGroup2, "btnNodeColor" ); + btnNodeColor->setFixedSize( QSize( 25, 25 ) ); + ButtonGroup2Layout->addWidget( btnNodeColor, 0, 1 ); + + TextLabel_Nodes_Size = new QLabel( tr( "Size" ), ButtonGroup2, "TextLabel_Nodes_Size" ); + ButtonGroup2Layout->addWidget( TextLabel_Nodes_Size, 0, 2 ); + + SpinBox_Nodes_Size = new QSpinBox( 0, 5, 1, ButtonGroup2, "SpinBox_Nodes_Size" ); + SpinBox_Nodes_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Nodes_Size->setWrapping( FALSE ); + SpinBox_Nodes_Size->setButtonSymbols( QSpinBox::PlusMinus ); + ButtonGroup2Layout->addWidget( SpinBox_Nodes_Size, 0, 3 ); + + SMESHGUI_Preferences_ColorDlgLayout->addWidget( ButtonGroup2, 1, 0 ); + + GroupButtons = new QButtonGroup( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + + buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + + SMESHGUI_Preferences_ColorDlgLayout->addWidget( GroupButtons, 2, 0 ); + + Init(); +} + +/* + * Destroys the object and frees any allocated resources + */ +SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::Init() +{ + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + + connect( btnFillColor, SIGNAL( clicked() ), this, SLOT( SelectFillColor() ) ) ; + connect( btnOutlineColor, SIGNAL( clicked() ), this, SLOT( SelectOutlineColor() ) ) ; + connect( btnNodeColor, SIGNAL( clicked() ), this, SLOT( SelectNodeColor() ) ) ; + connect( btnBackFaceColor, SIGNAL( clicked() ), this, SLOT( SelectBackFaceColor() ) ) ; + + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; +} + +//================================================================================= +// function : SelectFillColor() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SelectFillColor() +{ + QColor color = btnFillColor->palette().active().button(); + color = QColorDialog::getColor( color ); + if ( color.isValid() ) { + QPalette pal = btnFillColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnFillColor->setPalette(pal); + } +} + +//================================================================================= +// function : SelectBackFaceColor() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SelectBackFaceColor() +{ + QColor color = btnBackFaceColor->palette().active().button(); + color = QColorDialog::getColor( color ); + if ( color.isValid() ) { + QPalette pal = btnBackFaceColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnBackFaceColor->setPalette(pal); + } +} + +//================================================================================= +// function : SelectOutlineColor() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SelectOutlineColor() +{ + QColor color = btnOutlineColor->palette().active().button(); + color = QColorDialog::getColor( color ); + if ( color.isValid() ) { + QPalette pal = btnOutlineColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnOutlineColor->setPalette(pal); + } +} + +//================================================================================= +// function : SelectNodeColor() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SelectNodeColor() +{ + QColor color = btnNodeColor->palette().active().button(); + color = QColorDialog::getColor( color ); + if ( color.isValid() ) { + QPalette pal = btnNodeColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnNodeColor->setPalette(pal); + } +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::ClickOnOk() +{ + mySMESHGUI->ResetState(); + accept(); +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::ClickOnCancel() +{ + mySMESHGUI->ResetState(); + reject() ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::DeactivateActiveDialog() +{ + return ; +} + + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* e ) +{ + this->ClickOnCancel() ; /* same than click on cancel button */ +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate any active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + + return ; +} + +//================================================================================= +// function : SetColor() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SetColor(int type, QColor color) +{ + switch (type) { + case 1 : // fill + { + QPalette pal = btnFillColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnFillColor->setPalette(pal); + break; + } + case 2 : // outline + { + QPalette pal = btnOutlineColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnOutlineColor->setPalette(pal); + break; + } + case 3 : // node + { + QPalette pal = btnNodeColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnNodeColor->setPalette(pal); + break; + } + case 4 : // back face + { + QPalette pal = btnBackFaceColor->palette(); + pal.setColor(QColorGroup::Button, color); + btnBackFaceColor->setPalette(pal); + break; + } + } +} + +//================================================================================= +// function : GetColor() +// purpose : +//================================================================================= +QColor SMESHGUI_Preferences_ColorDlg::GetColor(int type) +{ + QColor color; + switch (type) { + case 1 : color = btnFillColor->palette().active().button(); break; // fill + case 2 : color = btnOutlineColor->palette().active().button(); break; // outline + case 3 : color = btnNodeColor->palette().active().button(); break; // node + case 4 : color = btnBackFaceColor->palette().active().button(); break; // back face + } + return color; +} + +//================================================================================= +// function : SetIntValue() +// purpose : +//================================================================================= +void SMESHGUI_Preferences_ColorDlg::SetIntValue(int type, int value) +{ + switch (type) { + case 1 : SpinBox_Width->setValue(value); break; // width + case 2 : SpinBox_Nodes_Size->setValue(value); break; // nodes size = value; break; + case 3 : SpinBox_Shrink->setValue(value); break; // shrink coeff + } +} + +//================================================================================= +// function : GetIntValue() +// purpose : +//================================================================================= +int SMESHGUI_Preferences_ColorDlg::GetIntValue(int type) +{ + int res = 0; + switch (type) { + case 1 : res = SpinBox_Width->value(); break; // width + case 2 : res = SpinBox_Nodes_Size->value(); break; // nodes size + case 3 : res = SpinBox_Shrink->value(); break; // shrink coeff + } + return res; +} diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h new file mode 100644 index 000000000..1f5afc3c5 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h @@ -0,0 +1,86 @@ +// File : SMESHGUI_Preferences_ColorDlg.h +// Created : Mon Jun 17 19:11:46 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef SMESHGUI_PREFERENCES_COLORDLG_H +#define SMESHGUI_PREFERENCES_COLORDLG_H + +// SALOME Includes +#include "QAD_Config.h" +#include "QAD_Settings.h" + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) + +// QT Includes +#include + +class QButtonGroup; +class QFrame; +class QLabel; +class QPushButton; +class QSpinBox; +class QColor; +class SMESHGUI; + +class SMESHGUI_Preferences_ColorDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_Preferences_ColorDlg( QWidget* parent = 0, const char* name = 0 ); + ~SMESHGUI_Preferences_ColorDlg(); + + void SetColor(int type, QColor color); + QColor GetColor(int type); + void SetIntValue(int type, int value); + int GetIntValue(int type); + +private: + void closeEvent( QCloseEvent* e ) ; + void Init(); + +private slots: +// void RadioButtonClicked(int radioButtonId); + void ClickOnOk(); + void ClickOnCancel(); + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + + void SelectFillColor(); + void SelectBackFaceColor(); + void SelectOutlineColor(); + void SelectNodeColor(); + +private: + SMESH::SMESH_Gen_var myCompMesh ; + SMESHGUI* mySMESHGUI ; + + QButtonGroup* ButtonGroup1; + QLabel* TextLabel_Fill; + QPushButton* btnFillColor; + QLabel* TextLabel_Outine; + QPushButton* btnOutlineColor; + QLabel* TextLabel_Width; + QSpinBox* SpinBox_Width; + QLabel* TextLabel_BackFace; + QPushButton* btnBackFaceColor; + QLabel* TextLabel_ShrinkCoeff; + QSpinBox* SpinBox_Shrink; + QButtonGroup* ButtonGroup2; + QLabel* TextLabel_Nodes_Color; + QPushButton* btnNodeColor; + QLabel* TextLabel_Nodes_Size; + QSpinBox* SpinBox_Nodes_Size; + QButtonGroup* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; +}; + +#endif // SMESHGUI_PREFERENCES_COLORDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx new file mode 100644 index 000000000..eeefd0357 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -0,0 +1,187 @@ +using namespace std; +// File : SMESHGUI_Preferences_ScalarBarDlg.cxx +// Created : Tue Jun 11 17:23:32 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_Preferences_ScalarBarDlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a SMESHGUI_Preferences_ScalarBarDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + if ( !name ) + setName( "SMESHGUI_Preferences_ScalarBarDlg" ); + setCaption( tr( "SMESH_PREFERENCES_SCALARBAR" ) ); + setSizeGripEnabled( TRUE ); + + grid = new QGridLayout( this ); + grid->setSpacing( 6 ); + grid->setMargin( 11 ); + + /******************************************************************************/ + Properties = new QGroupBox( this, "Properties" ); + Properties->setTitle( tr( "SMESH_PROPERTIES" ) ); + Properties->setColumnLayout(0, Qt::Vertical ); + Properties->layout()->setSpacing( 0 ); + Properties->layout()->setMargin( 0 ); + grid_4 = new QGridLayout( Properties->layout() ); + grid_4->setAlignment( Qt::AlignTop ); + grid_4->setSpacing( 6 ); + grid_4->setMargin( 11 ); + + /* Font */ + grid_5 = new QGridLayout; + grid_5->setSpacing( 6 ); + grid_5->setMargin( 0 ); + TextLabel2 = new QLabel( Properties, "TextLabel2" ); + TextLabel2->setText( tr( "SMESH_FONT" ) ); + grid_5->addWidget( TextLabel2, 0, 0 ); + ComboBox1 = new QComboBox( FALSE, Properties, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + ComboBox1->insertItem( tr( "SMESH_FONT_ARIAL" ) ); + ComboBox1->insertItem( tr( "SMESH_FONT_COURIER" ) ); + ComboBox1->insertItem( tr( "SMESH_FONT_TIMES" ) ); + grid_5->addWidget( ComboBox1, 0, 1 ); + grid_4->addLayout( grid_5, 0, 0 ); + + /* Font attributes */ + grid_6 = new QGridLayout; + grid_6->setSpacing( 6 ); + grid_6->setMargin( 0 ); + Bold = new QCheckBox( Properties, "Bold" ); + Bold->setText( tr( "SMESH_FONT_BOLD" ) ); + grid_6->addWidget( Bold, 0, 0 ); + Italic = new QCheckBox( Properties, "Italic" ); + Italic->setText( tr( "SMESH_FONT_ITALIC" ) ); + grid_6->addWidget( Italic, 0, 1 ); + Shadow = new QCheckBox( Properties, "Shadow" ); + Shadow->setText( tr( "SMESH_FONT_SHADOW" ) ); + grid_6->addWidget( Shadow, 0, 2 ); + grid_4->addLayout( grid_6, 1, 0 ); + + grid_7 = new QGridLayout; + grid_7->setSpacing( 6 ); + grid_7->setMargin( 0 ); + NumberColors = new QLabel( Properties, "NumberColors" ); + NumberColors->setText( tr( "SMESH_NUMBEROFCOLORS" ) ); + grid_7->addWidget( NumberColors, 0, 0 ); + SpinBoxColors = new QSpinBox( Properties, "SpinBoxColors" ); + SpinBoxColors->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBoxColors->setMinValue( 1 ); + grid_7->addWidget( SpinBoxColors, 0, 1 ); + NumberLabels = new QLabel( Properties, "NumberLabels" ); + NumberLabels->setText( tr( "SMESH_NUMBEROFLABELS" ) ); + grid_7->addWidget( NumberLabels, 1, 0 ); + SpinBoxLabels = new QSpinBox( Properties, "SpinBoxLabels" ); + SpinBoxLabels->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBoxLabels->setMinValue( 1 ); + grid_7->addWidget( SpinBoxLabels, 1, 1 ); + grid_4->addLayout( grid_7, 2, 0 ); + + grid->addWidget( Properties, 0, 0 ); + + /******************************************************************************/ + ButtonGroup_Orientation = new QButtonGroup( this, "ButtonGroup_Orientation" ); + ButtonGroup_Orientation->setTitle( tr( "SMESH_ORIENTATION" ) ); + ButtonGroup_Orientation->setColumnLayout(0, Qt::Vertical ); + ButtonGroup_Orientation->layout()->setSpacing( 0 ); + ButtonGroup_Orientation->layout()->setMargin( 0 ); + grid_2 = new QGridLayout( ButtonGroup_Orientation->layout() ); + grid_2->setAlignment( Qt::AlignTop ); + grid_2->setSpacing( 6 ); + grid_2->setMargin( 11 ); + RadioVert = new QRadioButton( ButtonGroup_Orientation, "RadioVert" ); + RadioVert->setText( tr( "SMESH_VERTICAL" ) ); + RadioHoriz = new QRadioButton( ButtonGroup_Orientation, "RadioHoriz" ); + RadioHoriz->setText( tr( "SMESH_HORIZONTAL" ) ); + grid_2->addWidget( RadioVert, 0, 0 ); + grid_2->addWidget( RadioHoriz, 0, 1 ); + + grid->addWidget( ButtonGroup_Orientation, 1, 0 ); + + /******************************************************************************/ + GroupBox5 = new QGroupBox( this, "GroupBox5" ); + GroupBox5->setTitle( tr( "SMESH_DIMENSIONS" ) ); + GroupBox5->setColumnLayout(0, Qt::Vertical ); + GroupBox5->layout()->setSpacing( 0 ); + GroupBox5->layout()->setMargin( 0 ); + grid_11 = new QGridLayout( GroupBox5->layout() ); + grid_11->setAlignment( Qt::AlignTop ); + grid_11->setSpacing( 6 ); + grid_11->setMargin( 11 ); + + LineEditWidth = new QLineEdit( GroupBox5, "LineEditWidth" ); + grid_11->addWidget( LineEditWidth, 0, 0 ); + Width = new QLabel( GroupBox5, "Width" ); + Width->setText( tr( "SMESH_WIDTH" ) ); + grid_11->addWidget( Width, 0, 1 ); + LineEditHeight = new QLineEdit( GroupBox5, "LineEditHeight" ); + grid_11->addWidget( LineEditHeight, 1, 0 ); + Height = new QLabel( GroupBox5, "Height" ); + Height->setText( tr( "SMESH_HEIGHT" ) ); + grid_11->addWidget( Height, 1, 1 ); + + grid->addWidget( GroupBox5, 2, 0 ); + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + grid_15 = new QGridLayout( GroupButtons->layout() ); + grid_15->setAlignment( Qt::AlignTop ); + grid_15->setSpacing( 6 ); + grid_15->setMargin( 11 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + grid_15->addWidget( buttonOk, 0, 0 ); + grid_15->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CANCEL" ) ); + buttonCancel->setAutoDefault( TRUE ); + grid_15->addWidget( buttonCancel, 0, 2 ); + + grid->addWidget( GroupButtons, 3, 0 ); + + // signals and slots connections + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +SMESHGUI_Preferences_ScalarBarDlg::~SMESHGUI_Preferences_ScalarBarDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h new file mode 100644 index 000000000..5dbae2436 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -0,0 +1,75 @@ +// File : SMESHGUI_Preferences_ScalarBarDlg.h +// Created : Tue Jun 11 17:23:15 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef SMESHGUI_PREFERENCES_SCALARBARDLG_H +#define SMESHGUI_PREFERENCES_SCALARBARDLG_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QCheckBox; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class SMESHGUI_Preferences_ScalarBarDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_Preferences_ScalarBarDlg(); + + QButtonGroup* ButtonGroup_Orientation; + QRadioButton* RadioHoriz; + QRadioButton* RadioVert; + QGroupBox* Properties; + QLabel* NumberLabels; + QLabel* NumberColors; + QSpinBox* SpinBoxLabels; + QSpinBox* SpinBoxColors; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QCheckBox* Shadow; + QCheckBox* Italic; + QCheckBox* Bold; + QGroupBox* GroupBox5; + QLineEdit* LineEditWidth; + QLineEdit* LineEditHeight; + QLabel* Height; + QLabel* Width; + QPushButton* buttonCancel; + QPushButton* buttonOk; + +protected: + QGridLayout* grid; + QGridLayout* grid_2; + QGridLayout* grid_3; + QGridLayout* grid_4; + QGridLayout* grid_5; + QGridLayout* grid_6; + QGridLayout* grid_7; + QGridLayout* grid_8; + QGridLayout* grid_9; + QGridLayout* grid_10; + QGridLayout* grid_11; + QGridLayout* grid_12; + QGridLayout* grid_13; + QGridLayout* grid_14; + QGridLayout* grid_15; +}; + +#endif // SMESHGUI_PREFERENCES_SCALARBARDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx new file mode 100644 index 000000000..f691de9d9 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -0,0 +1,351 @@ +using namespace std; +// File : SMESHGUI_RemoveElementsDlg.cxx +// Created : Fri Jun 07 11:18:31 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_RemoveElementsDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_RemoveElementsDlg() +// purpose : +//================================================================================= +SMESHGUI_RemoveElementsDlg::SMESHGUI_RemoveElementsDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_REM_ELEMENT"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_RemoveElementsDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_REMOVE_ELEMENTS_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_RemoveElementsDlgLayout = new QGridLayout( this ); + SMESHGUI_RemoveElementsDlgLayout->setSpacing( 6 ); + SMESHGUI_RemoveElementsDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_ELEMENTS" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_REMOVE" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_ELEMENTS" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + SMESHGUI_RemoveElementsDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_RemoveElementsDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkElements = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_RemoveElementsDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkElements) { + mySMESHGUI->RemoveElements( myMesh, myMapIndex ) ; + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkElements = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return; + + int nbElements = mySMESHGUI->GetNameOfSelectedElements(mySelection, aString) ; + if(nbElements < 1) + return ; + + if ( mySelection->SelectionMode() != 3 ) { + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_ELEMENTS"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + myOkElements = true ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_RemoveElementsDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h new file mode 100644 index 000000000..66a1809c2 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h @@ -0,0 +1,93 @@ +// File : SMESHGUI_RemoveElementsDlg.h +// Created : Fri Jun 07 11:18:42 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_REMOVE_ELEMENTS_H +#define DIALOGBOX_REMOVE_ELEMENTS_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_RemoveElementsDlg +// purpose : +//================================================================================= +class SMESHGUI_RemoveElementsDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_RemoveElementsDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_RemoveElementsDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkElements ; /* to check when arguments is defined */ + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_RemoveElementsDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_REMOVE_ELEMENTS_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx new file mode 100644 index 000000000..c3a989e44 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -0,0 +1,362 @@ +using namespace std; +// File : SMESHGUI_RemoveNodesDlg.cxx +// Created : Fri Jun 07 11:18:31 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_RemoveNodesDlg.h" + +#include "SMESHGUI.h" +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_MessageBox.h" +#include "utilities.h" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_RemoveNodesDlg() +// purpose : +//================================================================================= +SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, + bool modal, WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_DLG_REM_NODE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESHGUI",tr("ICON_SELECT"))); + + if ( !name ) + setName( "SMESHGUI_RemoveNodesDlg" ); + resize( 303, 185 ); + setCaption( tr( "SMESH_REMOVE_NODES_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_RemoveNodesDlgLayout = new QGridLayout( this ); + SMESHGUI_RemoveNodesDlgLayout->setSpacing( 6 ); + SMESHGUI_RemoveNodesDlgLayout->setMargin( 11 ); + + /***************************************************************/ + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setTitle( tr( "SMESH_NODES" ) ); + GroupConstructors->setExclusive( TRUE ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 0 ); + GroupConstructors->layout()->setMargin( 0 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + GroupConstructorsLayout->setSpacing( 6 ); + GroupConstructorsLayout->setMargin( 11 ); + Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); + Constructor1->setText( tr( "" ) ); + Constructor1->setPixmap( image0 ); + Constructor1->setChecked( TRUE ); + Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); + Constructor1->setMinimumSize( QSize( 50, 0 ) ); + GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupConstructorsLayout->addItem( spacer, 0, 1 ); + SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupConstructors, 0, 0 ); + + /***************************************************************/ + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); + GroupButtons->setTitle( tr( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); + buttonApply->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); + QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + GroupButtonsLayout->addItem( spacer_9, 0, 2 ); + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "SMESH_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupButtons, 2, 0 ); + + /***************************************************************/ + GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setTitle( tr( "SMESH_REMOVE" ) ); + GroupC1->setMinimumSize( QSize( 0, 0 ) ); + GroupC1->setFrameShape( QGroupBox::Box ); + GroupC1->setFrameShadow( QGroupBox::Sunken ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); + TextLabelC1A1->setText( tr( "SMESH_ID_NODES" ) ); + TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); + TextLabelC1A1->setFrameShape( QLabel::NoFrame ); + TextLabelC1A1->setFrameShadow( QLabel::Plain ); + GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); + SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); + SelectButtonC1A1->setText( tr( "" ) ); + SelectButtonC1A1->setPixmap( image1 ); + SelectButtonC1A1->setToggleButton( FALSE ); + GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); + LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); + GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); + SMESHGUI_RemoveNodesDlgLayout->addWidget( GroupC1, 1, 0 ); + + Init(Sel) ; /* Initialisations */ +} + +//================================================================================= +// function : ~SMESHGUI_RemoveNodesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::Init( SALOME_Selection* Sel ) +{ + + GroupC1->show(); + myConstructorId = 0 ; + Constructor1->setChecked( TRUE ); + myEditCurrentArgument = LineEditC1A1 ; + mySelection = Sel; + this->myOkNodes = false ; + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + + /* signals and slots connections */ + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; + connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); + connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + + connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + /* to close dialog if study change */ + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* displays Dialog */ + + SelectionIntoArgument(); + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void SMESHGUI_RemoveNodesDlg::ConstructorsClicked(int constructorId) +{ + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::ClickOnApply() +{ + switch(myConstructorId) + { + case 0 : + { + if(myOkNodes) { + mySMESHGUI->EraseSimulationActors(); + mySMESHGUI->RemoveNodes( myMesh, myMapIndex ) ; + mySMESHGUI->ViewNodes(); + mySelection->ClearIObjects(); + } + break ; + } + } + return ; +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::ClickOnOk() +{ + this->ClickOnApply() ; + this->ClickOnCancel() ; + + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->SetSelectionMode( 4 ); + disconnect( mySelection, 0, this, 0 ); + mySMESHGUI->ResetState() ; + mySMESHGUI->EraseSimulationActors(); + reject() ; + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText("") ; + myOkNodes = false; + QString aString = ""; + + int nbSel = mySelection->IObjectCount(); + if(nbSel != 1) + return ; + + int nbNodes = mySMESHGUI->GetNameOfSelectedNodes(mySelection, aString) ; + if(nbNodes < 1) + return ; + + if ( mySelection->SelectionMode() != 1 ){ + QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), + tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); + return; + } + + myEditCurrentArgument->setText(aString) ; + Standard_Boolean res; + myMesh = mySMESHGUI->ConvertIOinMesh( mySelection->firstIObject(), res ); + if (!res) + return ; + + mySelection->GetIndex( mySelection->firstIObject(), myMapIndex); + + myOkNodes = true ; + return ; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus() ; + myEditCurrentArgument = LineEditC1A1; + } + SelectionIntoArgument() ; + break; + } + } + return ; +} + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::DeactivateActiveDialog() +{ + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled(false) ; + GroupC1->setEnabled(false) ; + GroupButtons->setEnabled(false) ; + mySMESHGUI->EraseSimulationActors() ; + mySMESHGUI->ResetState() ; + mySMESHGUI->SetActiveDialogBox(0) ; + } + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + mySMESHGUI->EmitSignalDeactivateDialog() ; + GroupConstructors->setEnabled(true) ; + GroupC1->setEnabled(true) ; + GroupButtons->setEnabled(true) ; + + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::enterEvent(QEvent* e) +{ + if ( GroupConstructors->isEnabled() ) + return ; + ActivateThisDialog() ; + return ; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void SMESHGUI_RemoveNodesDlg::closeEvent( QCloseEvent* e ) +{ + /* same than click on cancel button */ + this->ClickOnCancel() ; + return ; +} + + diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h new file mode 100644 index 000000000..28c2358cc --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h @@ -0,0 +1,93 @@ +// File : SMESHGUI_RemoveNodesDlg.h +// Created : Fri Jun 07 11:18:42 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef DIALOGBOX_REMOVE_NODES_H +#define DIALOGBOX_REMOVE_NODES_H + +#include "SALOME_Selection.h" + +// QT Includes +#include +#include + +// Open CASCADE Includes +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class SMESHGUI; + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +//================================================================================= +// class : SMESHGUI_RemoveNodesDlg +// purpose : +//================================================================================= +class SMESHGUI_RemoveNodesDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_RemoveNodesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SMESHGUI_RemoveNodesDlg(); + +private: + + void Init( SALOME_Selection* Sel ) ; + void closeEvent( QCloseEvent* e ) ; + void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ + + SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ + SALOME_Selection* mySelection ; /* User shape selection */ + bool myOkNodes ; /* to check when arguments is defined */ + int myConstructorId ; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + SMESH::SMESH_Mesh_var myMesh; + TColStd_MapOfInteger myMapIndex; + + QButtonGroup* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + +private slots: + + void ConstructorsClicked(int constructorId); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void SetEditCurrentArgument() ; + void SelectionIntoArgument() ; + void DeactivateActiveDialog() ; + void ActivateThisDialog() ; + +protected: + QGridLayout* SMESHGUI_RemoveNodesDlgLayout; + QGridLayout* GroupConstructorsLayout; + QGridLayout* GroupButtonsLayout; + QGridLayout* GroupC1Layout; +}; + +#endif // DIALOGBOX_REMOVE_NODES_H diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.cxx b/src/SMESHGUI/SMESHGUI_SpinBox.cxx new file mode 100644 index 000000000..86966ab50 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_SpinBox.cxx @@ -0,0 +1,77 @@ +using namespace std; +// File : SMESHGUI_SpinBox.cxx +// Created : 14 august 2002 +// Author : Lucien PIGNOLONI +// Project : SALOME +// Module : SMESHGUI +// Copyright : OPEN CASCADE +// $Header$ + +#include "SMESHGUI_SpinBox.h" +#include "SMESHGUI.h" +#include + +//================================================================================= +// class : SMESHGUI_SpinBox() +// purpose : constructor of specific widget accepting floats in double precision. +//================================================================================= +SMESHGUI_SpinBox::SMESHGUI_SpinBox( QWidget* parent, const char* name ) +: QAD_SpinBoxDbl( parent, name) +{ +} + + +//================================================================================= +// function : SetStep() [SLOT] +// purpose : +//================================================================================= +void SMESHGUI_SpinBox::SetStep( double newStep ) +{ + setLineStep( newStep ); +} + +//================================================================================= +// function : ~SMESHGUI_SpinBox() +// purpose : destructor +//================================================================================= +SMESHGUI_SpinBox::~SMESHGUI_SpinBox() +{ +} + +//================================================================================= +// function : SetValue() +// purpose : +//================================================================================= +void SMESHGUI_SpinBox::SetValue( double v ) +{ + setValue( v ); +} + +//================================================================================= +// function : GetValue() +// purpose : returns a double +//================================================================================= +double SMESHGUI_SpinBox::GetValue( ) +{ + return value(); +} + +//================================================================================= +// function : GetString() +// purpose : returns a QString +//================================================================================= +QString SMESHGUI_SpinBox::GetString( ) +{ + return cleanText(); +} + +//================================================================================= +// function : RangeStepAndValidator() +// purpose : +//================================================================================= +void SMESHGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, unsigned short decimals ) +{ + setRange( min, max ); + setLineStep( step ); + ( ( QDoubleValidator* )validator() )->setRange( min, max, decimals ) ; +} diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.h b/src/SMESHGUI/SMESHGUI_SpinBox.h new file mode 100644 index 000000000..1461aa26a --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_SpinBox.h @@ -0,0 +1,39 @@ +// File : SMESHGUI_SpinBox.h +// Created : 14 august 2002 +// Author : Lucien PIGNOLONI +// Project : SALOME +// Module : SMESHGUI +// Copyright : OPEN CASCADE +// $Header$ + +#ifndef SMESHSPINBOX_H +#define SMESHSPINBOX_H + +#include "QAD_SpinBoxDbl.h" + +//================================================================================= +// class : SMESHGUI_SpinBox +// purpose : Derivated from QAD_SpinBoxDbl class +//================================================================================= +class SMESHGUI_SpinBox : public QAD_SpinBoxDbl +{ + Q_OBJECT + +public : + + SMESHGUI_SpinBox( QWidget* parent, const char* name = 0 ) ; + ~SMESHGUI_SpinBox() ; + + void RangeStepAndValidator( double min = -1000000.0, + double max = +1000000.0, + double step = 100.0, + unsigned short decimals = 3 ) ; + void SetValue( double v ) ; + double GetValue() ; + QString GetString() ; + +public slots: + void SetStep( double newStep ); + +}; +#endif // SMESHSPINBOX_H diff --git a/src/SMESHGUI/SMESHGUI_StudyAPI.cxx b/src/SMESHGUI/SMESHGUI_StudyAPI.cxx new file mode 100644 index 000000000..ff871b1c5 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_StudyAPI.cxx @@ -0,0 +1,691 @@ +using namespace std; +// File : SMESHGUI_StudyAPI.cxx +// Created : Fri May 17 15:23:35 CEST 2002 +// Author : Yves FRICAUD +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE +// $Header: + +#include "SMESHGUI_StudyAPI.h" +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +#include "QAD_MessageBox.h" +#include "QAD_Application.h" + +// QT Includes +#include + +// Open CASCADE Includes +#include "Standard_CString.hxx" + +static CORBA::ORB_var _orb; + +// Tags definition +long Tag_HypothesisRoot = 1; +long Tag_AlgorithmsRoot = 2; + +long Tag_RefOnShape = 1; +long Tag_RefOnAppliedHypothesis = 2; +long Tag_RefOnAppliedAlgorithms = 3; + +long Tag_SubMeshOnVertex = 4; +long Tag_SubMeshOnEdge = 5; +long Tag_SubMeshOnFace = 6; +long Tag_SubMeshOnSolid = 7; +long Tag_SubMeshOnCompound = 8; + + + +static char* IORToString (CORBA::Object_ptr obj) +{ + // MESSAGE ( " IORToString " << _orb->object_to_string(obj) ) + return _orb->object_to_string(obj); +} + +CORBA::Object_ptr SMESHGUI_StudyAPI::StringToIOR (const char* IOR) +{ + // MESSAGE ( " StringToIOR " << _orb->string_to_object(IOR) ) + return _orb->string_to_object(IOR); +} +//======================================================================= +// function : +// purpose : Constructor +//======================================================================= +SMESHGUI_StudyAPI::SMESHGUI_StudyAPI () +{ +} + +SMESHGUI_StudyAPI::SMESHGUI_StudyAPI ( SALOMEDS::Study_ptr aStudy, + SMESH::SMESH_Gen_ptr CompMesh) +{ + myStudy = aStudy; + myStudyBuilder = aStudy->NewBuilder(); + + setOrb(); + + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), + QObject::tr("WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); + + return; + } + // NRI + + SALOMEDS::SComponent_var father = aStudy->FindComponent("MESH"); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + + if (father->_is_nil()) { + father = myStudyBuilder->NewComponent("MESH"); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + //NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT")); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) ); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); + } + myStudyBuilder->DefineComponentInstance(father, CompMesh ); + mySComponentMesh = SALOMEDS::SComponent::_narrow( father ); +} + +//======================================================================= +// function : +// purpose : Destructor +//======================================================================= +SMESHGUI_StudyAPI::~SMESHGUI_StudyAPI () +{ +} + +//======================================================================= +// function : +// purpose : Update +//======================================================================= +void SMESHGUI_StudyAPI::Update(SMESH::SMESH_Gen_ptr CompMesh) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + + SALOMEDS::SComponent_var father = myStudy->FindComponent("MESH"); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + + if (father->_is_nil()) { + father = myStudyBuilder->NewComponent("MESH"); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + //NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT")); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) ); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); + } + myStudyBuilder->DefineComponentInstance(father, CompMesh ); + mySComponentMesh = SALOMEDS::SComponent::_narrow( father ); +} + +//======================================================================= +// function : AddNewMesh +// purpose : +//======================================================================= + +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddNewMesh (SMESH::SMESH_Mesh_ptr M) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + //Find or Create Hypothesis root + SALOMEDS::SObject_var HypothesisRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!mySComponentMesh->FindSubObject (Tag_HypothesisRoot, HypothesisRoot)) { + HypothesisRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + + SALOMEDS::SObject_var AlgorithmsRoot; + if (!mySComponentMesh->FindSubObject (Tag_AlgorithmsRoot, AlgorithmsRoot)) { + AlgorithmsRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_ALGORITHMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + + // Add New Mesh + SALOMEDS::SObject_var newMesh = myStudyBuilder->NewObject(mySComponentMesh); + anAttr = myStudyBuilder->FindOrCreateAttribute(newMesh, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newMesh, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IORToString(M)); + return SALOMEDS::SObject::_narrow( newMesh ); +} + + +//======================================================================= +// function : SetShape +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::SetShape (SALOMEDS::SObject_ptr SO_MorSM, + SALOMEDS::SObject_ptr SO_GeomShape ) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + SALOMEDS::SObject_var SO = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnShape); + myStudyBuilder->Addreference (SO,SO_GeomShape); +} + +//======================================================================= +// function : GetShapeOnMeshOrSubMesh +// purpose : +//======================================================================= +GEOM::GEOM_Shape_ptr SMESHGUI_StudyAPI::GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return GEOM::GEOM_Shape::_nil(); + } + // NRI + + GEOM::GEOM_Shape_var Shape; + SALOMEDS::SObject_var aSO, aGeom; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( SO_Mesh_Or_SubMesh->FindSubObject( Tag_RefOnShape, aSO ) ) { + if ( aSO->ReferencedObject(aGeom) ) { + if (aGeom->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + return GEOM::GEOM_Shape::_narrow( _orb->string_to_object(anIOR->Value()) ); + } + } + } + return GEOM::GEOM_Shape::_nil(); +} + +//======================================================================= +// function : AddNewHypothesis +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddNewHypothesis (SMESH::SMESH_Hypothesis_ptr H) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + //Find or Create Hypothesis root + SALOMEDS::SObject_var HypothesisRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!mySComponentMesh->FindSubObject (Tag_HypothesisRoot, HypothesisRoot)) { + HypothesisRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + } + // Add New Hypothesis + SALOMEDS::SObject_var newHypo = myStudyBuilder->NewObject(HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + QString aType = H->GetName(); + MESSAGE ( " aType " << aType ) + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_" + aType ); + // if ( aType.compare("LocalLength") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_LENGTH" ); + // else if ( aType.compare("NumberOfSegments") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_SEGMENT" ); + // else if ( aType.compare("MaxElementArea") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_AREA" ); + // else if ( aType.compare("MaxElementVolume") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_VOLUME" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IORToString(H)); + return SALOMEDS::SObject::_narrow(newHypo); +} + +//======================================================================= +// function : AddNewAlgorithms +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddNewAlgorithms (SMESH::SMESH_Hypothesis_ptr H) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + //Find or Create Algorithms root + SALOMEDS::SObject_var AlgorithmsRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!mySComponentMesh->FindSubObject (Tag_AlgorithmsRoot, AlgorithmsRoot)) { + AlgorithmsRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_ALGORITHMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + } + // Add New Algorithms + SALOMEDS::SObject_var newHypo = myStudyBuilder->NewObject(AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + QString aType = H->GetName(); + // if ( aType.compare("Regular_1D") == 0 ) + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_" + aType ); + // aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_REGULAR" ); + // else if ( aType.compare("MEFISTO_2D") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_MEFISTO" ); + // else if ( aType.compare("Quadrangle_2D") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_QUAD" ); + // else if ( aType.compare("Hexa_3D") == 0 ) + // aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_HEXA" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IORToString(H)); + return SALOMEDS::SObject::_narrow(newHypo); +} + + +//======================================================================= +// function : AddSubMeshOnShape +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, + SMESH::SMESH_subMesh_ptr SM, + GEOM::shape_type ST) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + long Tag_Shape ; + Standard_CString Name; + + if (ST == GEOM::SOLID) {Tag_Shape = Tag_SubMeshOnSolid; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnSolid"));} + else if (ST == GEOM::FACE) {Tag_Shape = Tag_SubMeshOnFace; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnFace"));} + else if (ST == GEOM::EDGE) {Tag_Shape = Tag_SubMeshOnEdge; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnEdge"));} + else if (ST == GEOM::VERTEX){Tag_Shape = Tag_SubMeshOnVertex; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnVertex"));} + else { + Tag_Shape = Tag_SubMeshOnCompound; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnCompound")); + } + + SALOMEDS::SObject_var SubmeshesRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + + if (!SO_Mesh->FindSubObject (Tag_Shape,SubmeshesRoot )) { + SubmeshesRoot = myStudyBuilder->NewObjectToTag (SO_Mesh, Tag_Shape); + anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(Name); + anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject (SubmeshesRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IORToString(SM)); + return SALOMEDS::SObject::_narrow( SO ); +} + +//======================================================================= +// function : AddSubMeshOnShape +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, + SALOMEDS::SObject_ptr SO_GeomShape, + SMESH::SMESH_subMesh_ptr SM, + GEOM::shape_type ST) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + SALOMEDS::SObject_var SO_SM = AddSubMeshOnShape (SO_Mesh,SM,ST); + SetShape (SO_SM,SO_GeomShape); + // SetShapeOnSubMesh (SO_SM,SO_GeomShape); + return SALOMEDS::SObject::_narrow( SO_SM ); +} + + +//======================================================================= +// function : SetHypothesis +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::SetHypothesis (SALOMEDS::SObject_ptr SO_MorSM, + SALOMEDS::SObject_ptr SO_Hypothesis) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + + //Find or Create Applied Hypothesis root + SALOMEDS::SObject_var AHR; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedHypothesis, AHR)) { + AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR); + myStudyBuilder->Addreference (SO,SO_Hypothesis); +} + +//======================================================================= +// function : SetAlgorithms +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::SetAlgorithms (SALOMEDS::SObject_ptr SO_MorSM, + SALOMEDS::SObject_ptr SO_Algorithms) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + + //Find or Create Applied Algorithms root + SALOMEDS::SObject_var AHR; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedAlgorithms, AHR)) { + AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR); + myStudyBuilder->Addreference (SO,SO_Algorithms); +} + + +//======================================================================= +// function : +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::FindMesh (SMESH::SMESH_Mesh_ptr M) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + return SALOMEDS::SObject::_narrow( myStudy->FindObjectIOR (IORToString(M)) ); +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::FindHypothesisOrAlgorithms (SMESH::SMESH_Hypothesis_ptr H) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + return SALOMEDS::SObject::_narrow( myStudy->FindObjectIOR (IORToString(H)) ); +} + + +//======================================================================= +// function : +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::FindSubMesh (SMESH::SMESH_subMesh_ptr SM) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + return SALOMEDS::SObject::_narrow( myStudy->FindObjectIOR (IORToString(SM)) ); +} + + +void SMESHGUI_StudyAPI::setOrb() +{ + try { + ORB_INIT &init = *SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init( 0 , 0 ); + } catch (...) { + INFOS("internal error : orb not found"); + _orb = 0; + } + ASSERT(! CORBA::is_nil(_orb)); +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::SetTagHypothesisRoot() +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(mySComponentMesh); + int i = 0; + for (; it->More();it->Next()) { + i++; + } + Tag_HypothesisRoot = i++; +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::SetName( SALOMEDS::SObject_ptr SO, const char* Name ) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(Name); +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::UnSetHypothesis (SALOMEDS::SObject_ptr SO_Applied_Hypothesis) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + myStudyBuilder->RemoveObject(SO_Applied_Hypothesis); +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +void SMESHGUI_StudyAPI::UnSetAlgorithm (SALOMEDS::SObject_ptr SO_Applied_Algorithm) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return; + } + // NRI + myStudyBuilder->RemoveObject(SO_Applied_Algorithm); +} + +//======================================================================= +// function : +// purpose : +//======================================================================= +SALOMEDS::SObject_ptr SMESHGUI_StudyAPI::GetMeshOrSubmesh (SALOMEDS::SObject_ptr SO) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return SALOMEDS::SObject::_nil(); + } + // NRI + + SALOMEDS::SObject_var MorSM,SB; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + if (SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var Shape = GEOM::GEOM_Shape::_narrow( _orb->string_to_object(anIOR->Value()) ); + if (!Shape->_is_nil()) { + //It s a shape + MorSM = SO->GetFather(); + // MESSAGE ( " MorSM shape " << MorSM->GetID() ) + return SALOMEDS::SObject::_narrow( MorSM); + } + } + + if (SO->ReferencedObject(SB)) { + //It's Reference on Hypothesis or Algorithm + MorSM = SO->GetFather()->GetFather(); + // MESSAGE ( " MorSM reference " << MorSM->GetID() ) + return SALOMEDS::SObject::_narrow( MorSM); + } + // It's SMESH_MEN_APPLIED_HYPOTHESIS or SMESH_MEN_APPLIED_ALGORITHMS or SubMeshesOnFace etc... + MorSM = SO->GetFather(); + // MESSAGE ( " MorSM banniere " << MorSM->GetID() ) + return SALOMEDS::SObject::_narrow( MorSM); +} + +void SMESHGUI_StudyAPI::ModifiedMesh( SALOMEDS::SObject_ptr MorSM, bool right) +{ + // NRI : Temporary added + if ( myStudy->GetProperties()->IsLocked() ) { + return ; + } + // NRI + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = myStudyBuilder->FindOrCreateAttribute(MorSM, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if (right) { + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); + } else { + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_WARN" ); + } + + int i = 1; + SALOMEDS::ChildIterator_var it = myStudy->NewChildIterator(MorSM); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var Obj = it->Value(); + if ( i >= 4 ) { + int j = 1; + SALOMEDS::ChildIterator_var it1 = myStudy->NewChildIterator(Obj); + for (; it1->More();it1->Next()) { + SALOMEDS::SObject_var Obj1 = it1->Value(); + anAttr = myStudyBuilder->FindOrCreateAttribute(Obj1, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if (right) { + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); + } else { + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_WARN" ); + } + } + } + i++; + } +} diff --git a/src/SMESHGUI/SMESHGUI_StudyAPI.h b/src/SMESHGUI/SMESHGUI_StudyAPI.h new file mode 100644 index 000000000..a24863eeb --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_StudyAPI.h @@ -0,0 +1,86 @@ +// File : SMESHGUI_StudyAPI.h +// Created : Fri May 17 15:23:35 CEST 2002 +// Author : Yves FRICAUD +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE +// $Header: + +#ifndef _INCLUDE_SMESHGUI_StudyAPI_ +#define _INCLUDE_SMESHGUI_StudyAPI_ + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_SERVER_HEADER(GEOM_Shape) +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SMESH_subMesh_ptr; + +class SMESHGUI_StudyAPI { + + public: + + SMESHGUI_StudyAPI (); + + SMESHGUI_StudyAPI ( SALOMEDS::Study_ptr aStudy, SMESH::SMESH_Gen_ptr Gen); + + ~SMESHGUI_StudyAPI (); + + // Adding in Study + CORBA::Object_ptr StringToIOR(const char* IOR); + + SALOMEDS::SObject_ptr AddNewMesh (SMESH::SMESH_Mesh_ptr M); + + SALOMEDS::SObject_ptr AddNewHypothesis (SMESH::SMESH_Hypothesis_ptr H); + SALOMEDS::SObject_ptr AddNewAlgorithms (SMESH::SMESH_Hypothesis_ptr H); + + SALOMEDS::SObject_ptr AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, SMESH::SMESH_subMesh_ptr SM, GEOM::shape_type ST); + + SALOMEDS::SObject_ptr AddSubMeshOnShape (SALOMEDS::SObject_ptr SO_Mesh, SALOMEDS::SObject_ptr SO_GeomShape, SMESH::SMESH_subMesh_ptr SM, GEOM::shape_type ST); + + void Update(SMESH::SMESH_Gen_ptr Gen); + + void ModifiedMesh( SALOMEDS::SObject_ptr MorSM, bool right); + + + void SetShape (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_GeomShape); + GEOM::GEOM_Shape_ptr GetShapeOnMeshOrSubMesh(SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh); + + void SetHypothesis (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_Hypothesis); + void SetAlgorithms (SALOMEDS::SObject_ptr SO_Mesh_Or_SubMesh, SALOMEDS::SObject_ptr SO_Algorithms); + + void UnSetHypothesis (SALOMEDS::SObject_ptr SO_Applied_Hypothesis); + void UnSetAlgorithm (SALOMEDS::SObject_ptr SO_Applied_Algorithm); + + void SetTagHypothesisRoot(); + + void SetName( SALOMEDS::SObject_ptr SO, const char* Name ) ; + + //Exploration + + SALOMEDS::SObject_ptr GetMeshOrSubmesh (SALOMEDS::SObject_ptr SO); + + SALOMEDS::SObject_ptr FindMesh (SMESH::SMESH_Mesh_ptr M); + + SALOMEDS::SObject_ptr FindHypothesisOrAlgorithms (SMESH::SMESH_Hypothesis_ptr H); + + SALOMEDS::SObject_ptr FindSubMesh (SMESH::SMESH_subMesh_ptr SM); + + //SALOMEDS::ListOfSObject_ptr FindMesh (SALOMEDS_SObject_ptr SO_GeomShape); + //SALOMEDS_SObject_ptr FindSubMesh (SALOMEDS_SObject_ptr SO_Mesh, SALOMEDS_SObject_ptr SO_GeomShape); + + static void setOrb(); + + private: + //fields + SALOMEDS::Study_var myStudy; + SALOMEDS::StudyBuilder_var myStudyBuilder; + SALOMEDS::SComponent_var mySComponentMesh; + +}; +#endif + diff --git a/src/SMESHGUI/SMESHGUI_Swig.cxx b/src/SMESHGUI/SMESHGUI_Swig.cxx new file mode 100644 index 000000000..b57199092 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Swig.cxx @@ -0,0 +1,405 @@ +using namespace std; +// File : SMESH_Swig.cxx +// Created : Mon Jun 17 13:41:43 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_Swig.hxx" + +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" + +// SALOME Includes +#include "QAD_Application.h" +#include "QAD_Desktop.h" +#include "QAD_ResourceMgr.h" + +#include "utilities.h" + +// Open CASCADE Includes +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_SERVER_HEADER(GEOM_Shape) + +static CORBA::ORB_var _orb; + +static char* ObjectToString (CORBA::Object_ptr obj) +{ + return _orb->object_to_string(obj); +} + +static CORBA::Object_ptr StringToObject (const char* ior) +{ + return _orb->string_to_object(ior); +} + +SMESH_Swig::SMESH_Swig() +{ + MESSAGE("Constructeur"); + setOrb(); +} + +void SMESH_Swig::Init(int studyID) +{ + MESSAGE("Init"); + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "SMESH"); + SMESH::SMESH_Gen_var CompMesh = SMESH::SMESH_Gen::_narrow(comp); + + QAD_ResourceMgr* resMgr = QAD_Desktop::createResourceManager(); + if ( resMgr ) { + QString msg; + if (!resMgr->loadResources( "SMESH", msg )) + MESSAGE ( msg ) + } + + CORBA::Object_var obj = QAD_Application::getDesktop()->getNameService()->Resolve("/myStudyManager"); + SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj); + myStudy = myStudyMgr->GetStudyByID(studyID); + myStudyBuilder = myStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + + SALOMEDS::SComponent_var father = myStudy->FindComponent("MESH"); + + if (father->_is_nil()) { + father = myStudyBuilder->NewComponent("MESH"); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + //NRI aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT")); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SMESH" ) ); + anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); + } + myStudyBuilder->DefineComponentInstance(father, CompMesh ); + mySComponentMesh = SALOMEDS::SComponent::_narrow( father ); + + // Tags definition + Tag_HypothesisRoot = 1; + Tag_AlgorithmsRoot = 2; + + Tag_RefOnShape = 1; + Tag_RefOnAppliedHypothesis = 2; + Tag_RefOnAppliedAlgorithms = 3; + + Tag_SubMeshOnVertex = 4; + Tag_SubMeshOnEdge = 5; + Tag_SubMeshOnFace = 6; + Tag_SubMeshOnSolid = 7; + Tag_SubMeshOnCompound = 8; +} + +SMESH_Swig::~SMESH_Swig() +{ + MESSAGE("Destructeur"); +} + + +const char* SMESH_Swig::AddNewMesh(const char* IOR) +{ + MESSAGE("AddNewMesh"); + //Find or Create Hypothesis root + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + SALOMEDS::SObject_var HypothesisRoot; + if (!mySComponentMesh->FindSubObject (Tag_HypothesisRoot, HypothesisRoot)) { + HypothesisRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + + SALOMEDS::SObject_var AlgorithmsRoot; + if (!mySComponentMesh->FindSubObject (Tag_AlgorithmsRoot, AlgorithmsRoot)) { + AlgorithmsRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_ALGORITHMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + + // Add New Mesh + SALOMEDS::SObject_var newMesh = myStudyBuilder->NewObject(mySComponentMesh); + anAttr = myStudyBuilder->FindOrCreateAttribute(newMesh, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newMesh, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IOR); + return SALOMEDS::SObject::_narrow( newMesh )->GetID(); +} + +const char* SMESH_Swig::AddNewHypothesis(const char* IOR) +{ + MESSAGE("AddNewHypothesis"); + //Find or Create Hypothesis root + SALOMEDS::SObject_var HypothesisRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!mySComponentMesh->FindSubObject (Tag_HypothesisRoot, HypothesisRoot)) { + HypothesisRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(HypothesisRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + } + // Add New Hypothesis + SALOMEDS::SObject_var newHypo = myStudyBuilder->NewObject(HypothesisRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + SMESH::SMESH_Hypothesis_var H = SMESH::SMESH_Hypothesis::_narrow( StringToObject(IOR) ); + QString aType = H->GetName(); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_" + aType ); +// if ( aType.compare("LocalLength") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_LENGTH" ); +// else if ( aType.compare("NumberOfSegments") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_SEGMENT" ); +// else if ( aType.compare("MaxElementArea") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_AREA" ); +// else if ( aType.compare("MaxElementVolume") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO_VOLUME" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IOR); + return SALOMEDS::SObject::_narrow(newHypo)->GetID(); +} + +const char* SMESH_Swig::AddNewAlgorithms(const char* IOR) +{ + MESSAGE("AddNewAlgorithms"); + //Find or Create Algorithms root + SALOMEDS::SObject_var AlgorithmsRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if (!mySComponentMesh->FindSubObject (Tag_AlgorithmsRoot, AlgorithmsRoot)) { + AlgorithmsRoot = myStudyBuilder->NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_ALGORITHMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + } + // Add New Algorithms + SALOMEDS::SObject_var newHypo = myStudyBuilder->NewObject(AlgorithmsRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + SMESH::SMESH_Hypothesis_var H = SMESH::SMESH_Hypothesis::_narrow( StringToObject(IOR) ); + QString aType = H->GetName(); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_" + aType ); +// if ( aType.compare("Regular_1D") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_REGULAR" ); +// else if ( aType.compare("MEFISTO_2D") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_MEFISTO" ); +// else if ( aType.compare("Quadrangle_2D") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_QUAD" ); +// else if ( aType.compare("Hexa_3D") == 0 ) +// aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO_HEXA" ); + anAttr = myStudyBuilder->FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(IOR); + return SALOMEDS::SObject::_narrow(newHypo)->GetID(); +} + +void SMESH_Swig::SetShape(const char* ShapeEntry, const char* MeshEntry) +{ + SALOMEDS::SObject_var SO_MorSM = myStudy->FindObjectID( MeshEntry ); + SALOMEDS::SObject_var SO_GeomShape = myStudy->FindObjectID( ShapeEntry ); + + if ( !SO_MorSM->_is_nil() && !SO_GeomShape->_is_nil() ) { + SALOMEDS::SObject_var SO = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnShape); + myStudyBuilder->Addreference (SO,SO_GeomShape); + } +} + +void SMESH_Swig::SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry) +{ + SALOMEDS::SObject_var SO_MorSM = myStudy->FindObjectID( Mesh_Or_SubMesh_Entry ); + SALOMEDS::SObject_var SO_Hypothesis = myStudy->FindObjectID( Hypothesis_Entry ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if ( !SO_MorSM->_is_nil() && !SO_Hypothesis->_is_nil() ) { + + //Find or Create Applied Hypothesis root + SALOMEDS::SObject_var AHR; + if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedHypothesis, AHR)) { + AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" ); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR); + myStudyBuilder->Addreference (SO,SO_Hypothesis); + } +} +void SMESH_Swig::SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry) +{ + SALOMEDS::SObject_var SO_MorSM = myStudy->FindObjectID( Mesh_Or_SubMesh_Entry ); + SALOMEDS::SObject_var SO_Algorithms = myStudy->FindObjectID( Algorithms_Entry ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeSelectable_var aSelAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + if ( !SO_MorSM->_is_nil() && !SO_Algorithms->_is_nil() ) { + //Find or Create Applied Algorithms root + SALOMEDS::SObject_var AHR; + if (!SO_MorSM->FindSubObject (Tag_RefOnAppliedAlgorithms, AHR)) { + AHR = myStudyBuilder->NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS")); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + anAttr = myStudyBuilder->FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_SMESH_TREE_ALGO" ); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject(AHR); + myStudyBuilder->Addreference (SO,SO_Algorithms); + } +} + +void SMESH_Swig::UnSetHypothesis(const char* Applied_Hypothesis_Entry ) +{ + SALOMEDS::SObject_var SO_Applied_Hypothesis = myStudy->FindObjectID( Applied_Hypothesis_Entry ); + if ( !SO_Applied_Hypothesis->_is_nil() ) + myStudyBuilder->RemoveObject(SO_Applied_Hypothesis); +} + + +const char* SMESH_Swig::AddSubMesh(const char* SO_Mesh_Entry, const char* SM_IOR, int ST) +{ + SALOMEDS::SObject_var SO_Mesh = myStudy->FindObjectID( SO_Mesh_Entry ); + if ( !SO_Mesh->_is_nil() ) { + + long Tag_Shape ; + Standard_CString Name; + + if (ST == TopAbs_SOLID) {Tag_Shape = Tag_SubMeshOnSolid; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnSolid"));} + else if (ST == TopAbs_FACE) {Tag_Shape = Tag_SubMeshOnFace; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnFace"));} + else if (ST == TopAbs_EDGE) {Tag_Shape = Tag_SubMeshOnEdge; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnEdge"));} + else if (ST == TopAbs_VERTEX){Tag_Shape = Tag_SubMeshOnVertex; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnVertex"));} + else { + Tag_Shape = Tag_SubMeshOnCompound; Name = strdup(QObject::tr("SMESH_MEN_SubMeshesOnCompound")); + } + SALOMEDS::SObject_var SubmeshesRoot; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + if (!SO_Mesh->FindSubObject (Tag_Shape,SubmeshesRoot )) { + SubmeshesRoot = myStudyBuilder->NewObjectToTag (SO_Mesh, Tag_Shape); + anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(Name); + anAttr = myStudyBuilder->FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + } + SALOMEDS::SObject_var SO = myStudyBuilder->NewObject (SubmeshesRoot); + anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(SM_IOR); + return SALOMEDS::SObject::_narrow( SO )->GetID(); + } + return ""; +} + +const char* SMESH_Swig::AddSubMeshOnShape(const char* Mesh_Entry, const char* GeomShape_Entry, + const char* SM_IOR, int ST) +{ + SALOMEDS::SObject_var SO_GeomShape = myStudy->FindObjectID( GeomShape_Entry ); + if ( !SO_GeomShape->_is_nil() ) { + const char * SM_Entry = AddSubMesh (Mesh_Entry,SM_IOR,ST); + SALOMEDS::SObject_var SO_SM = myStudy->FindObjectID( SM_Entry ); + if ( !SO_SM->_is_nil() ) { + SetShape (GeomShape_Entry, SM_Entry); + return SALOMEDS::SObject::_narrow( SO_SM )->GetID(); + } + } + return ""; +} + +void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry ) +{ + // SMESH_Actor* Mesh = smeshGUI->ReadScript(aM); +} + +void SMESH_Swig::SetName(const char* Entry, const char* Name) +{ + SALOMEDS::SObject_var SO = myStudy->FindObjectID( Entry ); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if ( !SO->_is_nil() ) { + anAttr = myStudyBuilder->FindOrCreateAttribute(SO, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(Name); + } +} + + +void SMESH_Swig::setOrb() +{ + try { + ORB_INIT &init = *SINGLETON_::Instance(); + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init( 0 , 0 ); + } catch (...) { + INFOS("internal error : orb not found"); + _orb = 0; + } + ASSERT(! CORBA::is_nil(_orb)); +} diff --git a/src/SMESHGUI/SMESHGUI_Swig.hxx b/src/SMESHGUI/SMESHGUI_Swig.hxx new file mode 100644 index 000000000..d502517a3 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Swig.hxx @@ -0,0 +1,69 @@ +// File : SMESHGUI_Swig.hxx +// Created : Mon Jun 17 13:41:12 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef _SMESHGUI_SWIG_HXX_ +#define _SMESHGUI_SWIG_HXX_ + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SMESH_Swig +{ +public: + SMESH_Swig(); + ~SMESH_Swig(); + + static void setOrb(); + + void Init(int studyID); + + const char* AddNewMesh(const char* IOR); + + const char* AddNewHypothesis(const char* IOR); + const char* AddNewAlgorithms(const char* IOR); + + void SetShape(const char* ShapeEntry, const char* MeshEntry); + + void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry); + void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry); + + void UnSetHypothesis(const char* Applied_Hypothesis_Entry ); + + const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST); + const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST); + + void CreateAndDisplayActor( const char* Mesh_Entry ); + + void SetName(const char* Entry, const char* Name); + +private: + SALOMEDS::Study_var myStudy; + SALOMEDS::StudyBuilder_var myStudyBuilder; + SALOMEDS::SComponent_var mySComponentMesh; + + // Tags definition + long Tag_HypothesisRoot; + long Tag_AlgorithmsRoot; + + long Tag_RefOnShape; + long Tag_RefOnAppliedHypothesis; + long Tag_RefOnAppliedAlgorithms; + + long Tag_SubMeshOnVertex; + long Tag_SubMeshOnEdge; + long Tag_SubMeshOnFace; + long Tag_SubMeshOnSolid; + long Tag_SubMeshOnCompound; +}; + + +#endif diff --git a/src/SMESHGUI/SMESHGUI_Swig.i b/src/SMESHGUI/SMESHGUI_Swig.i new file mode 100644 index 000000000..d53badd3a --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Swig.i @@ -0,0 +1,40 @@ +// File : SMESHGUI_Swig.i +// Created : Mon Jun 17 13:40:36 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +%{ +#include "SMESHGUI_Swig.hxx" +%} + +%include "typemaps.i" + +class SMESH_Swig +{ + public: + SMESH_Swig(); + ~SMESH_Swig(); + + void Init(int studyID); + + const char* AddNewMesh(const char* IOR); + const char* AddNewHypothesis(const char* IOR); + const char* AddNewAlgorithms(const char* IOR); + + void SetShape(const char* ShapeEntry, const char* MeshEntry); + + void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry); + void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry); + + void UnSetHypothesis(const char* Applied_Hypothesis_Entry ); + + const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST); + const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST); + + void SetName(const char* Entry, const char* Name); +}; diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx new file mode 100644 index 000000000..cb35a3538 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx @@ -0,0 +1,191 @@ +using namespace std; +// File : SMESHGUI_TransparencyDlg.cxx +// Created : Thu Jun 06 16:41:42 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#include "SMESHGUI_TransparencyDlg.h" +#include "SMESHGUI.h" + +#include "VTKViewer_ViewFrame.h" +#include "VTKViewer_RenderWindowInteractor.h" +#include "QAD_RightFrame.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +// QT Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//================================================================================= +// class : SMESHGUI_TransparencyDlg() +// purpose : +// +//================================================================================= +SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( QWidget* parent, + const char* name, + SALOME_Selection* Sel, + bool modal, + WFlags fl ) + : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + if ( !name ) + setName( "SMESHGUI_TransparencyDlg" ); + resize( 152, 107 ); + setCaption( tr( "SMESH_TRANSPARENCY_TITLE" ) ); + setSizeGripEnabled( TRUE ); + SMESHGUI_TransparencyDlgLayout = new QGridLayout( this ); + SMESHGUI_TransparencyDlgLayout->setSpacing( 6 ); + SMESHGUI_TransparencyDlgLayout->setMargin( 11 ); + + /*************************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "GEOM_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 ); + GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 ); + + /*************************************************************************/ + QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); + TextLabelOpaque->setText( tr( "SMESH_TRANSPARENCY_OPAQUE" ) ); + TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); + GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); + GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + + TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); + TextLabelTransparent->setText( tr( "SMESH_TRANSPARENCY_TRANSPARENT" ) ); + TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) ); + GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); + + Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" ); + Slider1->setMinimumSize( 300, 0 ); + Slider1->setTickmarks( QSlider::Left ); + GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); + + SMESHGUI_TransparencyDlgLayout->addWidget( GroupC1, 0, 0 ); + SMESHGUI_TransparencyDlgLayout->addWidget( GroupButtons, 1, 0 ); + + /* Initialisations */ + this->mySMESHGUI = SMESHGUI::GetSMESHGUI() ; + this->mySel = Sel ; + + /* First call valueChanged() method for initialisation */ + /* The default value of transparency will change with the selection */ + this->myFirstInit = true ; +// Slider1->setMaxValue( 10 ); +// Slider1->setValue( 5 ) ; + + + this->ValueHasChanged( Slider1->value() ) ; + + // signals and slots connections : after ValueHasChanged() + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( Slider1, SIGNAL( valueChanged(int) ), this, SLOT( ValueHasChanged(int) ) ); + + /* Move widget on the botton right corner of main widget */ + int x, y ; + mySMESHGUI->DefineDlgPosition( this, x, y ) ; + this->move( x, y ) ; + this->show() ; /* Displays this Dialog */ +} + + + + +//================================================================================= +// function : ~SMESHGUI_TransparencyDlg() +// purpose : +//================================================================================= +SMESHGUI_TransparencyDlg::~SMESHGUI_TransparencyDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//======================================================================= +// function : ClickOnOk() +// purpose : +//======================================================================= +void SMESHGUI_TransparencyDlg::ClickOnOk() +{ + accept() ; + return ; +} + + +//======================================================================= +// function : ClickOnClose() +// purpose : +//======================================================================= +void SMESHGUI_TransparencyDlg::ClickOnClose() +{ + accept() ; + return ; +} + + +//================================================================================= +// function : ValueHasChanged() +// purpose : Called when value of slider change +// : or the first time as initilisation +//================================================================================= +void SMESHGUI_TransparencyDlg::ValueHasChanged( int newValue ) +{ + + if ( mySMESHGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)mySMESHGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + SALOME_ListIteratorOfListIO It( this->mySel->StoredIObjects() ); + Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); + if( !FirstIOS.IsNull() ) { + /* The first time as initialisation */ + if( this->myFirstInit ) { + this->myFirstInit = false ; + float transp = ( myRenderInter->GetTransparency(FirstIOS))*10.0 ; + this->Slider1->setValue( int(transp) ) ; + return; + } + } + + QApplication::setOverrideCursor( Qt::waitCursor ); + for( ;It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SetTransparency( IOS, newValue/10.0 ); + } + QApplication::restoreOverrideCursor(); + } + QApplication::restoreOverrideCursor(); + return ; +} diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.h b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h new file mode 100644 index 000000000..7eaeee1f7 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h @@ -0,0 +1,71 @@ +// File : SMESHGUI_TransparencyDlg.h +// Created : Thu Jun 06 16:41:57 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + + +#ifndef DIALOGBOX_TRANSPARENCYDLG_H +#define DIALOGBOX_TRANSPARENCYDLG_H + +#include "SALOME_Selection.h" +#include "SALOME_InteractiveObject.hxx" + +// QT Includes +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QPushButton; +class QSlider; +class SMESHGUI; + +//================================================================================= +// class : SMESHGUI_TransparencyDlg +// purpose : +//================================================================================= +class SMESHGUI_TransparencyDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_TransparencyDlg( QWidget* parent = 0, + const char* name = 0, + SALOME_Selection* Sel = 0, + bool modal = TRUE, + WFlags fl = 0 ); + + ~SMESHGUI_TransparencyDlg(); + +private : + + SMESHGUI* mySMESHGUI ; /* Current GeomGUI object */ + bool myFirstInit ; /* Inform for the first init */ + SALOME_Selection* mySel; /* User selection */ + + QPushButton* buttonOk; + QLabel* TextLabelOpaque; + QLabel* TextLabelTransparent; + QSlider* Slider1; + +public slots: + + void ClickOnOk(); + void ClickOnClose(); + void ValueHasChanged( int newValue ) ; + +protected: + QGridLayout* SMESHGUI_TransparencyDlgLayout; + QHBoxLayout* Layout1; + QHBoxLayout* Layout2; +}; + +#endif // DIALOGBOX_TRANSPARENCYDLG_H + diff --git a/src/SMESHGUI/SMESHGUI_aParameterDlg.cxx b/src/SMESHGUI/SMESHGUI_aParameterDlg.cxx new file mode 100644 index 000000000..d4c27bc10 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_aParameterDlg.cxx @@ -0,0 +1,234 @@ +using namespace std; +// File : SMESHGUI_aParameterDlg.cxx +// Created : Wed Jun 12 21:06:21 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESHGUI_aParameterDlg.h" +#include "SMESHGUI.h" +#include "QAD_SpinBoxDbl.h" +#include "QAD_Tools.h" + +// QT Includes +#include +#include +#include +#include +#include +#include + +//====================================================================================== +// function : SMESHGUI_aParameterDlg() +// purpose : Constructs a SMESHGUI_aParametertDlg for double values +// +// parent : parent widget +// title : is the title for the user in dialog box +// label : text label for the value +// +// bottom : the minimal value to be entered +// top : the maximum value to be entered +// decimals : number of decimals to be entered +// +// The dialog will by default be modal, unless you set 'modal' to +// false when constructing dialog +// +//====================================================================================== +SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg( QWidget* parent, + QString title, + QString label, + const double bottom, + const double top, + const int decimals, + bool modal ) +: QDialog( parent, "MyParameterDialog", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + myIntSpin( 0 ), myDblSpin( 0 ) +{ + /* creating widgets */ + init( true ); + /* title */ + setCaption( title ); + /* caption */ + myTextLabel->setText( label ); + /* range */ + myDblSpin->setRange( bottom, top ); + ((QDoubleValidator*)(myDblSpin->validator()))->setRange( bottom, top, decimals ); + + /* Move widget on the botton right corner of main widget */ + QAD_Tools::centerWidget( this, parent ); +} + +//====================================================================================== +// function : SMESHGUI_aParameterDlg() +// purpose : Constructs a SMESHGUI_aParametertDlg for int values +// +// parent : parent widget +// title : is the title for the user in dialog box +// label : text label for the value +// +// bottom : the minimal value to be entered +// top : the maximum value to be entered +// +// The dialog will by default be modal, unless you set 'modal' to +// false when constructing dialog +// +//====================================================================================== +SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg( QWidget* parent, + QString title, + QString label, + const int bottom, + const int top, + bool modal ) +: QDialog( parent, "MyParameterDialog", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + myIntSpin( 0 ), myDblSpin( 0 ) +{ + /* creating widgets */ + init( false ); + /* title */ + setCaption( title ); + /* caption */ + myTextLabel->setText( label ); + /* range */ + myIntSpin->setRange( bottom, top ); + ((QIntValidator*)(myIntSpin->validator()))->setRange( bottom, top ); + + /* Move widget on the botton right corner of main widget */ + QAD_Tools::centerWidget( this, parent ); +} + +//====================================================================================== +// function : SMESHGUI_aParameterDlg::init() +// purpose : creates dialog's layout +//====================================================================================== +void SMESHGUI_aParameterDlg::init( bool isDouble ) +{ + setSizeGripEnabled( TRUE ); + + QGridLayout* topLayout = new QGridLayout( this ); + topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); + + /***************************************************************/ + QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + /* Label */ + /* aTitle1 : text prompt on left of edit line */ + myTextLabel = new QLabel( GroupC1, "TextLabel" ); + GroupC1Layout->addWidget( myTextLabel, 0, 0 ); + /* Spin box */ + if ( isDouble ) { + myIntSpin = 0; + myDblSpin = new QAD_SpinBoxDbl( GroupC1 ); + myDblSpin->setPrecision( 12 ); + myDblSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + myDblSpin->setMinimumSize( 150, 0 ); + GroupC1Layout->addWidget( myDblSpin, 0, 1 ); + } + else { + myDblSpin = 0; + myIntSpin = new QSpinBox( GroupC1 ); + myIntSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); + myIntSpin->setMinimumSize( 150, 0 ); + GroupC1Layout->addWidget( myIntSpin, 0, 1 ); + } + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + /* Ok button */ + myButtonOk = new QPushButton( GroupButtons, "buttonOk" ); + myButtonOk->setText( tr("SMESH_BUT_OK") ); + myButtonOk->setAutoDefault( TRUE ); + myButtonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( myButtonOk, 0, 0 ); + /* add spacer between buttons */ + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + /* Cancel button */ + myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + myButtonCancel->setText( tr("SMESH_BUT_CANCEL") ); + myButtonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( myButtonCancel, 0, 2 ); + + /***************************************************************/ + topLayout->addWidget( GroupC1, 0, 0); + topLayout->addWidget( GroupButtons, 1, 0); + + /* signals and slots connections */ + connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + + /* Retrieve SMESHGUI */ + mySMESHGUI = SMESHGUI::GetSMESHGUI() ; +} + + +//====================================================================================== +// function : ~SMESHGUI_aParameterDlg() +// purpose : Destructor +//====================================================================================== +SMESHGUI_aParameterDlg::~SMESHGUI_aParameterDlg() +{ +} + +//====================================================================================== +// function : SMESHGUI_aParameterDlg::setValue +// purpose : sets double value +//====================================================================================== +void SMESHGUI_aParameterDlg::setValue( const double val ) +{ + if ( myDblSpin ) + myDblSpin->setValue( val ); +} +//====================================================================================== +// function : SMESHGUI_aParameterDlg::setValue +// purpose : sets int value +//====================================================================================== +void SMESHGUI_aParameterDlg::setValue( const int val ) +{ + if ( myIntSpin ) + myIntSpin->setValue( val ); +} +//====================================================================================== +// function : SMESHGUI_aParameterDlg::getDblValue +// purpose : returns double value entered by user +//====================================================================================== +double SMESHGUI_aParameterDlg::getDblValue() +{ + if ( myDblSpin ) + return myDblSpin->value(); + return 0.0; +} + +//====================================================================================== +// function : SMESHGUI_aParameterDlg::getIntValu +// purpose : returns int value entered by user +//====================================================================================== +int SMESHGUI_aParameterDlg::getIntValue() +{ + if ( myIntSpin ) + return myIntSpin->value(); + return 0; +} + + + + + + + + + diff --git a/src/SMESHGUI/SMESHGUI_aParameterDlg.h b/src/SMESHGUI/SMESHGUI_aParameterDlg.h new file mode 100644 index 000000000..cd7a7e056 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_aParameterDlg.h @@ -0,0 +1,65 @@ +// File : SMESHGUI_aParameterDlg.h +// Created : Wed Jun 12 21:04:41 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef SMESHGUI_aParameterDlg_H +#define SMESHGUI_aParameterDlg_H + +// QT Includes +#include + +class QLabel; +class QPushButton; +class QSpinBox; +class SMESHGUI; +class QAD_SpinBoxDbl; + +//================================================================================= +// class : SMESHGUI_aParameterDlg +// purpose : +//================================================================================= +class SMESHGUI_aParameterDlg : public QDialog +{ + Q_OBJECT + +public: + SMESHGUI_aParameterDlg( QWidget* parent = 0, + QString title = QString::null, + QString label = QString::null, + const double bottom = -1E6, + const double top = +1E6, + const int decimals = 3, + bool modal = TRUE ); + SMESHGUI_aParameterDlg( QWidget* parent = 0, + QString title = QString::null, + QString label = QString::null, + const int bottom = 0, + const int top = 1000, + bool modal = TRUE ); + + ~SMESHGUI_aParameterDlg(); + + void setValue( const double val ); + void setValue( const int val ); + double getDblValue(); + int getIntValue(); + +protected: + void init( bool isDouble ); + +private: + SMESHGUI* mySMESHGUI ; + + QPushButton* myButtonOk; + QPushButton* myButtonCancel; + QLabel* myTextLabel; + QSpinBox* myIntSpin; + QAD_SpinBoxDbl* myDblSpin; +}; + +#endif // SMESHGUI_aParameterDlg.h diff --git a/src/SMESH_I/Makefile.in b/src/SMESH_I/Makefile.in new file mode 100644 index 000000000..23442cf8b --- /dev/null +++ b/src/SMESH_I/Makefile.in @@ -0,0 +1,63 @@ +#============================================================================== +# File : Makefile.in +# Created : mar mai 21 09:12:43 CEST 2002 +# Author : Paul RASCLE, EDF +# Project : SALOME +# Copyright : EDF 2002 +# $Header$ +#============================================================================== + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + + +@COMMENCE@ + +EXPORT_PYSCRIPTS = smeshpy.py SMESH_test.py + +# Libraries targets + +LIB= libSMESHEngine.la + +LIB_SRC = SMESH_Gen_i.cxx SMESH_Mesh_i.cxx SMESH_MEDMesh_i.cxx \ + SMESH_MEDFamily_i.cxx SMESH_MEDSupport_i.cxx \ + SMESH_subMesh_i.cxx \ + SMESH_MeshEditor_i.cxx \ + SMESH_Hypothesis_i.cxx \ + SMESH_topo.cxx SMESH_HypothesisFactory_i.cxx \ + SMESH_Algo_i.cxx \ + SMESH_1D_Algo_i.cxx \ + SMESH_2D_Algo_i.cxx \ + SMESH_3D_Algo_i.cxx \ + SMESH_NumberOfSegments_i.cxx \ + SMESH_LocalLength_i.cxx \ + SMESH_MaxElementArea_i.cxx \ + SMESH_MaxElementVolume_i.cxx \ + SMESH_Regular_1D_i.cxx \ + SMESH_Quadrangle_2D_i.cxx \ + SMESH_MEFISTO_2D_i.cxx \ + SMESH_Hexa_3D_i.cxx + +LIB_SERVER_IDL = SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Mesh.idl \ + SALOME_Component.idl SALOME_Exception.idl \ + SMESH_BasicHypothesis.idl + +LIB_CLIENT_IDL = SALOMEDS.idl GEOM_Gen.idl GEOM_Shape.idl MED.idl SALOMEDS_Attributes.idl + +# Executables targets +BIN = +BIN_SRC = + +# additionnal information to compil and link file +CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) +CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) + +#IDLCXXFLAGS+= -Wbtp + +LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGeometryClient -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverMED -lSalomeLifeCycleCORBA + +@CONCLUDE@ + diff --git a/src/SMESH_I/SMESH_1D_Algo_i.cxx b/src/SMESH_I/SMESH_1D_Algo_i.cxx new file mode 100644 index 000000000..b2a41e62e --- /dev/null +++ b/src/SMESH_I/SMESH_1D_Algo_i.cxx @@ -0,0 +1,52 @@ +using namespace std; +//============================================================================= +// File : SMESH_1D_Algo_i.cxx +// Created : sam mai 18 09:23:13 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_1D_Algo_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo_i::SMESH_1D_Algo_i() +{ + MESSAGE("SMESH_1D_Algo_i::SMESH_1D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo_i::~SMESH_1D_Algo_i() +{ + MESSAGE("SMESH_1D_Algo_i::~SMESH_1D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_1D_Algo_i::SetImpl(::SMESH_1D_Algo* impl) +{ + MESSAGE("SMESH_1D_Algo_i::SetImpl"); + SMESH_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_1D_Algo_i.hxx b/src/SMESH_I/SMESH_1D_Algo_i.hxx new file mode 100644 index 000000000..63fb2dcaf --- /dev/null +++ b/src/SMESH_I/SMESH_1D_Algo_i.hxx @@ -0,0 +1,35 @@ +//============================================================================= +// File : SMESH_1D_Algo_i.hxx +// Created : sam mai 18 09:23:09 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_1D_ALGO_I_HXX_ +#define _SMESH_1D_ALGO_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +#include "SMESH_Algo_i.hxx" + +#include "SMESH_1D_Algo.hxx" + +class SMESH_1D_Algo_i: + public POA_SMESH::SMESH_1D_Algo, + public SMESH_Algo_i +{ +public: + SMESH_1D_Algo_i(); + + virtual ~SMESH_1D_Algo_i(); + +protected: + virtual void SetImpl(::SMESH_1D_Algo* impl); + + ::SMESH_1D_Algo* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_2D_Algo_i.cxx b/src/SMESH_I/SMESH_2D_Algo_i.cxx new file mode 100644 index 000000000..7226130a3 --- /dev/null +++ b/src/SMESH_I/SMESH_2D_Algo_i.cxx @@ -0,0 +1,52 @@ +using namespace std; +//============================================================================= +// File : SMESH_2D_Algo_i.cxx +// Created : sam mai 18 09:23:51 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_2D_Algo_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo_i::SMESH_2D_Algo_i() +{ + MESSAGE("SMESH_2D_Algo_i::SMESH_2D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo_i::~SMESH_2D_Algo_i() +{ + MESSAGE("SMESH_2D_Algo_i::~SMESH_2D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_2D_Algo_i::SetImpl(::SMESH_2D_Algo* impl) +{ + MESSAGE("SMESH_2D_Algo_i::SetImpl"); + SMESH_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_2D_Algo_i.hxx b/src/SMESH_I/SMESH_2D_Algo_i.hxx new file mode 100644 index 000000000..a63106c5d --- /dev/null +++ b/src/SMESH_I/SMESH_2D_Algo_i.hxx @@ -0,0 +1,35 @@ +//============================================================================= +// File : SMESH_2D_Algo_i.hxx +// Created : sam mai 18 09:23:57 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_2D_ALGO_I_HXX_ +#define _SMESH_2D_ALGO_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +#include "SMESH_Algo_i.hxx" + +#include "SMESH_2D_Algo.hxx" + +class SMESH_2D_Algo_i: + public POA_SMESH::SMESH_2D_Algo, + public SMESH_Algo_i +{ +public: + SMESH_2D_Algo_i(); + + virtual ~SMESH_2D_Algo_i(); + +protected: + virtual void SetImpl(::SMESH_2D_Algo* impl); + + ::SMESH_2D_Algo* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_3D_Algo_i.cxx b/src/SMESH_I/SMESH_3D_Algo_i.cxx new file mode 100644 index 000000000..02dd6899a --- /dev/null +++ b/src/SMESH_I/SMESH_3D_Algo_i.cxx @@ -0,0 +1,52 @@ +using namespace std; +//============================================================================= +// File : SMESH_3D_Algo_i.cxx +// Created : sam mai 18 09:25:00 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_3D_Algo_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo_i::SMESH_3D_Algo_i() +{ + MESSAGE("SMESH_3D_Algo_i::SMESH_3D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo_i::~SMESH_3D_Algo_i() +{ + MESSAGE("SMESH_3D_Algo_i::~SMESH_3D_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_3D_Algo_i::SetImpl(::SMESH_3D_Algo* impl) +{ + MESSAGE("SMESH_3D_Algo_i::SetImpl"); + SMESH_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_3D_Algo_i.hxx b/src/SMESH_I/SMESH_3D_Algo_i.hxx new file mode 100644 index 000000000..cab4858a3 --- /dev/null +++ b/src/SMESH_I/SMESH_3D_Algo_i.hxx @@ -0,0 +1,35 @@ +//============================================================================= +// File : SMESH_3D_Algo_i.hxx +// Created : sam mai 18 09:25:05 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_3D_ALGO_I_HXX_ +#define _SMESH_3D_ALGO_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +#include "SMESH_Algo_i.hxx" + +class SMESH_3D_Algo; + +class SMESH_3D_Algo_i: + public POA_SMESH::SMESH_3D_Algo, + public SMESH_Algo_i +{ +public: + SMESH_3D_Algo_i(); + + virtual ~SMESH_3D_Algo_i(); + +protected: + virtual void SetImpl(::SMESH_3D_Algo* impl); + + ::SMESH_3D_Algo* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Algo_i.cxx b/src/SMESH_I/SMESH_Algo_i.cxx new file mode 100644 index 000000000..f5889c1e3 --- /dev/null +++ b/src/SMESH_I/SMESH_Algo_i.cxx @@ -0,0 +1,76 @@ +using namespace std; +//============================================================================= +// File : SMESH_Algo_i.cxx +// Created : sam mai 18 09:21:02 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Algo_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo_i::SMESH_Algo_i() +{ + MESSAGE("SMESH_Algo_i::SMESH_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo_i::~SMESH_Algo_i() +{ + MESSAGE("SMESH_Algo_i::~SMESH_Algo_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::ListOfHypothesisName* SMESH_Algo_i::GetCompatibleHypothesis() +{ + MESSAGE("SMESH_Algo_i::GetCompatibleHypothesis"); + SMESH::ListOfHypothesisName_var listOfHypothesis + = new SMESH::ListOfHypothesisName; + const vector & hypList = _impl->GetCompatibleHypothesis(); + int nbHyp = hypList.size(); + listOfHypothesis->length(nbHyp); + for (int i=0; i +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +#include "SMESH_Hypothesis_i.hxx" + +#include "SMESH_Algo.hxx" + +class SMESH_Algo_i: + public POA_SMESH::SMESH_Algo, + public SMESH_Hypothesis_i +{ +public: + SMESH_Algo_i(); + + virtual ~SMESH_Algo_i(); + + SMESH::ListOfHypothesisName* GetCompatibleHypothesis(); + +protected: + virtual void SetImpl(::SMESH_Algo* impl); + + ::SMESH_Algo* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx new file mode 100644 index 000000000..113b80eb0 --- /dev/null +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -0,0 +1,1706 @@ +using namespace std; +//============================================================================= +// File : SMESH_Gen_i.cxx +// Created : lun mai 6 13:41:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "SMESH_Gen_i.hxx" +#include "SMESH_Mesh_i.hxx" +#include "SMESH_LocalLength_i.hxx" +#include "SMESH_NumberOfSegments_i.hxx" +#include "SMESH_MaxElementArea_i.hxx" + +#include "SMESHDS_Document.hxx" + +#include "Document_Reader.h" +#include "DriverMED_W_SMESHDS_Mesh.h" +#include "DriverMED_R_SMESHDS_Mesh.h" +#include "DriverMED_R_SMESHDS_Document.h" +#include "DriverUNV_R_SMESHDS_Document.h" +#include "DriverDAT_R_SMESHDS_Document.h" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +#include "SALOMEDS_Tool.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "Utils_SINGLETON.hxx" +#include "OpUtil.hxx" + +//#include + +#include "GEOM_Client.hxx" + +#include + +#define NUM_TMP_FILES 4 + +// Tags definition +long Tag_HypothesisRoot = 1; +long Tag_AlgorithmsRoot = 2; + +long Tag_RefOnShape = 1; +long Tag_RefOnAppliedHypothesis = 2; +long Tag_RefOnAppliedAlgorithms = 3; + +long Tag_SubMeshOnVertex = 4; +long Tag_SubMeshOnEdge = 5; +long Tag_SubMeshOnFace = 6; +long Tag_SubMeshOnSolid = 7; +long Tag_SubMeshOnCompound = 8; + + +//============================================================================= +/*! + * default constructor: not for use + */ +//============================================================================= + +SMESH_Gen_i::SMESH_Gen_i() +{ + MESSAGE("SMESH_Gen_i default constructor"); + // **** +} + +//============================================================================= +/*! + * Standard constructor, used with Container. + */ +//============================================================================= + +SMESH_Gen_i::SMESH_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName) +{ + MESSAGE("activate object"); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + + _ShapeReader = NULL; + _localId = 0; // number of created objects & local id + +} + +//============================================================================= +/*! + * Standard destructor + */ +//============================================================================= + +SMESH_Gen_i::~SMESH_Gen_i() +{ + MESSAGE("~SMESH_Gen_i"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis(const char* anHyp, + CORBA::Long studyId) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("CreateHypothesis"); + + // create a new hypothesis object servant + + SMESH_Hypothesis_i* myHypothesis_i = 0; + try + { + myHypothesis_i = _hypothesisFactory_i.Create(anHyp, + studyId, + &_impl); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + // activate the CORBA servant of hypothesis + + SMESH::SMESH_Hypothesis_var hypothesis_i + = SMESH::SMESH_Hypothesis::_narrow(myHypothesis_i->_this()); + return SMESH::SMESH_Hypothesis::_duplicate(hypothesis_i); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Init(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Init"); + // _narrow() duplicates the reference and checks the type + GEOM::GEOM_Gen_var geom = GEOM::GEOM_Gen::_narrow(geomEngine); + GEOM::GEOM_Shape_var myShape = GEOM::GEOM_Shape::_narrow(aShape); + + if (CORBA::is_nil(geom)) + THROW_SALOME_CORBA_EXCEPTION("bad geom reference", \ + SALOME::BAD_PARAM); + if (CORBA::is_nil(myShape)) + THROW_SALOME_CORBA_EXCEPTION("bad shape reference", \ + SALOME::BAD_PARAM); + + // Get or create the GEOM_Client instance + + SMESH_Mesh_i* meshServant = 0; + try + { + if (! _ShapeReader) _ShapeReader = new GEOM_Client(); + ASSERT(_ShapeReader); + + // explore main Shape, get local TopoDS_Shapes of all subShapes + // SMESH_topo* myTopo = ExploreMainShape(geom, studyId, myShape); + + // Get studyContext_i, create it if it does'nt exist + + if (_mapStudyContext_i.find(studyId) == _mapStudyContext_i.end()) + { + _mapStudyContext_i[studyId] = new StudyContext_iStruct; + } + StudyContext_iStruct* myStudyContext = _mapStudyContext_i[studyId]; + + // create a new mesh object servant, store it in a map in study context + + meshServant = new SMESH_Mesh_i(this, + geom, + studyId, + _localId); + myStudyContext->mapMesh_i[_localId] = meshServant; + _localId++; + + // create a new mesh object + + TopoDS_Shape myLocShape = _ShapeReader->GetShape(geom,myShape); + meshServant->SetImpl(_impl.Init(studyId, myLocShape)); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + // activate the CORBA servant of Mesh + + SMESH::SMESH_Mesh_var mesh + = SMESH::SMESH_Mesh::_narrow(meshServant->_this()); + + meshServant->SetIor(mesh); + + return SMESH::SMESH_Mesh::_duplicate(mesh); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_Gen_i::IsReadyToCompute(SMESH::SMESH_Mesh_ptr aMesh, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Gen_i::IsReadyToCompute"); + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + + SMESH::long_array* + SMESH_Gen_i::GetSubShapesId(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr mainShape, + const SMESH::shape_array& listOfSubShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Gen_i::GetSubShapesId"); + SMESH::long_array_var shapesId = new SMESH::long_array; + set setId; + + GEOM::GEOM_Gen_var geom = GEOM::GEOM_Gen::_narrow(geomEngine); + GEOM::GEOM_Shape_var myShape = GEOM::GEOM_Shape::_narrow(mainShape); + + if (CORBA::is_nil(geom)) + THROW_SALOME_CORBA_EXCEPTION("bad geom reference", \ + SALOME::BAD_PARAM); + if (CORBA::is_nil(myShape)) + THROW_SALOME_CORBA_EXCEPTION("bad shape reference", \ + SALOME::BAD_PARAM); + + try + { + if (! _ShapeReader) _ShapeReader = new GEOM_Client(); + ASSERT(_ShapeReader); + TopoDS_Shape myMainShape = _ShapeReader->GetShape(geom,myShape); + TopTools_IndexedMapOfShape myIndexToShape; + TopExp::MapShapes(myMainShape,myIndexToShape); + + for (int i=0; iGetShape(geom,aShape); + for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next()) + { + const TopoDS_Face& F = TopoDS::Face(exp.Current()); + setId.insert(myIndexToShape.FindIndex(F)); + SCRUTE(myIndexToShape.FindIndex(F)); + } + for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); + setId.insert(myIndexToShape.FindIndex(E)); + SCRUTE(myIndexToShape.FindIndex(E)); + } + for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next()) + { + const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current()); + setId.insert(myIndexToShape.FindIndex(V)); + SCRUTE(myIndexToShape.FindIndex(V)); + } + } + shapesId->length(setId.size()); + set::iterator iind; + int i=0; + for (iind = setId.begin(); iind != setId.end(); iind++) + { + SCRUTE((*iind)); + shapesId[i] = (*iind); + SCRUTE(shapesId[i]); + i++; + } + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + return shapesId._retn(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_Gen_i::Compute(SMESH::SMESH_Mesh_ptr aMesh, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Gen_i::Compute"); + GEOM::GEOM_Shape_var myShape = GEOM::GEOM_Shape::_narrow(aShape); + if (CORBA::is_nil(myShape)) + THROW_SALOME_CORBA_EXCEPTION("bad shape reference", \ + SALOME::BAD_PARAM); + + SMESH::SMESH_Mesh_var myMesh = SMESH::SMESH_Mesh::_narrow(aMesh); + if (CORBA::is_nil(myMesh)) + THROW_SALOME_CORBA_EXCEPTION("bad Mesh reference", \ + SALOME::BAD_PARAM); + + bool ret = false; + try + { + + // get study context from studyId given by CORBA mesh object + + int studyId = myMesh->GetStudyId(); + ASSERT(_mapStudyContext_i.find(studyId) != _mapStudyContext_i.end()); + StudyContext_iStruct* myStudyContext = _mapStudyContext_i[studyId]; + + // get local Mesh_i object with Id and study context + + int meshId = myMesh->GetId(); + ASSERT(myStudyContext->mapMesh_i.find(meshId) != myStudyContext->mapMesh_i.end()); + SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; + ASSERT(meshServant); + + // get local TopoDS_Shape + + GEOM::GEOM_Gen_var geom = meshServant->GetGeomEngine(); + TopoDS_Shape myLocShape = _ShapeReader->GetShape(geom,myShape); + + // implementation compute + + ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); + ret = _impl.Compute(myLocMesh, myLocShape); + } + catch (SALOME_Exception& S_ex) + { + MESSAGE("catch exception "<< S_ex.what()); + return false; +// THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + return ret; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) +{ + MESSAGE("SMESH_Gen_i::SAVE"); + SALOMEDS::Study_var Study = theComponent->GetStudy(); + int studyId; + + // Declare a byte stream + SALOMEDS::TMPFile_var aStreamFile; + + // Obtain a temporary dir + TCollection_AsciiString tmpDir = (isMultiFile)?TCollection_AsciiString((char*)theURL):SALOMEDS_Tool::GetTmpDir(); + + // Create a sequence of files processed + SALOMEDS::ListOfFileNames_var aFileSeq = new SALOMEDS::ListOfFileNames; + aFileSeq->length(NUM_TMP_FILES); + + TCollection_AsciiString aStudyName(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())); + + // Set names of temporary files + TCollection_AsciiString filename = aStudyName + TCollection_AsciiString("SMESH.hdf"); + TCollection_AsciiString hypofile = aStudyName + TCollection_AsciiString("SMESH_Hypo.txt"); + TCollection_AsciiString algofile = aStudyName + TCollection_AsciiString("SMESH_Algo.txt"); + TCollection_AsciiString meshfile = aStudyName + TCollection_AsciiString("SMESH_Mesh.med"); + aFileSeq[0] = CORBA::string_dup(filename.ToCString()); + aFileSeq[1] = CORBA::string_dup(hypofile.ToCString()); + aFileSeq[2] = CORBA::string_dup(algofile.ToCString()); + aFileSeq[3] = CORBA::string_dup(meshfile.ToCString()); + filename = tmpDir + filename; + hypofile = tmpDir + hypofile; + algofile = tmpDir + algofile; + meshfile = tmpDir + meshfile; + + HDFfile * hdf_file; + map hdf_group, hdf_subgroup; + map hdf_dataset; + FILE* destFile; + + SALOMEDS::ChildIterator_var itBig,it,itSM; + SALOMEDS::SObject_var mySObject,myBranch,mySObjectChild; + hdf_size size[1]; + int longueur,cmpt_ds = 0,cmpt_it; + char *name_group,name_dataset[30],name_meshgroup[30]; + bool ok,_found; + int cmpt_sm = 0, myTag; + +//************* HDF file creation + hdf_file = new HDFfile(filename.ToCString()); + hdf_file->CreateOnDisk(); +//**************************** + + itBig = Study->NewChildIterator(theComponent); + for (; itBig->More();itBig->Next()) { + SALOMEDS::SObject_var gotBranch = itBig->Value(); + +//************branch 1 : hypothesis + if (gotBranch->Tag()==Tag_HypothesisRoot) { //hypothesis = tag 1 + + double length,maxElementsArea; + int numberOfSegments; + + destFile = fopen( hypofile.ToCString() ,"w"); + it = Study->NewChildIterator(gotBranch); + for (; it->More();it->Next()) { + mySObject = it->Value(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( mySObject->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(anIOR->Value())); + fprintf(destFile,"%s\n",myHyp->GetName()); + + if (strcmp(myHyp->GetName(),"LocalLength")==0) { + SMESH::SMESH_LocalLength_var LL = SMESH::SMESH_LocalLength::_narrow( myHyp ); + length = LL->GetLength(); + fprintf(destFile,"%f\n",length); + } + else if (strcmp(myHyp->GetName(),"NumberOfSegments")==0) { + SMESH::SMESH_NumberOfSegments_var NOS = SMESH::SMESH_NumberOfSegments::_narrow( myHyp ); + numberOfSegments = NOS->GetNumberOfSegments(); + fprintf(destFile,"%d\n",numberOfSegments); + } + else if (strcmp(myHyp->GetName(),"MaxElementArea")==0) { + SMESH::SMESH_MaxElementArea_var MEA = SMESH::SMESH_MaxElementArea::_narrow( myHyp ); + maxElementsArea = MEA->GetMaxElementArea(); + fprintf(destFile,"%f\n",maxElementsArea); + } + } + } + fclose(destFile); + +//writes the file name in the hdf file + longueur = hypofile.Length() +1; + name_group="Hypothesis"; + //SCRUTE(name_group); + + size[0]=longueur; + hdf_group[1] = new HDFgroup(name_group,hdf_file); + hdf_group[1]->CreateOnDisk(); + + hdf_dataset[cmpt_ds]=new HDFdataset(name_group,hdf_group[1],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(hypofile.ToCString()); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + hdf_group[1]->CloseOnDisk(); + MESSAGE("End of Hypothesis Save"); + + } +//************branch 2 : algorithms + else if (gotBranch->Tag()==Tag_AlgorithmsRoot) {//algos = tag 2 + + destFile = fopen( algofile.ToCString() ,"w"); + it = Study->NewChildIterator(gotBranch); + for (; it->More();it->Next()) { + mySObject = it->Value(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if (mySObject->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Algo_var myAlgo = SMESH::SMESH_Algo::_narrow(_orb->string_to_object(anIOR->Value())); + fprintf(destFile,"%s\n",myAlgo->GetName()); + } + } + + fclose(destFile); + +//writes the file name in the hdf file + longueur = algofile.Length() +1; + name_group="Algorithms"; + //SCRUTE(name_group); + + size[0]=longueur; + hdf_group[2] = new HDFgroup(name_group,hdf_file); + hdf_group[2]->CreateOnDisk(); + + hdf_dataset[cmpt_ds]=new HDFdataset(name_group,hdf_group[2],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(algofile.ToCString()); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + hdf_group[2]->CloseOnDisk(); + MESSAGE("End of Algos Save"); + + } +//************branch 3 : meshes + else if (gotBranch->Tag()>=3) {//meshes = tag > 3 + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if (gotBranch->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + + SMESH::SMESH_Mesh_var myMesh = SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value())) ; + studyId = myMesh->GetStudyId(); + SCRUTE(studyId); + + StudyContext_iStruct* myStudyContext = _mapStudyContext_i[studyId]; + int meshId = myMesh->GetId(); + SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; + ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); + Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); + + SCRUTE(mySMESHDSMesh->NbNodes()); + if (mySMESHDSMesh->NbNodes()>0) {//checks if the mesh is not empty + + DriverMED_W_SMESHDS_Mesh* myWriter = new DriverMED_W_SMESHDS_Mesh; + myWriter->SetFile(meshfile.ToCString()); + + myWriter->SetMesh(mySMESHDSMesh); + myWriter->SetMeshId(gotBranch->Tag()); + myWriter->Add(); + } + else meshfile = "No data"; + + //********** opening of the HDF group + sprintf(name_meshgroup,"Mesh %d",gotBranch->Tag()); + SCRUTE(name_meshgroup); + hdf_group[gotBranch->Tag()] = new HDFgroup(name_meshgroup,hdf_file); + hdf_group[gotBranch->Tag()]->CreateOnDisk(); + //********** + + //********** file where the data are stored + longueur = strlen(meshfile.ToCString()) +1; + size[0]=longueur; + strcpy(name_dataset,"Mesh data"); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_group[gotBranch->Tag()],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(meshfile.ToCString()); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + //********** + + //********** ref on shape + Standard_CString myRefOnObject="" ; + SALOMEDS::SObject_var myRef,myShape; + _found = gotBranch->FindSubObject(Tag_RefOnShape,myRef); + if (_found) { + ok = myRef->ReferencedObject(myShape); + myRefOnObject = myShape->GetID(); + SCRUTE(myRefOnObject); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + strcpy(name_dataset,"Ref on shape"); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_group[gotBranch->Tag()],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + } + } + //********** + + //********** ref on applied hypothesis + _found = gotBranch->FindSubObject(Tag_RefOnAppliedHypothesis,myBranch); + if (_found) { + + strcpy(name_meshgroup,"Applied Hypothesis"); + hdf_subgroup[Tag_RefOnAppliedHypothesis] = new HDFgroup(name_meshgroup,hdf_group[gotBranch->Tag()]); + hdf_subgroup[Tag_RefOnAppliedHypothesis]->CreateOnDisk(); + + it = Study->NewChildIterator(myBranch); + cmpt_it = 0; + for (; it->More();it->Next()) { + mySObject = it->Value(); + ok = mySObject->ReferencedObject(myRef); + myRefOnObject = myRef->GetID(); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + sprintf(name_dataset,"Hyp %d",cmpt_it); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_subgroup[Tag_RefOnAppliedHypothesis],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + } + cmpt_ds++; + cmpt_it++; + } + hdf_subgroup[Tag_RefOnAppliedHypothesis]->CloseOnDisk(); + } + //********** + + //********** ref on applied algorithms + _found = gotBranch->FindSubObject(Tag_RefOnAppliedAlgorithms,myBranch); + if (_found) { + + strcpy(name_meshgroup,"Applied Algorithms"); + hdf_subgroup[Tag_RefOnAppliedAlgorithms] = new HDFgroup(name_meshgroup,hdf_group[gotBranch->Tag()]); + hdf_subgroup[Tag_RefOnAppliedAlgorithms]->CreateOnDisk(); + + it = Study->NewChildIterator(myBranch); + cmpt_it = 0; + for (; it->More();it->Next()) { + mySObject = it->Value(); + ok = mySObject->ReferencedObject(myRef); + myRefOnObject = myRef->GetID(); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + sprintf(name_dataset,"Algo %d",cmpt_it); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_subgroup[Tag_RefOnAppliedAlgorithms],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + } + cmpt_ds++; + cmpt_it++; + } + hdf_subgroup[Tag_RefOnAppliedAlgorithms]->CloseOnDisk(); + } + MESSAGE("end of algo applied"); + //********** + + //********** submeshes on subshapes + int myLevel1Tag; + for (int i=Tag_SubMeshOnVertex;i<=Tag_SubMeshOnCompound;i++) { + _found = gotBranch->FindSubObject(i,myBranch); + if (_found) { + if (i==Tag_SubMeshOnVertex) + strcpy(name_meshgroup,"SubMeshes On Vertex"); + else if (i==Tag_SubMeshOnEdge) + strcpy(name_meshgroup,"SubMeshes On Edge"); + else if (i==Tag_SubMeshOnFace) + strcpy(name_meshgroup,"SubMeshes On Face"); + else if (i==Tag_SubMeshOnSolid) + strcpy(name_meshgroup,"SubMeshes On Solid"); + else if (i==Tag_SubMeshOnCompound) + strcpy(name_meshgroup,"SubMeshes On Compound"); + + cmpt_sm++; + myLevel1Tag = 10+cmpt_sm; + hdf_subgroup[myLevel1Tag] = new HDFgroup(name_meshgroup,hdf_group[gotBranch->Tag()]); + hdf_subgroup[myLevel1Tag]->CreateOnDisk(); + + itSM = Study->NewChildIterator(myBranch); + for (; itSM->More();itSM->Next()) {//Loop on all submeshes + mySObject = itSM->Value(); + cmpt_sm++; + myTag = 10+cmpt_sm; + mySObject->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_subMesh_var mySubMesh = SMESH::SMESH_subMesh::_narrow(_orb->string_to_object(anIOR->Value())) ; + + //sprintf(name_meshgroup,"SubMesh %d",myTag); + sprintf(name_meshgroup,"SubMesh %d",mySubMesh->GetId()); + SCRUTE(name_meshgroup); + + hdf_subgroup[myTag] = new HDFgroup(name_meshgroup,hdf_subgroup[myLevel1Tag]); + hdf_subgroup[myTag]->CreateOnDisk(); + + //********** ref on shape + Standard_CString myRefOnObject="" ; + SALOMEDS::SObject_var myRef,myShape; + bool _found2; + _found2 = mySObject->FindSubObject(Tag_RefOnShape,myRef); + if (_found2) { + ok = myRef->ReferencedObject(myShape); + myRefOnObject = myShape->GetID(); + SCRUTE(myRefOnObject); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + strcpy(name_dataset,"Ref on shape"); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_subgroup[myTag],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + } + } + //********** + + //********** ref on applied hypothesis + _found2 = mySObject->FindSubObject(Tag_RefOnAppliedHypothesis,myBranch); + if (_found2) { + + strcpy(name_meshgroup,"Applied Hypothesis"); + cmpt_sm++; + hdf_subgroup[10+cmpt_sm] = new HDFgroup(name_meshgroup,hdf_subgroup[myTag]); + hdf_subgroup[10+cmpt_sm]->CreateOnDisk(); + + it = Study->NewChildIterator(myBranch); + cmpt_it = 0; + for (; it->More();it->Next()) { + mySObjectChild = it->Value(); + ok = mySObjectChild->ReferencedObject(myRef); + myRefOnObject = myRef->GetID(); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + sprintf(name_dataset,"Hyp %d",cmpt_it); + SCRUTE(cmpt_it); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_subgroup[10+cmpt_sm],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + } + cmpt_ds++; + cmpt_it++; + } + hdf_subgroup[10+cmpt_sm]->CloseOnDisk(); + } + //********** + + //********** ref on applied algorithms + _found2 = mySObject->FindSubObject(Tag_RefOnAppliedAlgorithms,myBranch); + SCRUTE(_found2); + if (_found2) { + + strcpy(name_meshgroup,"Applied Algorithms"); + cmpt_sm++; + hdf_subgroup[10+cmpt_sm] = new HDFgroup(name_meshgroup,hdf_subgroup[myTag]); + hdf_subgroup[10+cmpt_sm]->CreateOnDisk(); + + it = Study->NewChildIterator(myBranch); + cmpt_it = 0; + for (; it->More();it->Next()) { + mySObjectChild = it->Value(); + ok = mySObjectChild->ReferencedObject(myRef); + myRefOnObject = myRef->GetID(); + + longueur = strlen(myRefOnObject) +1; + if (longueur>1) { + size[0]=longueur; + sprintf(name_dataset,"Algo %d",cmpt_it); + hdf_dataset[cmpt_ds]=new HDFdataset(name_dataset,hdf_subgroup[10+cmpt_sm],HDF_STRING,size,1); + hdf_dataset[cmpt_ds]->CreateOnDisk(); + hdf_dataset[cmpt_ds]->WriteOnDisk(myRefOnObject); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + } + cmpt_ds++; + cmpt_it++; + } + hdf_subgroup[10+cmpt_sm]->CloseOnDisk(); + } + //MESSAGE("end of algo applied"); + //********** + + hdf_subgroup[myTag]->CloseOnDisk(); + } + + hdf_subgroup[myLevel1Tag]->CloseOnDisk(); + } + + } + //********** + + //********** closing of the HDF group + hdf_group[gotBranch->Tag()]->CloseOnDisk(); + MESSAGE("End of Mesh Save"); + //********** + } + } + MESSAGE("End of Meshes Save"); + } + + hdf_file->CloseOnDisk(); + delete hdf_file; + hdf_file = 0; + + // Convert temporary files to stream + aStreamFile = SALOMEDS_Tool::PutFilesToStream(tmpDir.ToCString(), aFileSeq.in(), isMultiFile); + + // Remove temporary files and directory + if (isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.ToCString(), aFileSeq.in(), true); + + MESSAGE("End SMESH_Gen_i::Save"); + + return aStreamFile._retn(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile) +{ + MESSAGE("SMESH_Gen_i::Load\n"); + + // Get temporary files location + TCollection_AsciiString tmpDir = isMultiFile?TCollection_AsciiString((char*)theURL):SALOMEDS_Tool::GetTmpDir(); + + // Convert the stream into sequence of files to process + SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, + tmpDir.ToCString(), + isMultiFile); + + // Set names of temporary files + TCollection_AsciiString filename = tmpDir + aFileSeq[0];//"SMESH.hdf"; + TCollection_AsciiString hypofile = tmpDir + aFileSeq[1];//"SMESH_Hypo.txt"; + TCollection_AsciiString algofile = tmpDir + aFileSeq[2];//"SMESH_Algo.txt"; + TCollection_AsciiString meshfile = tmpDir + aFileSeq[3];//"SMESH_Mesh.med"; + + SALOMEDS::Study_var Study = theComponent->GetStudy(); + int studyId = Study->StudyId(); + SCRUTE(studyId); + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + SALOMEDS::SComponent_var fathergeom = Study->FindComponent("GEOM"); + SALOMEDS::SComponent_var myGeomSComp = SALOMEDS::SComponent::_narrow( fathergeom ); + SCRUTE(fathergeom); + + //to get the geom engine !!! + //useful to define our new mesh + SALOME_NamingService* _NS = SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + _NS->init_orb( _orb ) ; + SALOME_LifeCycleCORBA* myEnginesLifeCycle = new SALOME_LifeCycleCORBA(_NS); + Engines::Component_var geomEngine = + myEnginesLifeCycle->FindOrLoad_Component("FactoryServer","Geometry"); + GEOM::GEOM_Gen_var myGeomEngine = GEOM::GEOM_Gen::_narrow(geomEngine); + + + char* aLine; + bool ok; + char objectId[10],name_dataset[10]; + int nb_datasets,size,cmpt_ds=0; + int cmpt_sm = 0; + + char name[HDF_NAME_MAX_LEN+1]; + char sgname[HDF_NAME_MAX_LEN+1]; + char msgname[HDF_NAME_MAX_LEN+1]; + char name_of_group[HDF_NAME_MAX_LEN+1]; + char *name_meshgroup; + map hdf_group, hdf_subgroup; + map hdf_dataset; + FILE *loadedFile; + + //************* HDF file opening + HDFfile * hdf_file = new HDFfile(filename.ToCString()); + try { + hdf_file->OpenOnDisk(HDF_RDONLY); + } + catch (HDFexception) { + MESSAGE("Load(): " << filename << " not found!"); + return false; + } + + //**************************** + + int nb_group = hdf_file->nInternalObjects(); + SCRUTE(nb_group); + for (int i=0;iInternalObjectIndentify(i,name); + //SCRUTE(name); + +//*************** +// Loading of the Hypothesis Branch +//*************** + if (strcmp(name,"Hypothesis")==0) { + + double length,maxElementsArea; + int numberOfSegments; + + hdf_group[Tag_HypothesisRoot] = new HDFgroup(name,hdf_file); + hdf_group[Tag_HypothesisRoot]->OpenOnDisk(); + + hdf_group[Tag_HypothesisRoot]->InternalObjectIndentify(0,name_of_group); + hdf_dataset[cmpt_ds]=new HDFdataset(name_of_group,hdf_group[Tag_HypothesisRoot]); + hdf_dataset[cmpt_ds]->OpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * name_of_file =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(name_of_file); + SCRUTE(name_of_file); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + hdf_group[Tag_HypothesisRoot]->CloseOnDisk(); + cmpt_ds++; + delete[] name_of_file; + name_of_file = 0; + + aLine = new char[100]; + loadedFile = fopen( hypofile.ToCString() ,"r"); + while (!feof(loadedFile)) { + fscanf(loadedFile,"%s",aLine); + //SCRUTE(aLine); + if (strcmp(aLine,"LocalLength")==0) { + SMESH::SMESH_Hypothesis_var myHyp = this->CreateHypothesis(aLine,studyId); + SMESH::SMESH_LocalLength_var LL = SMESH::SMESH_LocalLength::_narrow( myHyp ); + fscanf(loadedFile,"%s",aLine); + length = atof(aLine); + LL->SetLength(length); + string iorString = _orb->object_to_string(LL); + sprintf(objectId,"%d",LL->GetId()); + _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString; + } + else if (strcmp(aLine,"NumberOfSegments")==0) { + SMESH::SMESH_Hypothesis_var myHyp = this->CreateHypothesis(aLine,studyId); + SMESH::SMESH_NumberOfSegments_var NOS = SMESH::SMESH_NumberOfSegments::_narrow( myHyp ); + fscanf(loadedFile,"%s",aLine); + numberOfSegments = atoi(aLine); + NOS->SetNumberOfSegments(numberOfSegments); + string iorString = _orb->object_to_string(NOS); + sprintf(objectId,"%d",NOS->GetId()); + _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString; + } + else if (strcmp(aLine,"MaxElementArea")==0) { + SMESH::SMESH_Hypothesis_var myHyp = this->CreateHypothesis(aLine,studyId); + SMESH::SMESH_MaxElementArea_var MEA = SMESH::SMESH_MaxElementArea::_narrow( myHyp ); + fscanf(loadedFile,"%s",aLine); + maxElementsArea = atof(aLine); + MEA->SetMaxElementArea(maxElementsArea); + string iorString = _orb->object_to_string(MEA); + sprintf(objectId,"%d",MEA->GetId()); + _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString; + } + + + } + fclose(loadedFile); + delete[] aLine; + aLine = 0; + MESSAGE("End of Hypos Load"); + + } +//*************** +// Loading of the Algorithms Branch +//*************** + else if (strcmp(name,"Algorithms")==0) { + + hdf_group[Tag_AlgorithmsRoot] = new HDFgroup(name,hdf_file); + hdf_group[Tag_AlgorithmsRoot]->OpenOnDisk(); + + hdf_group[Tag_AlgorithmsRoot]->InternalObjectIndentify(0,name_of_group); + hdf_dataset[cmpt_ds] = new HDFdataset(name_of_group,hdf_group[Tag_AlgorithmsRoot]); + hdf_dataset[cmpt_ds]->OpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * name_of_file =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(name_of_file); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + hdf_group[Tag_AlgorithmsRoot]->CloseOnDisk(); + cmpt_ds++; + delete[] name_of_file; + name_of_file = 0; + + aLine = new char[100]; + loadedFile = fopen( algofile.ToCString(),"r"); + while (!feof(loadedFile)) { + fscanf(loadedFile,"%s\n",aLine); + //SCRUTE(aLine); + if (strcmp(aLine,"")!=0) { + SMESH::SMESH_Hypothesis_var myHyp = this->CreateHypothesis(aLine,studyId); + SMESH::SMESH_Algo_var myAlgo = SMESH::SMESH_Algo::_narrow(myHyp); + string iorString = _orb->object_to_string(myAlgo); + sprintf(objectId,"%d",myAlgo->GetId()); + _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString; + } + } + fclose(loadedFile); + delete[] aLine; + aLine = 0; + MESSAGE("End of Algos Load"); + + } + +//*************** +// Loading of the Mesh Branch +//*************** + else if (string(name).substr(0,4)==string("Mesh")) { + MESSAGE("in mesh load"); + + Standard_Integer myMeshId = atoi((string(name).substr(5,5)).c_str()); + SCRUTE(myMeshId); + + hdf_group[myMeshId] = new HDFgroup(name,hdf_file); + hdf_group[myMeshId]->OpenOnDisk(); + + int nb_meshsubgroup = hdf_group[myMeshId]->nInternalObjects(); + SCRUTE(nb_meshsubgroup); + + //********** Loading of the file name where the data are stored + MESSAGE("Mesh data file"); + strcpy(name_of_group,"Mesh data"); + hdf_dataset[cmpt_ds]=new HDFdataset(name_of_group,hdf_group[myMeshId]); + hdf_dataset[cmpt_ds]->OpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * datafilename =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(datafilename); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + //********** + //} + //else if (strcmp(msgname,"Ref on shape")==0) { + + //********** Loading of the reference on the shape + //********** and mesh initialization + MESSAGE("Ref on shape"); + strcpy(name_of_group,"Ref on shape"); + hdf_dataset[cmpt_ds] = new HDFdataset(name_of_group,hdf_group[myMeshId]); + hdf_dataset[cmpt_ds]->OpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + Standard_CString myRefOnShape=""; //look for ref on shape + + bool _found = false; + SALOMEDS::SObject_var CSO = Study->FindObjectID(refFromFile); + SMESH::SMESH_Mesh_var myNewMesh; + GEOM::GEOM_Shape_var aShape; + + if (!CORBA::is_nil(CSO)) { + _found = true; + CSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + char* ShapeIOR = anIOR->Value(); + aShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(ShapeIOR)); + + myNewMesh = this->Init(myGeomEngine,studyId,aShape); + string iorString = _orb->object_to_string(myNewMesh); + sprintf(objectId,"%d",myNewMesh->GetId()); + _SMESHCorbaObj[string("Mesh_")+string(objectId)] = iorString; + + //********** + //********** Loading of mesh data + if (strcmp(datafilename,"No data")!=0) { + + med_idt fid; + int ret; + + //**************************************************************************** + //* OUVERTURE DU FICHIER EN LECTURE * + //**************************************************************************** + + fid = MEDouvrir(datafilename,MED_LECT); + if (fid < 0) + { + printf(">> ERREUR : ouverture du fichier %s \n",datafilename); + exit(EXIT_FAILURE); + } + else { + + StudyContext_iStruct* myStudyContext = _mapStudyContext_i[studyId]; + int meshId = myNewMesh->GetId(); + SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; + ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); + Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); + + DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh; + + myReader->SetMesh(mySMESHDSMesh); + myReader->SetMeshId(myMeshId); + myReader->SetFileId(fid); + myReader->ReadMySelf(); + //SCRUTE(mySMESHDSMesh->NbNodes()); + //myNewMesh->ExportUNV("/tmp/test.unv");//only to check out + + //**************************************************************************** + //* FERMETURE DU FICHIER * + //**************************************************************************** + ret = MEDfermer(fid); + + if (ret != 0) + printf(">> ERREUR : erreur a la fermeture du fichier %s\n",datafilename); + + } + } + } + //********** + //} + //else if (strcmp(msgname,"Applied Hypothesis")==0) { + for (int ii=0;iiInternalObjectIndentify(ii,msgname); + if (strcmp(msgname,"Mesh data")==0) { + //nothing + } + else if (strcmp(msgname,"Ref on shape")==0) { + //nothing + } + else if (strcmp(msgname,"Applied Hypothesis")==0) { + //********** Loading of the applied hypothesis + strcpy(name_of_group,"Applied Hypothesis"); + hdf_subgroup[Tag_RefOnAppliedHypothesis] = new HDFgroup(name_of_group,hdf_group[myMeshId]); + hdf_subgroup[Tag_RefOnAppliedHypothesis]->OpenOnDisk(); + + nb_datasets = hdf_subgroup[Tag_RefOnAppliedHypothesis]->nInternalObjects(); + SCRUTE(nb_datasets); + + for (int j=0;jOpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + //SCRUTE(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + if (_found) { + SALOMEDS::SObject_var HypSO = Study->FindObjectID(refFromFile); + if (!CORBA::is_nil(HypSO)) { + HypSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if (!CORBA::is_nil(anIOR)) { + char* HypIOR = anIOR->Value(); + SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(HypIOR)); + if (!CORBA::is_nil(anHyp)) { + myNewMesh->AddHypothesis(aShape,anHyp); + MESSAGE("Hypothesis added ..."); + } + } + } + } + } + + hdf_subgroup[Tag_RefOnAppliedHypothesis]->CloseOnDisk(); + //********** + } + else if (strcmp(msgname,"Applied Algorithms")==0) { + + //********** Loading of the applied algorithms + strcpy(name_of_group,"Applied Algorithms"); + hdf_subgroup[Tag_RefOnAppliedAlgorithms] = new HDFgroup(name_of_group,hdf_group[myMeshId]); + hdf_subgroup[Tag_RefOnAppliedAlgorithms]->OpenOnDisk(); + + nb_datasets = hdf_subgroup[Tag_RefOnAppliedAlgorithms]->nInternalObjects(); + SCRUTE(nb_datasets); + + for (int j=0;jOpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + if (_found) { + SALOMEDS::SObject_var AlgoSO = Study->FindObjectID(refFromFile); + if (!CORBA::is_nil(AlgoSO)) { + AlgoSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if (!CORBA::is_nil(anIOR)) { + char* AlgoIOR = anIOR->Value(); + //SCRUTE(AlgoIOR); + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(AlgoIOR)); + SMESH::SMESH_Algo_var anAlgo = SMESH::SMESH_Algo::_narrow(myHyp); + //SMESH::SMESH_Algo_var anAlgo = SMESH::SMESH_Algo::_narrow(_orb->string_to_object(AlgoIOR)); + if (!CORBA::is_nil(anAlgo)) { + myNewMesh->AddHypothesis(aShape,anAlgo);//essayer avec _SMESHCorbaObj + MESSAGE("Algorithms added ..."); + } + } + } + } + } + + hdf_subgroup[Tag_RefOnAppliedAlgorithms]->CloseOnDisk(); + + //********** + } + else if (string(msgname).substr(0,9)==string("SubMeshes")) { + + + //********** Loading of the submeshes on subshapes + int myLevel1Tag, myTag; + SCRUTE(msgname); + cmpt_sm++; + myLevel1Tag = 10+cmpt_sm; + hdf_subgroup[myLevel1Tag] = new HDFgroup(name_of_group,hdf_group[myMeshId]); + hdf_subgroup[myLevel1Tag] = new HDFgroup(msgname,hdf_group[myMeshId]); + hdf_subgroup[myLevel1Tag]->OpenOnDisk(); + + int nb_submeshes = hdf_subgroup[myLevel1Tag]->nInternalObjects(); + SCRUTE(nb_submeshes); + + for (int j=0;jInternalObjectIndentify(j,name_meshgroup); + SCRUTE(name_meshgroup); + + hdf_subgroup[myTag] = new HDFgroup(name_meshgroup,hdf_subgroup[myLevel1Tag]); + hdf_subgroup[myTag]->OpenOnDisk(); + int subMeshId = atoi((string(name_meshgroup).substr(8,18)).c_str()); + + MESSAGE("Ref on shape"); + //********** ref on shape + sprintf(name_dataset,"Ref on shape"); + hdf_dataset[cmpt_ds] = new HDFdataset(name_dataset,hdf_subgroup[myTag]); + hdf_dataset[cmpt_ds]->OpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + bool _found3 = false; + SALOMEDS::SObject_var GSO = Study->FindObjectID(refFromFile); + SMESH::SMESH_subMesh_var aSubMesh; + GEOM::GEOM_Shape_var aSubShape; + + if (!CORBA::is_nil(GSO)) { + GSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + char* SubShapeIOR = anIOR->Value(); + aSubShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(SubShapeIOR)); + + if (!CORBA::is_nil(aSubShape)) { + aSubMesh = myNewMesh->GetElementsOnShape(aSubShape); + string iorString = _orb->object_to_string(aSubMesh); + sprintf(objectId,"%d",subMeshId); + _SMESHCorbaObj[string("SubMesh_")+string(objectId)] = iorString; + _found3 = true; + //SCRUTE(aSubMesh->GetNumberOfNodes()); + //MESSAGE("yes"); + //SCRUTE(aSubMesh->GetNumberOfElements()); + } + } + + int nb_subgroup = hdf_subgroup[myTag]->nInternalObjects(); + SCRUTE(nb_subgroup); + for (int k=0;kInternalObjectIndentify(k,sgname); + if (strcmp(sgname,"Ref on shape")==0) { + //nothing + } + else if (strcmp(sgname,"Applied Hypothesis")==0) { + //********** ref on applied hypothesis + MESSAGE("Applied Hypothesis"); + strcpy(name_meshgroup,"Applied Hypothesis"); + cmpt_sm++; + hdf_subgroup[10+cmpt_sm] = new HDFgroup(name_meshgroup,hdf_subgroup[myTag]); + hdf_subgroup[10+cmpt_sm]->OpenOnDisk(); + nb_datasets = hdf_subgroup[10+cmpt_sm]->nInternalObjects(); + SCRUTE(nb_datasets); + + for (int l=0;lOpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + if (_found3) { + SALOMEDS::SObject_var HypSO = Study->FindObjectID(refFromFile); + if (!CORBA::is_nil(HypSO)) { + HypSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if (!CORBA::is_nil(anIOR)) { + char* HypIOR = anIOR->Value(); + SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(HypIOR)); + if (!CORBA::is_nil(anHyp)) { + SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); + aMesh->AddHypothesis(aSubShape,anHyp);//essayer avec _SMESHCorbaObj + MESSAGE("Hypothesis added ..."); + } + } + } + } + } + } + else if (strcmp(sgname,"Applied Algorithms")==0) { + //********** ref on applied algorithms + MESSAGE("Applied Algorithms"); + strcpy(name_meshgroup,"Applied Algorithms"); + cmpt_sm++; + hdf_subgroup[10+cmpt_sm] = new HDFgroup(name_meshgroup,hdf_subgroup[myTag]); + hdf_subgroup[10+cmpt_sm]->OpenOnDisk(); + nb_datasets = hdf_subgroup[10+cmpt_sm]->nInternalObjects(); + SCRUTE(nb_datasets); + + for (int l=0;lOpenOnDisk(); + size=hdf_dataset[cmpt_ds]->GetSize(); + + char * refFromFile =new char[size]; + hdf_dataset[cmpt_ds]->ReadFromDisk(refFromFile); + hdf_dataset[cmpt_ds]->CloseOnDisk(); + cmpt_ds++; + + if (_found3) { + SALOMEDS::SObject_var AlgoSO = Study->FindObjectID(refFromFile); + if (!CORBA::is_nil(AlgoSO)) { + AlgoSO->FindAttribute(anAttr, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if (!CORBA::is_nil(anIOR)) { + char* AlgoIOR = anIOR->Value(); + //SCRUTE(AlgoIOR); + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(AlgoIOR)); + SMESH::SMESH_Algo_var anAlgo = SMESH::SMESH_Algo::_narrow(myHyp); + //SMESH::SMESH_Algo_var anAlgo = SMESH::SMESH_Algo::_narrow(_orb->string_to_object(AlgoIOR)); + if (!CORBA::is_nil(anAlgo)) { + SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); + aMesh->AddHypothesis(aSubShape,anAlgo);//essayer avec _SMESHCorbaObj + MESSAGE("Algorithms added ..."); + } + } + } + } + + } + } + } + hdf_subgroup[myTag]->CloseOnDisk(); + } + hdf_subgroup[myLevel1Tag]->CloseOnDisk(); + } + } + hdf_group[myMeshId]->CloseOnDisk(); + + MESSAGE("End of Meshes Load"); + } + } + + MESSAGE("End of SMESH_Gen::Load"); + + hdf_file->CloseOnDisk(); + delete hdf_file; + hdf_file=0; + + // Remove temporary files created from the stream + if (isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(tmpDir.ToCString(), aFileSeq.in(), true); + + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent) +{ + MESSAGE("Close"); + SALOMEDS::Study_var aStudy = theComponent->GetStudy(); + SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent); + for (; itBig->More();itBig->Next()) { + SALOMEDS::SObject_var gotBranch = itBig->Value(); + + // branch 1 : hypothesis + if (gotBranch->Tag()==Tag_HypothesisRoot || gotBranch->Tag()==Tag_AlgorithmsRoot) { + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(gotBranch); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var mySObject = it->Value(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( mySObject->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Hypothesis_var myHyp = + SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(anIOR->Value())); + char objectId[10]; + sprintf(objectId,"%d",myHyp->GetId()); +// cout<<"********** delete Hyp "<string_to_object(anIOR->Value())); + } + } + } + // branch 2 : algorithms + else if (gotBranch->Tag()>=3) { + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(gotBranch); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var mySObject = it->Value(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if ( mySObject->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + SMESH::SMESH_Mesh_var myMesh = + SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(anIOR->Value())); + if (!myMesh->_is_nil()) { + char objectId[10]; + sprintf(objectId,"%d",myMesh->GetId()); +// cout<<"********** delete Mesh "<string_to_object(anIOR->Value())); + if (!mySubMesh->_is_nil()) { + char objectId[10]; + sprintf(objectId,"%d",mySubMesh->GetId()); +// cout<<"********** delete SubMesh "<string_to_object(IORString)); + if (! CORBA::is_nil(myAlgo)) + { + string prefix = "Hypo_"; + sprintf(objectId,"%d",myAlgo->GetId()); + string lpID = prefix + string(objectId); + return CORBA::string_dup(lpID.c_str()); + } + else { + SMESH::SMESH_Hypothesis_var myHypo = SMESH::SMESH_Hypothesis::_narrow(_orb->string_to_object(IORString)); + if (! CORBA::is_nil(myHypo)) + { + string prefix = "Hypo_"; + sprintf(objectId,"%d",myHypo->GetId()); + string lpID = prefix + string(objectId); + return CORBA::string_dup(lpID.c_str()); + } + else { + SMESH::SMESH_Mesh_var myMesh = SMESH::SMESH_Mesh::_narrow(_orb->string_to_object(IORString)); + if (! CORBA::is_nil(myMesh)) + { + string prefix = "Mesh_"; + sprintf(objectId,"%d",myMesh->GetId()); + string lpID = prefix + string(objectId); + return CORBA::string_dup(lpID.c_str()); + } + else { + SMESH::SMESH_subMesh_var mySubMesh = SMESH::SMESH_subMesh::_narrow(_orb->string_to_object(IORString)); + if (! CORBA::is_nil(mySubMesh)) + { + string prefix = "SubMesh_"; + sprintf(objectId,"%d",mySubMesh->GetId()); + string lpID = prefix + string(objectId); + return CORBA::string_dup(lpID.c_str()); + } + else return (strdup("no object")); + } + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +char* SMESH_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile) +{ + MESSAGE("SMESH_Gen_i::LocalPersistentIDToIOR"); + SCRUTE(aLocalPersistentID); + string clef = string(aLocalPersistentID); + SCRUTE(_SMESHCorbaObj[clef].c_str()); + return CORBA::string_dup(_SMESHCorbaObj[clef].c_str()); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_topo* SMESH_Gen_i::ExploreMainShape(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr aShape) +{ + MESSAGE("SMESH_Mesh_i::ExploreMainShape"); + // _narrow() duplicates the reference and check the type + GEOM::GEOM_Gen_var geom = GEOM::GEOM_Gen::_narrow(geomEngine); + GEOM::GEOM_Shape_var myShape = GEOM::GEOM_Shape::_narrow(aShape); + + if (CORBA::is_nil(geom)) + THROW_SALOME_CORBA_EXCEPTION("bad geom reference", \ + SALOME::BAD_PARAM); + if (CORBA::is_nil(myShape)) + THROW_SALOME_CORBA_EXCEPTION("bad shape reference", \ + SALOME::BAD_PARAM); + MESSAGE("---"); + SCRUTE(myShape->Name()); + geom->GetCurrentStudy(studyId); + SCRUTE(studyId); + TopoDS_Shape mainShape = _ShapeReader->GetShape(geom,myShape); + MESSAGE("---"); + + // create an SMESH_topo object for the mainShape + + SMESH_topo* myTopo = new SMESH_topo(); + MESSAGE("---"); + + // explore local TopoDS_Shape, store reference of local TopoDS subShapes + + for (TopExp_Explorer exp(mainShape,TopAbs_COMPOUND); exp.More(); exp.Next()) + { + const TopoDS_Compound& E = TopoDS::Compound(exp.Current()); + int i = myTopo->_myShapes[TopAbs_COMPOUND].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_COMPSOLID); exp.More(); exp.Next()) + { + const TopoDS_CompSolid& E = TopoDS::CompSolid(exp.Current()); + int i = myTopo->_myShapes[TopAbs_COMPSOLID].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_SOLID); exp.More(); exp.Next()) + { + const TopoDS_Solid& E = TopoDS::Solid(exp.Current()); + int i = myTopo->_myShapes[TopAbs_SOLID].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_SHELL); exp.More(); exp.Next()) + { + const TopoDS_Shell& E = TopoDS::Shell(exp.Current()); + int i = myTopo->_myShapes[TopAbs_SHELL].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_FACE); exp.More(); exp.Next()) + { + const TopoDS_Face& E = TopoDS::Face(exp.Current()); + int i = myTopo->_myShapes[TopAbs_FACE].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& E = TopoDS::Wire(exp.Current()); + int i = myTopo->_myShapes[TopAbs_WIRE].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_EDGE); exp.More(); exp.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); + int i = myTopo->_myShapes[TopAbs_EDGE].Add(E); + SCRUTE(i); + } + for (TopExp_Explorer exp(mainShape,TopAbs_VERTEX); exp.More(); exp.Next()) + { + const TopoDS_Vertex& E = TopoDS::Vertex(exp.Current()); + int i = myTopo->_myShapes[TopAbs_VERTEX].Add(E); + SCRUTE(i); + } + + // explore subShapes of distant CORBA object, + // associate distant CORBA subShape references + // with local reference to local TopoDS subShape + + string filenode = "toposhape.txt"; + ofstream fic(filenode.c_str()); + + for (int shapeType = TopAbs_COMPOUND; shapeType < TopAbs_SHAPE; shapeType++) + { + fic << "shape type : " << SMESH_shapeTypeNames[shapeType]; + + GEOM::GEOM_Gen::ListOfGeomShapes_var subShapes + = geom->SubShapeAll(myShape,shapeType); + int nbSubShapes = subShapes->length(); + int nbLocal = myTopo->_myShapes[shapeType].Extent(); + fic << " - number of elements: " << nbSubShapes << endl; + ASSERT(nbSubShapes == nbLocal); + + for (int i=0; i< nbSubShapes; i++) + { + GEOM::GEOM_Shape_var aSubShape = subShapes[i]; + string idShape = SMESH_topo::GetShapeLocalId(aSubShape); + fic << " " << idShape; + SCRUTE(idShape); + TopoDS_Shape aLocShape = _ShapeReader->GetShape(geom,aSubShape); + for (int j=1; j <= nbLocal; j++) + if (aLocShape.IsSame(myTopo->_myShapes[shapeType].FindKey(j))) + { + MESSAGE(" --- trouve = " << j); + myTopo->_mapIndShapes[shapeType][idShape] = j; + fic << " --- trouve = " << j; + break; + } + fic << endl; + } + } + fic.close(); + + return myTopo; +} + +//============================================================================= +/*! + * C factory, accessible with dlsym, after dlopen + */ +//============================================================================= + +extern "C" +{ + PortableServer::ObjectId * SMESHEngine_factory( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("PortableServer::ObjectId * SMESHEngine_factory()"); + SCRUTE(interfaceName); + SMESH_Gen_i * mySMESH_Gen + = new SMESH_Gen_i(orb, poa, contId, instanceName, interfaceName); + return mySMESH_Gen->getId() ; + } +} diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx new file mode 100644 index 000000000..ae09b09c2 --- /dev/null +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -0,0 +1,134 @@ +//============================================================================= +// File : SMESH_Gen_i.hxx +// Created : lun mai 6 13:41:30 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_GEN_I_HXX_ +#define _SMESH_GEN_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_CLIENT_HEADER(GEOM_Gen) +#include CORBA_CLIENT_HEADER(GEOM_Shape) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) + + +class SMESH_Mesh_i; + +#include "SMESH_HypothesisFactory_i.hxx" +#include "SMESH_Mesh_i.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" + +#include "SMESH_Gen.hxx" +#include "SMESH_topo.hxx" +#include "GEOM_Client.hxx" + +#include + +#include + +typedef struct studyContext_iStruct +{ + map mapMesh_i; +} StudyContext_iStruct; + +class SMESH_Gen_i: + public POA_SMESH::SMESH_Gen, + public Engines_Component_i +{ +public: + + SMESH_Gen_i(); + SMESH_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + virtual ~SMESH_Gen_i(); + + SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* anHyp, + CORBA::Long studyId) + throw (SALOME::SALOME_Exception); + + SMESH::SMESH_Mesh_ptr Init(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception); + + CORBA::Boolean Compute(SMESH::SMESH_Mesh_ptr aMesh, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception); + + CORBA::Boolean IsReadyToCompute(SMESH::SMESH_Mesh_ptr aMesh, + GEOM::GEOM_Shape_ptr aShape) + throw (SALOME::SALOME_Exception); + + SMESH::long_array* GetSubShapesId(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr mainShape, + const SMESH::shape_array& listOfSubShape) + throw (SALOME::SALOME_Exception); + + + // inherited methods from SALOMEDS::Driver + + SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + bool Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile); + void Close(SALOMEDS::SComponent_ptr theComponent); + char* ComponentDataType(); + + char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile); + char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile); + + bool CanPublishInStudy(CORBA::Object_ptr theIOR) { return false; } + SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception) { + SALOMEDS::SObject_var aResultSO; + return aResultSO._retn(); + } + + CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject) {return false;} + SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {return false;} + CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID) {return false;} + SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) { + SALOMEDS::SObject_var aResultSO; + return aResultSO._retn(); + } + + GEOM_Client* _ShapeReader; +protected: + SMESH_topo* ExploreMainShape(GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + GEOM::GEOM_Shape_ptr aShape); + +private: + SMESH_HypothesisFactory_i _hypothesisFactory_i; + ::SMESH_Gen _impl; // no namespace here + int _localId; // unique Id of created objects, within SMESH_Gen_i entity + + map _mapStudyContext_i; + map _SMESHCorbaObj; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Hexa_3D_i.cxx b/src/SMESH_I/SMESH_Hexa_3D_i.cxx new file mode 100644 index 000000000..86a95031b --- /dev/null +++ b/src/SMESH_I/SMESH_Hexa_3D_i.cxx @@ -0,0 +1,61 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hexa_3D_i.cxx +// Created : sam mai 18 23:15:45 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hexa_3D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D_i::SMESH_Hexa_3D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_Hexa_3D_i::SMESH_Hexa_3D_i"); + _genImpl = genImpl; + ::SMESH_Hexa_3D* impl + = new ::SMESH_Hexa_3D(_genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + SetImpl(impl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D_i::~SMESH_Hexa_3D_i() +{ + MESSAGE("SMESH_Hexa_3D_i::~SMESH_Hexa_3D_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Hexa_3D_i::SetImpl(::SMESH_Hexa_3D* impl) +{ + MESSAGE("SMESH_Hexa_3D_i::SetImpl"); + SMESH_3D_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_Hexa_3D_i.hxx b/src/SMESH_I/SMESH_Hexa_3D_i.hxx new file mode 100644 index 000000000..1081d0e88 --- /dev/null +++ b/src/SMESH_I/SMESH_Hexa_3D_i.hxx @@ -0,0 +1,36 @@ +//============================================================================= +// File : SMESH_Hexa_3D_i.hxx +// Created : sam mai 18 23:15:38 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +#ifndef _SMESH_HEXA_3D_I_HXX_ +#define _SMESH_HEXA_3D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_3D_Algo_i.hxx" + +#include "SMESH_Hexa_3D.hxx" + +class SMESH_Hexa_3D_i: + public POA_SMESH::SMESH_Hexa_3D, + public SMESH_3D_Algo_i +{ +public: + SMESH_Hexa_3D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + + virtual ~SMESH_Hexa_3D_i(); + +protected: + virtual void SetImpl(::SMESH_Hexa_3D* impl); + + ::SMESH_Hexa_3D* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_HypothesisFactory_i.cxx b/src/SMESH_I/SMESH_HypothesisFactory_i.cxx new file mode 100644 index 000000000..86bd76800 --- /dev/null +++ b/src/SMESH_I/SMESH_HypothesisFactory_i.cxx @@ -0,0 +1,116 @@ +using namespace std; +//============================================================================= +// File : SMESH_HypothesisFactory_i.cxx +// Created : dim mai 19 22:02:42 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_HypothesisFactory_i.hxx" +#include "SMESH_Hypothesis_i.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +// Add new hypothesis here (include file) +//--------------------------------------- +#include "SMESH_LocalLength_i.hxx" +#include "SMESH_NumberOfSegments_i.hxx" +#include "SMESH_MaxElementArea_i.hxx" +#include "SMESH_Regular_1D_i.hxx" +#include "SMESH_MEFISTO_2D_i.hxx" +#include "SMESH_Quadrangle_2D_i.hxx" +#include "SMESH_Hexa_3D_i.hxx" + +//--------------------------------------- + +//============================================================================= +/*! + * Specific Hypothesis Creators are generated with a template which inherits a + * generic hypothesis creator. Each creator returns an hypothesis of the type + * given in the template. + */ +//============================================================================= + +template class HypothesisCreator_i: public GenericHypothesisCreator_i +{ +public: + virtual SMESH_Hypothesis_i* Create (const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) + { + return new T(anHyp, studyId, genImpl); + }; +}; + +//============================================================================= +/*! + * Constructor: instanciate specific hypothesis creators, fill a private map + * indexed by hypothesis names. THIS METHOD MUST BE COMPLETED WHEN A NEW + * HYPOTHESIS IS ADDED. + * Specific hypothesis creator are defined with the above template. + * Hypothesis names are related to the corresponding class names: + * prefix = SMESH_ ; suffix = _i . + */ +//============================================================================= + +SMESH_HypothesisFactory_i::SMESH_HypothesisFactory_i() +{ +// Add new hypothesis here (creators) +//--------------------------------------- +_creatorMap["LocalLength"] = new HypothesisCreator_i; +_creatorMap["NumberOfSegments"] = new HypothesisCreator_i; +_creatorMap["MaxElementArea"] = new HypothesisCreator_i; +_creatorMap["Regular_1D"] = new HypothesisCreator_i; +_creatorMap["MEFISTO_2D"] = new HypothesisCreator_i; +_creatorMap["Quadrangle_2D"] = new HypothesisCreator_i; +_creatorMap["Hexa_3D"] = new HypothesisCreator_i; + +//--------------------------------------- +} + +//============================================================================= +/*! + * Destructor: deletes specific hypothesis creators instanciated in the + * constructor. + */ +//============================================================================= + +SMESH_HypothesisFactory_i::~SMESH_HypothesisFactory_i() +{ + map::iterator it; + for (it = _creatorMap.begin(); it != _creatorMap.end(); it++) + { + delete (*it).second; + } + _creatorMap.clear(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis_i* SMESH_HypothesisFactory_i::Create(const char* anHyp, + CORBA::Long studyId, + ::SMESH_Gen* genImpl) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_HypothesisFactory::Create " << anHyp); + if (_creatorMap.find(anHyp) == _creatorMap.end()) + { + MESSAGE("levee exception CORBA"); + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis type name", \ + SALOME::BAD_PARAM); + } + SMESH_Hypothesis_i* myHyp = _creatorMap[anHyp]->Create(anHyp, + studyId, + genImpl); + return myHyp; +} + + diff --git a/src/SMESH_I/SMESH_HypothesisFactory_i.hxx b/src/SMESH_I/SMESH_HypothesisFactory_i.hxx new file mode 100644 index 000000000..d6396d6ba --- /dev/null +++ b/src/SMESH_I/SMESH_HypothesisFactory_i.hxx @@ -0,0 +1,40 @@ +//============================================================================= +// File : SMESH_HypothesisFactory_i.hxx +// Created : dim mai 19 22:02:45 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESISFACTORY_I_HXX_ +#define _SMESH_HYPOTHESISFACTORY_I_HXX_ + +#include "SMESH_Hypothesis_i.hxx" +#include +#include + +class GenericHypothesisCreator_i +{ +public: + virtual SMESH_Hypothesis_i* Create(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) = 0; +}; + +class SMESH_HypothesisFactory_i +{ +public: + SMESH_HypothesisFactory_i(); + virtual ~SMESH_HypothesisFactory_i(); + + SMESH_Hypothesis_i* Create(const char* anHyp, + CORBA::Long studyId, + ::SMESH_Gen* genImpl) + throw (SALOME::SALOME_Exception); + +private: + map _creatorMap; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Hypothesis_i.cxx b/src/SMESH_I/SMESH_Hypothesis_i.cxx new file mode 100644 index 000000000..37af0d15a --- /dev/null +++ b/src/SMESH_I/SMESH_Hypothesis_i.cxx @@ -0,0 +1,64 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hypothesis_i.cxx +// Created : lun mai 6 13:42:11 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hypothesis_i.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Gen.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis_i::SMESH_Hypothesis_i() +{ + MESSAGE("SMESH_Hypothesis_i"); +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis_i::~SMESH_Hypothesis_i() +{ + MESSAGE("~SMESH_Hypothesis_i"); +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +char* SMESH_Hypothesis_i::GetName() +{ + MESSAGE("GetName"); + return CORBA::string_dup(_baseImpl->GetName()); +// const char* name = _baseImpl->GetName(); +// SCRUTE(name); +// return CORBA::string_dup(name); +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_Hypothesis_i::GetId() +{ + MESSAGE("GetId"); + return _baseImpl->GetID(); +} diff --git a/src/SMESH_I/SMESH_Hypothesis_i.hxx b/src/SMESH_I/SMESH_Hypothesis_i.hxx new file mode 100644 index 000000000..50c0ce449 --- /dev/null +++ b/src/SMESH_I/SMESH_Hypothesis_i.hxx @@ -0,0 +1,35 @@ +//============================================================================= +// File : SMESH_Hypothesis_i.hxx +// Created : lun mai 6 13:42:08 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESIS_I_HXX_ +#define _SMESH_HYPOTHESIS_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) + +class SMESH_Gen; +class SMESH_Hypothesis; + +class SMESH_Hypothesis_i: + public POA_SMESH::SMESH_Hypothesis +{ +public: + SMESH_Hypothesis_i(); + virtual ~SMESH_Hypothesis_i(); + + char* GetName(); + CORBA::Long GetId(); + +protected: + ::SMESH_Hypothesis* _baseImpl; + ::SMESH_Gen* _genImpl; + int _id; +}; + +#endif diff --git a/src/SMESH_I/SMESH_LocalLength_i.cxx b/src/SMESH_I/SMESH_LocalLength_i.cxx new file mode 100644 index 000000000..b59f9c79c --- /dev/null +++ b/src/SMESH_I/SMESH_LocalLength_i.cxx @@ -0,0 +1,79 @@ +using namespace std; +//============================================================================= +// File : SMESH_LocalLength_i.cxx +// Created : mar mai 14 13:07:42 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_LocalLength_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * Constructor: + * _name is related to the class name: prefix = SMESH_ ; suffix = _i . + */ +//============================================================================= + +SMESH_LocalLength_i::SMESH_LocalLength_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_LocalLength_i::SMESH_LocalLength_i"); + _impl = new ::SMESH_LocalLength(genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LocalLength_i::~SMESH_LocalLength_i() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_LocalLength_i::SetLength(CORBA::Double length) + throw (SALOME::SALOME_Exception) +{ + ASSERT(_impl); + try + { + _impl->SetLength(length); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ + SALOME::BAD_PARAM); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Double SMESH_LocalLength_i::GetLength() +{ + ASSERT(_impl); + return _impl->GetLength(); +} + diff --git a/src/SMESH_I/SMESH_LocalLength_i.hxx b/src/SMESH_I/SMESH_LocalLength_i.hxx new file mode 100644 index 000000000..7f0b0ee53 --- /dev/null +++ b/src/SMESH_I/SMESH_LocalLength_i.hxx @@ -0,0 +1,40 @@ +//============================================================================= +// File : SMESH_LocalLength_i.hxx +// Created : mar mai 14 13:07:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_LOCALLENGTH_I_HXX_ +#define _SMESH_LOCALLENGTH_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" + +#include "SMESH_LocalLength.hxx" + +class SMESH_LocalLength_i: + public POA_SMESH::SMESH_LocalLength, + public SMESH_Hypothesis_i +{ +public: + SMESH_LocalLength_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + virtual ~SMESH_LocalLength_i(); + + void SetLength(CORBA::Double length) + throw (SALOME::SALOME_Exception); + + CORBA::Double GetLength(); + +protected: + ::SMESH_LocalLength* _impl; +}; + +#endif + diff --git a/src/SMESH_I/SMESH_MEDFamily_i.cxx b/src/SMESH_I/SMESH_MEDFamily_i.cxx new file mode 100644 index 000000000..6a1c23908 --- /dev/null +++ b/src/SMESH_I/SMESH_MEDFamily_i.cxx @@ -0,0 +1,244 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEDFamily_i.cxx +// Project : SALOME +// Copyright : EDF 2001 +//============================================================================= + +#include "SMESH_MEDFamily_i.hxx" +#include "utilities.h" +#include "Utils_CorbaException.hxx" + +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +SMESH_MEDFamily_i::SMESH_MEDFamily_i() +{ + BEGIN_OF("Default Constructor SMESH_MEDFamily_i"); + END_OF("Default Constructor SMESH_MEDFamily_i"); +} +//============================================================================= +/*! + * constructor par recopie + */ +//============================================================================= +SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f): + SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity), + _subMesh_i(f._subMesh_i), + _identifier(f._identifier), + _numberOfAttribute(f._numberOfAttribute), + _numberOfGroup(f._numberOfGroup), + _attributeValue(f._attributeValue) +{ + BEGIN_OF("Copy Constructor SMESH_MEDFamily_i"); + _attributeDescription=new string[_numberOfAttribute]; + for (int i=0;i<_numberOfAttribute;i++) { + _attributeDescription[i]=f._attributeDescription[i]; + }; + _groupName=new string[_numberOfGroup]; + for (int i=0;i<_numberOfAttribute;i++) { + _groupName[i]=f._groupName[i]; + }; + END_OF("Copy Constructor SMESH_MEDFamily_i"); +} +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +SMESH_MEDFamily_i::~SMESH_MEDFamily_i() +{ +} +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm, + string name, string description, SALOME_MED::medEntityMesh entity): + SMESH_MEDSupport_i( sm, name, description, entity ), + + _subMesh_i(sm), + _identifier(identifier), + _numberOfAttribute(0), + _attributeIdentifier((int*)NULL), + _attributeValue((int*)NULL), + _attributeDescription((string*)NULL), + _numberOfGroup(0), + _groupName((string*)NULL) +{ + BEGIN_OF("Constructor SMESH_MEDFamily_i"); + END_OF("Constructor SMESH_MEDFamily_i"); +} +//============================================================================= +/*! + * CORBA: Accessor for Family's Identifier + */ +//============================================================================= + +CORBA::Long SMESH_MEDFamily_i::getIdentifier() +throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + return _identifier; + +} +//============================================================================= +/*! + * CORBA: Accessor for number of attributes + */ +//============================================================================= +CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes() +throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + return _numberOfAttribute; +} +//============================================================================= +/*! + * CORBA: Accessor for attributes identifiers + */ +//============================================================================= +Engines::long_array* SMESH_MEDFamily_i::getAttributesIdentifiers() +throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + if (_numberOfAttribute == 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + }; + + Engines::long_array_var myseq= new Engines::long_array; + myseq->length(_numberOfAttribute); + for (int i=0;i<_numberOfAttribute;i++) + { + myseq[i]=_attributeIdentifier[i]; + }; + return myseq._retn(); + +} +//============================================================================= +/*! + * CORBA: Accessor for attribute identifier I + */ +//============================================================================= +CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + if (_numberOfAttribute = 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + }; + ASSERT (i <= _numberOfAttribute); + return _attributeIdentifier[i]; +} +//============================================================================= +/*! + * CORBA: Accessor for attributes values + */ +//============================================================================= +Engines::long_array* SMESH_MEDFamily_i::getAttributesValues() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + + if (_numberOfAttribute == 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + }; + + Engines::long_array_var myseq= new Engines::long_array; + myseq->length(_numberOfAttribute); + for (int i=0;i<_numberOfAttribute;i++) + { + myseq[i]=_attributeValue[i]; + }; + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Accessor for attribute value I + */ +//============================================================================= +CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + if (_numberOfAttribute = 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + } + + ASSERT (i <= _numberOfAttribute); + return _attributeValue[i]; +} +//============================================================================= +/*! + * CORBA: Accessor for attributes desriptions + */ +//============================================================================= +Engines::string_array * SMESH_MEDFamily_i::getAttributesDescriptions() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + if (_numberOfAttribute = 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + } + Engines::string_array_var myseq = new Engines::string_array; + for (int i=0;i<_numberOfAttribute;i++) + { + myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str()); + } + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Accessor for attribute description i + */ +//============================================================================= +char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ + SALOME::INTERNAL_ERROR); + if (_numberOfAttribute = 0) + { + MESSAGE("Les familles SMESH n ont pas d attribut"); + THROW_SALOME_CORBA_EXCEPTION("No attributes"\ + ,SALOME::BAD_PARAM); + } + ASSERT (i <= _numberOfAttribute); + return CORBA::string_dup(_attributeDescription[i].c_str()); +} diff --git a/src/SMESH_I/SMESH_MEDFamily_i.hxx b/src/SMESH_I/SMESH_MEDFamily_i.hxx new file mode 100644 index 000000000..df0e2b795 --- /dev/null +++ b/src/SMESH_I/SMESH_MEDFamily_i.hxx @@ -0,0 +1,59 @@ +//============================================================================= +// File : SMESH_MEDFamily_i.hxx +// Project : SALOME +// Copyright : EDF 2001 +//============================================================================= + +#ifndef SMESH_MED_FAMILY_I_HXX_ +#define SMESH_MED_FAMILY_I_HXX_ + +#include "SMESH_MEDSupport_i.hxx" + +#include + +class SMESH_MEDFamily_i: + public POA_SALOME_MED::FAMILY, + public SMESH_MEDSupport_i +{ +protected : + SMESH_MEDFamily_i(); + ~SMESH_MEDFamily_i(); + + ::SMESH_subMesh_i* _subMesh_i; + + // Values + int _identifier; + int _numberOfAttribute; + int * _attributeIdentifier; + int * _attributeValue; + string * _attributeDescription; + int _numberOfGroup ; + string * _groupName ; + + +public : + + // Constructors and associated internal methods + SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm, + string name, string description, SALOME_MED::medEntityMesh entity ); + SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f); + + CORBA::Long getIdentifier() + throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfAttributes() + throw (SALOME::SALOME_Exception); + Engines::long_array* getAttributesIdentifiers() + throw (SALOME::SALOME_Exception); + CORBA::Long getAttributeIdentifier(CORBA::Long i) + throw (SALOME::SALOME_Exception); + Engines::long_array* getAttributesValues() + throw (SALOME::SALOME_Exception); + CORBA::Long getAttributeValue(CORBA::Long i) + throw (SALOME::SALOME_Exception); + Engines::string_array* getAttributesDescriptions() + throw (SALOME::SALOME_Exception); + char* getAttributeDescription( CORBA::Long i) + throw (SALOME::SALOME_Exception); + +}; +#endif /* MED_FAMILY_I_HXX_ */ diff --git a/src/SMESH_I/SMESH_MEDMesh_i.cxx b/src/SMESH_I/SMESH_MEDMesh_i.cxx new file mode 100644 index 000000000..23fb01fe6 --- /dev/null +++ b/src/SMESH_I/SMESH_MEDMesh_i.cxx @@ -0,0 +1,1018 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEDMesh_i.cxx +// Project : SALOME +// Copyright : EDF 2001 +//============================================================================= + +#include "SMESH_MEDMesh_i.hxx" +#include "SMESH_Mesh_i.hxx" + +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" + +#include "SMDS_MapIteratorOfExtendedMap.hxx" +#include "SMDS_MapOfMeshElement.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utilities.h" +#include "Utils_CorbaException.hxx" + +#include "SMESH_MEDSupport_i.hxx" +#include "SMESH_MEDFamily_i.hxx" + +# include "Utils_ORB_INIT.hxx" +# include "Utils_SINGLETON.hxx" +extern "C" +{ +#include +} + + +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +// PN Est-ce un const ? +SMESH_MEDMesh_i::SMESH_MEDMesh_i() +{ + BEGIN_OF("Default Constructor SMESH_MEDMesh_i"); + END_OF("Default Constructor SMESH_MEDMesh_i"); +} +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +SMESH_MEDMesh_i::~SMESH_MEDMesh_i() +{ +} +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +SMESH_MEDMesh_i::SMESH_MEDMesh_i( ::SMESH_Mesh_i* m_i ) :_meshId(""), + _compte(false), + _creeFamily(false), + _famIdent(0), + _indexElts(0), + _indexEnts(0) +{ + _mesh_i = m_i; + _meshDS = _mesh_i->GetImpl().GetMeshDS(); + + BEGIN_OF("Constructor SMESH_MEDMesh_i"); + END_OF("Constructor SMESH_MEDMesh_i"); +} + +//============================================================================= +/*! + * CORBA: Accessor for Name + */ +//============================================================================= +char * SMESH_MEDMesh_i::getName() + throw (SALOME::SALOME_Exception) +{ + if (_meshDS == NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + + try + { + // A COMPLETER PAR LE NOM DU MAILLAGE + //return CORBA::string_dup(_mesh_i->getName().c_str()); + return CORBA::string_dup("toto"); + } + catch(...) + { + MESSAGE("Exception en accedant au nom"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } +} +//============================================================================= +/*! + * CORBA: Accessor for corbaindex cuisine interne + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getCorbaIndex() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA: Accessor for Space Dimension + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getSpaceDimension() + throw (SALOME::SALOME_Exception) +{ + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + return 3; +} +//============================================================================= +/*! + * CORBA: Accessor for Mesh Dimension + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getMeshDimension() + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + return 3; +} +//============================================================================= +/*! + * CORBA: Accessor for Coordinates System + */ +//============================================================================= +char * SMESH_MEDMesh_i::getCoordinateSystem() + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + // PN : En dur. Non encore prevu + try + { + string systcoo="CARTESIEN"; + return CORBA::string_dup(systcoo.c_str()); + } + catch(...) + { + MESSAGE("Exception en accedant au maillage"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } +} +//============================================================================= +/*! + * CORBA: Accessor for Coordinates + */ +//============================================================================= +Engines::double_array * SMESH_MEDMesh_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + Engines::double_array_var myseq = new Engines::double_array; + try + { + // PN : En dur + int spaceDimension=3; + int nbNodes=_meshDS->NbNodes(); + SCRUTE(nbNodes); + myseq->length(nbNodes*spaceDimension); + int i = 0; + SMDS_MeshNodesIterator itNodes(_meshDS); + for (;itNodes.More();itNodes.Next()) + { + + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode)& node =_meshDS->GetNode(1,elem); + + if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE) + { + myseq[i*3]=node->X(); + myseq[i*3+1]=node->Y(); + myseq[i*3+2]=node->Z(); + SCRUTE(myseq[i*3]); + SCRUTE(myseq[i*3+1]); + SCRUTE(myseq[i*3+2]); + } + else + { + ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE); + myseq[i]=node->X(); + myseq[i+nbNodes]=node->Y(); + myseq[i+(nbNodes*2)]=node->Z(); + SCRUTE(myseq[i]); + SCRUTE(myseq[i+nbNodes]); + SCRUTE(myseq[i+(nbNodes*2)]); + } + i++; + } + } + catch(...) + { + MESSAGE("Exception en accedant aux coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Accessor for Coordinates Names + */ +//============================================================================= +Engines::string_array * SMESH_MEDMesh_i::getCoordinatesNames() + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + Engines::string_array_var myseq = new Engines::string_array; + try + { + // PN : en dur + int spaceDimension=3; + myseq->length(spaceDimension); + myseq[0]=CORBA::string_dup("x"); + myseq[1]=CORBA::string_dup("y"); + myseq[2]=CORBA::string_dup("z"); + } + catch(...) + { + MESSAGE("Exception en accedant aux noms des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } + return myseq._retn(); + +} +//============================================================================= +/*! + * CORBA: Accessor for Coordinates Units + */ +//============================================================================= +Engines::string_array * SMESH_MEDMesh_i::getCoordinatesUnits() + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + Engines::string_array_var myseq = new Engines::string_array; + try + { + // PN : en dur + int spaceDimension=3; + myseq->length(spaceDimension); + myseq[0]=CORBA::string_dup("m"); + myseq[1]=CORBA::string_dup("m"); + myseq[2]=CORBA::string_dup("m"); + } + catch(...) + { + MESSAGE("Exception en accedant aux unites des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Accessor for Number of Nodes + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes() + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + try + { + return _meshDS->NbNodes(); + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de noeuds"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } +} +//============================================================================= +/*! + * CORBA: Accessor for number of Types + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + try + { + if (! _compte) + calculeNbElts(); + int retour = 0; + if ( _mapNbTypes.find(entity)!=_mapNbTypes.end()) + retour=_mapNbTypes[entity]; + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de Types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } +} + +//============================================================================= +/*! + * CORBA: Accessor for existing geometry element types + * Not implemented for MED_ALL_ENTITIES + */ +//============================================================================= +SALOME_MED::medGeometryElement_array * SMESH_MEDMesh_i::getTypes (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + if (entity ==SALOME_MED::MED_ALL_ENTITIES) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\ + SALOME::BAD_PARAM); + if (! _compte) + calculeNbElts(); + SALOME_MED::medGeometryElement_array_var myseq = + new SALOME_MED::medGeometryElement_array; + try + { + if ( _mapNbTypes.find(entity) ==_mapNbTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\ + ,SALOME::BAD_PARAM); + int nbTypes=_mapNbTypes[entity]; + + myseq->length(nbTypes); + + if ( _mapIndToVectTypes.find(entity) ==_mapIndToVectTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\ + ,SALOME::INTERNAL_ERROR); + + int index=_mapIndToVectTypes[entity]; + ASSERT( _TypesId[index].size()!=0); + int i=0; + vector::iterator it; + for (it=_TypesId[index].begin();it!=_TypesId[index].end();it++) + { + myseq[i++]=*it; + }; + } + catch(...) + { + MESSAGE("Exception en accedant aux differents types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Returns number of elements of type medGeometryElement + * Not implemented for MED_ALL_ELEMENTS + * implemented for MED_ALL_ENTITIES + * + * Dans cette implementation, il n est pas prevu de tenir compte du entity + * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + if (geomElement == SALOME_MED::MED_ALL_ELEMENTS) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", \ + SALOME::BAD_PARAM); + if (! _compte) + calculeNbElts(); + + try + { + int retour = 0; + if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end()) + { + int index = _mapIndToSeqElts[geomElement]; + retour=_seq_elemId[index]->length(); + } + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre d élements"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ + ,SALOME::INTERNAL_ERROR); + } +} +//============================================================================= +/*! + * CORBA: Accessor for connectivities + */ +//============================================================================= +Engines::long_array * SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch, + SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + if (mode != SALOME_MED::MED_NODAL) + THROW_SALOME_CORBA_EXCEPTION("Not Implemented",\ + SALOME::BAD_PARAM); + if (typeSwitch == SALOME_MED::MED_NO_INTERLACE) + THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented",\ + SALOME::BAD_PARAM); + if (! _compte) + calculeNbElts(); + + // Faut-il renvoyer un pointeur vide ??? + if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh"\ + ,SALOME::BAD_PARAM); + + int index=_mapIndToSeqElts[geomElement]; + return _seq_elemId[index]._retn(); +} +//============================================================================= +/*! + * CORBA: Accessor for connectivities + */ +//============================================================================= +Engines::long_array* SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: Find an element corresponding to the given connectivity + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const Engines::long_array & connectivity +) + throw (SALOME::SALOME_Exception) +{ + const char * LOC = "getElementNumber "; + MESSAGE(LOC<<"Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return -1; +} +//============================================================================= +/*! + * CORBA: Accessor for Ascendant connectivities + * not implemented for MED_ALL_ENTITIES and MED_MAILLE + */ +//============================================================================= +Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::medConnectivity mode) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: Accessor for connectivities + */ +//============================================================================= +Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: Returns number of families within the mesh + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + return _families.size(); +} +//============================================================================= +/*! + * CORBA: Returns number of groups within the mesh + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + return 0; +} +//============================================================================= +/*! + * CORBA: Returns references for families within the mesh + */ +//============================================================================= +SALOME_MED::Family_array * SMESH_MEDMesh_i::getFamilies(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array; + int nbfam= _families.size(); + myseq->length(nbfam); + int i = 0; + vector::iterator it; + for (it=_families.begin();it!=_families.end();it++) + { + myseq[i++]=*it; + }; + return myseq._retn(); +} +//============================================================================= +/*! + * CORBA: Returns references for family i within the mesh + */ +//============================================================================= +SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::medEntityMesh entity, + CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + + SCRUTE(_families[i]->getName()); + MESSAGE ( " SMESH_MEDMesh_i::getFamily " << i ) + return _families[i]; +} +//============================================================================= +/*! + * CORBA: Returns references for groups within the mesh + */ +//============================================================================= +SALOME_MED::Group_array * SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA: Returns references for group i within the mesh + */ +//============================================================================= +SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::medEntityMesh entity, + CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: + */ +//============================================================================= +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * CORBA: add the Mesh in the StudyManager + * PN Pas Implemente + */ +//============================================================================= +void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy, + SALOME_MED::MESH_ptr myIor) + throw (SALOME::SALOME_Exception) +{ + BEGIN_OF("MED_Mesh_i::addInStudy"); + if ( _meshId != "" ) + { + MESSAGE("Mesh already in Study"); + THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \ + SALOME::BAD_PARAM); + }; + + /* + SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + + // Create SComponent labelled 'MED' if it doesn't already exit + SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED"); + if ( CORBA::is_nil(medfather) ) + { + MESSAGE("Add Component MED"); + medfather = myBuilder->NewComponent("MED"); + //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED"); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + myBuilder->FindOrCreateAttribute(medfather, "AttributeName")); + aName->SetValue("MED"); + + myBuilder->DefineComponentInstance(medfather,myIor); + + } ; + + MESSAGE("Add a mesh Object under MED"); + myBuilder->NewCommand(); + SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather); + + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init(0,0); + string iorStr = orb->object_to_string(myIor); + //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str()); + SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow( + myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR")); + aIOR->SetValue(iorStr.c_str()); + + //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str()); + SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + myBuilder->FindOrCreateAttribute(newObj, "AttributeName")); + aName->SetValue(_mesh_i->getName().c_str()); + + _meshId = newObj->GetID(); + myBuilder->CommitCommand(); + + */ + END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)"); +} +//============================================================================= +/*! + * CORBA: write mesh in a med file + */ +//============================================================================= +void SMESH_MEDMesh_i::write(CORBA::Long i, const char* driverMeshName) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA: read mesh in a med file + */ +//============================================================================= +void SMESH_MEDMesh_i::read(CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA : release driver + */ +//============================================================================= +void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); +} +//============================================================================= +/*! + * CORBA : attach driver + */ +//============================================================================= +CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType, + const char* fileName, const char* meshName) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ + ,SALOME::BAD_PARAM); + return 0; +} +//============================================================================= +/*! + * Calcule le Nb d'elements par entite geometrique + */ +//============================================================================= +void SMESH_MEDMesh_i::calculeNbElts() + throw (SALOME::SALOME_Exception) +{ + if (! _compte) + { + _compte=true; + + _mapNbTypes[SALOME_MED::MED_NODE]=1; + // On compte les aretes MED_SEG2 ou MED_SEG3 + // On range les elements dans les vecteurs correspondants + + _mapIndToSeqElts[SALOME_MED::MED_SEG2]=_indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_SEG3]=_indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_EDGE]=_indexEnts++; + + int trouveSeg2=0; + int trouveSeg3=0; + SALOME_MED::medGeometryElement medElement; + SMDS_MeshEdgesIterator itEdges(_meshDS); + for (;itEdges.More();itEdges.Next()) + { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + int nb_of_nodes = elem->NbNodes(); + + switch (nb_of_nodes) + { + case 2 : + { + medElement=SALOME_MED::MED_SEG2; + if (trouveSeg2==0) + { + trouveSeg2=1; + _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG2); + + } + break; + } + case 3 : + { + medElement=SALOME_MED::MED_SEG3; + if (trouveSeg3==0) + { + trouveSeg3=1; + _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG3); + } + break; + } + } + int index=_mapIndToSeqElts[medElement]; + SCRUTE(index); + // Traitement de l arete + int longueur=_seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); + + for (int k=0; kGetConnection(k+1) +1; + } + } + + _mapNbTypes[SALOME_MED::MED_EDGE]=trouveSeg2 + trouveSeg3; + + // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6 + // On range les elements dans les vecteurs correspondants + int trouveTria3=0; + int trouveTria6=0; + int trouveQuad4=0; + + _mapIndToSeqElts[SALOME_MED::MED_TRIA3]=_indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_TRIA6]=_indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_QUAD4]=_indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_FACE]=_indexEnts++; + + SMDS_MeshFacesIterator itFaces(_meshDS); + for (;itFaces.More();itFaces.Next()) + { + + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + int nb_of_nodes = elem->NbNodes(); + + switch (nb_of_nodes) + { + case 3 : + { + medElement=SALOME_MED::MED_TRIA3; + if (trouveTria3==0) + { + trouveTria3=1; + _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA3); + } + break; + } + case 4 : + { + medElement=SALOME_MED::MED_QUAD4; + if (trouveQuad4==0) + { + trouveQuad4=1; + _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_QUAD4); + } + break; + } + case 6 : + { + medElement=SALOME_MED::MED_TRIA6; + if (trouveTria6==0) + { + trouveTria6=1; + _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA6); + } + break; + } + } + int index=_mapIndToSeqElts[medElement]; + SCRUTE(index); + + // Traitement de la face + // Attention La numérotation des noeuds Med commence a 1 + + + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur+nb_of_nodes); + + for (int k=0; kGetConnection(k+1) +1; + } + + } + _mapNbTypes[SALOME_MED::MED_FACE]=trouveTria3 + trouveTria6 + trouveQuad4; + + _mapIndToSeqElts[SALOME_MED::MED_HEXA8]=_indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_CELL]=_indexEnts++; + int index=_mapIndToSeqElts[medElement]; + + int trouveHexa8=0; + SMDS_MeshVolumesIterator itVolumes(_meshDS); + for (;itVolumes.More();itVolumes.Next()) + { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + int nb_of_nodes = elem->NbNodes(); + medElement=SALOME_MED::MED_HEXA8; + ASSERT(nb_of_nodes=8); + + if (trouveHexa8 == 0) + { + trouveHexa8=1; + _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8); + }; + // Traitement de la maille + int longueur=_seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur+nb_of_nodes); + + for (int k=0; kGetConnection(k+1) +1; + } + + } + + _mapNbTypes[SALOME_MED::MED_CELL]=trouveHexa8; + _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES] + =trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + trouveSeg3 ; + } /* fin du _compte */ +}; +//============================================================================= +/*! + * Creation des familles + */ +//============================================================================= +void SMESH_MEDMesh_i::createFamilies() + throw (SALOME::SALOME_Exception) +{ + string famDes=("Je ne sais pas"); + string famName0="Famille_"; + string famName; + char numero[10]; + + if ( _creeFamily == false) + { + _creeFamily = true; + SMESH_subMesh_i* subMeshServant; + + map::iterator it; + for (it = _mesh_i->_mapSubMesh_i.begin(); it != _mesh_i->_mapSubMesh_i.end(); it++) { + SMESH_subMesh_i* submesh_i = (*it).second; + int famIdent = (*it).first; + + ASSERT (famIdent<999999999); + sprintf(numero,"%d\n",famIdent); + famName=famName0 + numero; + + SMESH_MEDFamily_i * famservant= new SMESH_MEDFamily_i(famIdent, submesh_i, + famName, famDes, SALOME_MED::MED_NODE); + SALOME_MED::FAMILY_ptr famille = + SALOME_MED::FAMILY::_narrow(famservant->POA_SALOME_MED::FAMILY::_this()); + _families.push_back(famille); + } + } /* fin du _compte */ +}; + diff --git a/src/SMESH_I/SMESH_MEDMesh_i.hxx b/src/SMESH_I/SMESH_MEDMesh_i.hxx new file mode 100644 index 000000000..4072134cd --- /dev/null +++ b/src/SMESH_I/SMESH_MEDMesh_i.hxx @@ -0,0 +1,163 @@ +//============================================================================= +// File : SMESH_MEDMesh_i.hxx +// Project : SALOME +// Copyright : EDF 2001 +//============================================================================= + +#ifndef _MED_SMESH_MESH_I_HXX_ +#define _MED_SMESH_MESH_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(MED) +#include +#include +#include + +#include "SMESHDS_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#define MED_NBR_GEOMETRIE_MAILLE 15 +#define MED_NBR_TYPE 5 + + +class SMESH_Mesh_i; + +class SMESH_MEDMesh_i: + public POA_SALOME_MED::MESH, + public PortableServer::RefCountServantBase +{ +public : + +private : + +protected: + // C++ object containing values + ::SMESH_Mesh_i* _mesh_i; + Handle (SMESHDS_Mesh) _meshDS; + + string _meshId; + bool _compte; + bool _creeFamily; + int _indexElts; + int _indexEnts; + int _famIdent; + + map _mapIndToSeqElts; + Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE]; + + map _mapNbTypes; + map _mapIndToVectTypes; + vector _TypesId[MED_NBR_GEOMETRIE_MAILLE]; + + vector _families; +public: + + // Constructors and associated internal methods + SMESH_MEDMesh_i(); + SMESH_MEDMesh_i(SMESH_Mesh_i* m); + ~SMESH_MEDMesh_i(); + + // IDL Methods + char * getName() throw (SALOME::SALOME_Exception); + CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception); + CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception); + + char * getCoordinateSystem() + throw (SALOME::SALOME_Exception); + Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch) + throw (SALOME::SALOME_Exception); + Engines::string_array* getCoordinatesNames() + throw (SALOME::SALOME_Exception); + Engines::string_array* getCoordinatesUnits() + throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfNodes() + throw (SALOME::SALOME_Exception); + + CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + + CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception); + Engines::long_array* getConnectivity (SALOME_MED::medModeSwitch typeSwitch, + SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception); + Engines::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + + CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const Engines::long_array & connectivity) + throw (SALOME::SALOME_Exception); + + Engines::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode) + + throw (SALOME::SALOME_Exception); + Engines::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) + throw (SALOME::SALOME_Exception); + + // Family and Group + CORBA::Long getNumberOfFamilies (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfGroups (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + SALOME_MED::Family_array* getFamilies (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity, + CORBA::Long i) + throw (SALOME::SALOME_Exception); + SALOME_MED::Group_array* getGroups (SALOME_MED::medEntityMesh entity) + throw (SALOME::SALOME_Exception); + SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity, + CORBA::Long i) + throw (SALOME::SALOME_Exception); + // + SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport) + throw (SALOME::SALOME_Exception); + + + // Others + void addInStudy (SALOMEDS::Study_ptr myStudy, + SALOME_MED::MESH_ptr myIor) + throw (SALOME::SALOME_Exception); + CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType, + const char* fileName, const char* meshName) + throw (SALOME::SALOME_Exception); + void rmDriver (CORBA::Long i) + throw (SALOME::SALOME_Exception); + void read (CORBA::Long i) + throw (SALOME::SALOME_Exception); + void write (CORBA::Long i, const char* driverMeshName) + throw (SALOME::SALOME_Exception); + + // Cuisine interne + CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception); + + // + void calculeNbElts() throw (SALOME::SALOME_Exception); + void createFamilies() throw (SALOME::SALOME_Exception); +}; + +#endif /* _MED_MESH_I_HXX_ */ diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx new file mode 100644 index 000000000..9dfa7a076 --- /dev/null +++ b/src/SMESH_I/SMESH_MEDSupport_i.cxx @@ -0,0 +1,353 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEDSupport_i.cxx +// Project : SALOME +// Copyright : EDF 2002 +//============================================================================= + +#include "SMESH_MEDSupport_i.hxx" +#include "utilities.h" +#include "Utils_CorbaException.hxx" + +#include +#include "SMESHDS_Mesh.hxx" +#include "SMDS_MapIteratorOfExtendedMap.hxx" + +#include "SMESH_subMesh.hxx" +#include "SMESH_Mesh_i.hxx" +#include "SMESH_subMesh_i.hxx" + +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= +SMESH_MEDSupport_i::SMESH_MEDSupport_i() +{ + BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); + END_OF("Default Constructor SMESH_MEDSupport_i"); +} + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i* sm, + string name, + string description, + SALOME_MED::medEntityMesh entity) : + _subMesh_i(sm), + _name(name), + _description(description), + _entity(entity), + _seqNumber(false), + _seqLength(0) +{ + BEGIN_OF("Constructor SMESH_MEDSupport_i"); + + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + + int subMeshId = _subMesh_i->GetId(); + + MESSAGE ( " subMeshId " << subMeshId ) + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) { + ::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + + _subMeshDS = subMesh->GetSubMeshDS(); + } + + if ( _entity == SALOME_MED::MED_NODE) + { + _numberOfGeometricType = 1 ; + _geometricType = new SALOME_MED::medGeometryElement[1] ; + _geometricType[0] = SALOME_MED::MED_NONE ; + } + else + { + MESSAGE("Pas implemente dans cette version"); + THROW_SALOME_CORBA_EXCEPTION("Seules les familles de noeuds sont implementees ", \ + SALOME::BAD_PARAM); + } + + END_OF("Constructor SMESH_MEDSupport_i"); +} +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) : + _subMesh_i(s._subMesh_i), + _name(s._name), + _description(s._description), + _entity(s._entity), + _seqNumber(false), + _seqLength(0) +{ + BEGIN_OF("Constructor SMESH_MEDSupport_i"); + + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + + int subMeshId = _subMesh_i->GetId(); + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) { + ::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + _subMeshDS = subMesh->GetSubMeshDS(); + } + + END_OF("Constructor SMESH_MEDSupport_i"); +} +//============================================================================= +/*! + * Destructor + */ +//============================================================================= + +SMESH_MEDSupport_i::~SMESH_MEDSupport_i() +{ +} +//============================================================================= +/*! + * CORBA: Accessor for Corba Index + */ +//============================================================================= + +CORBA::Long SMESH_MEDSupport_i::getCorbaIndex() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", \ + SALOME::BAD_PARAM); + +} + +//============================================================================= +/*! + * CORBA: Accessor for Name + */ +//============================================================================= + +char * SMESH_MEDSupport_i::getName() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_name.c_str()); + +} + +//============================================================================= +/*! + * CORBA: Accessor for Description + */ +//============================================================================= + +char* SMESH_MEDSupport_i::getDescription() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_description.c_str()); +} + +//============================================================================= +/*! + * CORBA: Accessor for Mesh + */ +//============================================================================= + +SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + + return _subMesh_i->_mesh_i->GetMEDMesh(); +} + +//============================================================================= +/*! + * CORBA: boolean indicating if support concerns all elements + */ +//============================================================================= + +CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + if (_seqNumber == false) + { + if (_entity != SALOME_MED::MED_NONE) + { + int i = 0; + const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes(); + for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) + { + const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); + const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); + i ++; + } + _seqLength=i; + _seqNumber=true; + } + else + { + MESSAGE("Only Node Families are implemented "); + THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", \ + SALOME::BAD_PARAM); + } + } + try + { + if (_seqLength == _meshDS->NbNodes()) + _isOnAllElements=true; + else + _isOnAllElements=false; + } + catch(...) + { + MESSAGE("unable to acces related Mesh"); + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ + SALOME::INTERNAL_ERROR); + }; + return _isOnAllElements; +} + +//============================================================================= +/*! + * CORBA: Accessor for type of support's entity + */ +//============================================================================= + +SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + return _entity; +} + +//============================================================================= +/*! + * CORBA: Accessor for types of geometry elements + */ +//============================================================================= + +SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes() + throw (SALOME::SALOME_Exception) +{ + if (_subMeshDS.IsNull()) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ + SALOME::INTERNAL_ERROR); + SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array; + try + { + int mySeqLength = _numberOfGeometricType; + myseq->length(mySeqLength); + for (int i=0;iGetNodes(); + for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) + { + const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); + const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); + myseq->length(i+1); + myseq[i]=node->GetID(); +SCRUTE(node->GetID()); +SCRUTE(myseq[i]); + i++; + }; + +SCRUTE(myseq->length()); +MESSAGE("yyyyy"); + return myseq._retn(); + +} +//============================================================================= +/*! + * CORBA: Global Nodes Index (optionnaly designed by the user) + * CORBA: ?????????????????????????????? + */ +//============================================================================= + +Engines::long_array * SMESH_MEDSupport_i::getNumberIndex() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented", \ + SALOME::BAD_PARAM); + return 0; +} + +//============================================================================= +/*! + * CORBA: Array containing indexes for elements included in the support + */ +//============================================================================= + +CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("Not implemented for SMESH_i"); + return 0; +} + diff --git a/src/SMESH_I/SMESH_MEDSupport_i.hxx b/src/SMESH_I/SMESH_MEDSupport_i.hxx new file mode 100644 index 000000000..a52f83cf5 --- /dev/null +++ b/src/SMESH_I/SMESH_MEDSupport_i.hxx @@ -0,0 +1,81 @@ +//============================================================================= +// File : SMESH_MEDSupport_i.hxx +// Project : SALOME +// Copyright : EDF 2001 +//============================================================================= + +#ifndef _MED_SMESH_MEDSUPPORT_I_HXX_ +#define _MED_SMESH_MEDSUPPORT_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(MED) +#include + +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" + +#include "SMESH_MEDSupport_i.hxx" + +class SMESH_subMesh_i; + +class SMESH_MEDSupport_i: + public POA_SALOME_MED::SUPPORT, + public PortableServer::RefCountServantBase +{ + +protected : + SMESH_MEDSupport_i(); + ~SMESH_MEDSupport_i(); + + +public : + + Handle_SMESHDS_SubMesh _subMeshDS; + ::SMESH_subMesh_i* _subMesh_i; + + Handle_SMESHDS_Mesh _meshDS; + string _name; + string _description; + bool _isOnAllElements; + bool _seqNumber; + int _seqLength; + + SALOME_MED::medEntityMesh _entity; + SALOME_MED::medGeometryElement * _geometricType; + int _numberOfGeometricType; + + +public: + + // Constructors and associated internal methods + SMESH_MEDSupport_i(SMESH_subMesh_i* sm, + string name, + string description, + SALOME_MED::medEntityMesh entity); + SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s); + + // IDL Methods + char * getName() throw (SALOME::SALOME_Exception); + char * getDescription() throw (SALOME::SALOME_Exception); + SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception); + CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception); + SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception); + Engines::long_array* getNumber(SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception); + Engines::long_array* getNumberIndex() + throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement) + throw (SALOME::SALOME_Exception); + SALOME_MED::medGeometryElement_array* getTypes() + throw (SALOME::SALOME_Exception); + CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception); + void createSeq() throw (SALOME::SALOME_Exception); + + +}; + +#endif /* _MED_MEDSUPPORT_I_HXX_ */ diff --git a/src/SMESH_I/SMESH_MEFISTO_2D_i.cxx b/src/SMESH_I/SMESH_MEFISTO_2D_i.cxx new file mode 100644 index 000000000..bff534478 --- /dev/null +++ b/src/SMESH_I/SMESH_MEFISTO_2D_i.cxx @@ -0,0 +1,61 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEFISTO_2D_i.cxx +// Created : jeu mai 16 13:26:18 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MEFISTO_2D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MEFISTO_2D_i::SMESH_MEFISTO_2D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_MEFISTO_2D_i::SMESH_MEFISTO_2D_i"); + _genImpl = genImpl; + ::SMESH_MEFISTO_2D* impl + = new ::SMESH_MEFISTO_2D(_genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + SetImpl(impl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MEFISTO_2D_i::~SMESH_MEFISTO_2D_i() +{ + MESSAGE("SMESH_MEFISTO_2D_i::~SMESH_MEFISTO_2D_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MEFISTO_2D_i::SetImpl(::SMESH_MEFISTO_2D* impl) +{ + MESSAGE("SMESH_MEFISTO_2D_i::SetImpl"); + SMESH_2D_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_MEFISTO_2D_i.hxx b/src/SMESH_I/SMESH_MEFISTO_2D_i.hxx new file mode 100644 index 000000000..de20edc71 --- /dev/null +++ b/src/SMESH_I/SMESH_MEFISTO_2D_i.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_MEFISTO_2D_i.hxx +// Created : jeu mai 16 13:26:22 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MEFISTO_2D_I_HXX_ +#define _SMESH_MEFISTO_2D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_2D_Algo_i.hxx" + +#include "SMESH_MEFISTO_2D.hxx" + +class SMESH_MEFISTO_2D_i: + public POA_SMESH::SMESH_MEFISTO_2D, + public SMESH_2D_Algo_i +{ +public: + SMESH_MEFISTO_2D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + + virtual ~SMESH_MEFISTO_2D_i(); + +protected: + virtual void SetImpl(::SMESH_MEFISTO_2D* impl); + + ::SMESH_MEFISTO_2D* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_MaxElementArea_i.cxx b/src/SMESH_I/SMESH_MaxElementArea_i.cxx new file mode 100644 index 000000000..5af798fd3 --- /dev/null +++ b/src/SMESH_I/SMESH_MaxElementArea_i.cxx @@ -0,0 +1,79 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementArea_i.cxx +// Created : sam mai 18 23:14:24 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MaxElementArea_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * Constructor: + * _name is related to the class name: prefix = SMESH_ ; suffix = _i . + */ +//============================================================================= + +SMESH_MaxElementArea_i::SMESH_MaxElementArea_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_MaxElementArea_i::SMESH_MaxElementArea_i"); + _impl = new ::SMESH_MaxElementArea(genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MaxElementArea_i::~SMESH_MaxElementArea_i() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MaxElementArea_i::SetMaxElementArea(CORBA::Double area) + throw (SALOME::SALOME_Exception) +{ + ASSERT(_impl); + try + { + _impl->SetMaxArea(area); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ + SALOME::BAD_PARAM); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Double SMESH_MaxElementArea_i::GetMaxElementArea() +{ + ASSERT(_impl); + return _impl->GetMaxArea(); +} + diff --git a/src/SMESH_I/SMESH_MaxElementArea_i.hxx b/src/SMESH_I/SMESH_MaxElementArea_i.hxx new file mode 100644 index 000000000..d95de4d1c --- /dev/null +++ b/src/SMESH_I/SMESH_MaxElementArea_i.hxx @@ -0,0 +1,39 @@ +//============================================================================= +// File : SMESH_MaxElementArea_i.hxx +// Created : sam mai 18 23:14:29 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MAXELEMENTAREA_I_HXX_ +#define _SMESH_MAXELEMENTAREA_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" + +#include "SMESH_MaxElementArea.hxx" + +class SMESH_MaxElementArea_i: + public POA_SMESH::SMESH_MaxElementArea, + public SMESH_Hypothesis_i +{ +public: + SMESH_MaxElementArea_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + virtual ~SMESH_MaxElementArea_i(); + + void SetMaxElementArea(CORBA::Double area) + throw (SALOME::SALOME_Exception); + + CORBA::Double GetMaxElementArea(); + +protected: + ::SMESH_MaxElementArea* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_MaxElementVolume_i.cxx b/src/SMESH_I/SMESH_MaxElementVolume_i.cxx new file mode 100644 index 000000000..011e5664b --- /dev/null +++ b/src/SMESH_I/SMESH_MaxElementVolume_i.cxx @@ -0,0 +1,9 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementVolume_i.cxx +// Created : sam mai 18 23:14:58 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH_I/SMESH_MaxElementVolume_i.hxx b/src/SMESH_I/SMESH_MaxElementVolume_i.hxx new file mode 100644 index 000000000..42da4f637 --- /dev/null +++ b/src/SMESH_I/SMESH_MaxElementVolume_i.hxx @@ -0,0 +1,8 @@ +//============================================================================= +// File : SMESH_MaxElementVolume_i.hxx +// Created : sam mai 18 23:14:53 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx new file mode 100644 index 000000000..22a03ed6f --- /dev/null +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -0,0 +1,215 @@ +using namespace std; +// File : SMESH_MeshEditor_i.cxx +// Created : Wed Jun 19 18:43:26 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#include "SMESH_MeshEditor_i.hxx" + +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" +#include "SMDS_MeshEdge.hxx" +#include "SMDS_MeshFace.hxx" +#include "SMDS_MeshVolume.hxx" + +#include "utilities.h" + +#include +#include + + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) { + _myMeshDS = theMesh; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOfElements) { + for (int i = 0 ; i< IDsOfElements.length(); i++) { + CORBA::Long index = IDsOfElements[i]; + _myMeshDS->RemoveElement(index); + MESSAGE ( "Element "<< index << " was removed" ) + } + return true; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNodes) { + + // Here we try to collect all 1D, 2D and 3D elements which contain at least one + // of in order to remove such elements. + // This seems correct since e.g a triangle without 1 vertex looks nonsense. + TColStd_MapOfInteger elemsToRemove; + + for (int i = 0 ; i< IDsOfNodes.length(); i++) { + + CORBA::Long ID = IDsOfNodes[i]; + + SMDS_MeshEdgesIterator edgeIt(_myMeshDS); + for (; edgeIt.More(); edgeIt.Next()) { + Handle(SMDS_MeshEdge) anEdge = Handle(SMDS_MeshEdge)::DownCast(edgeIt.Value()); + for (Standard_Integer i = 0; i < anEdge->NbNodes(); i++) { + if (anEdge->GetConnection(i) == ID) { + Standard_Integer elemID = anEdge->GetID(); + if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); + } + } + } + + SMDS_MeshFacesIterator faceIt(_myMeshDS); + for (; faceIt.More(); faceIt.Next()) { + Handle(SMDS_MeshFace) aFace = Handle(SMDS_MeshFace)::DownCast(faceIt.Value()); + for (Standard_Integer i = 0; i < aFace->NbNodes(); i++) { + if (aFace->GetConnection(i) == ID) { + Standard_Integer elemID = aFace->GetID(); + if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); + } + } + } + + SMDS_MeshVolumesIterator volIt(_myMeshDS); + for (; volIt.More(); volIt.Next()) { + Handle(SMDS_MeshVolume) aVol = Handle(SMDS_MeshVolume)::DownCast(volIt.Value()); + for (Standard_Integer i = 0; i < aVol->NbNodes(); i++) { + if (aVol->GetConnection(i) == ID) { + Standard_Integer elemID = aVol->GetID(); + if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); + } + } + } + } + + // Now remove them! + TColStd_MapIteratorOfMapOfInteger it(elemsToRemove); + for (; it.More(); it.Next()) { + Standard_Integer elemID = it.Key(); + _myMeshDS->RemoveElement(elemID); + MESSAGE("RemoveNodes(): element removed: " << elemID) + } + + // It's nodes' turn to die + for (int i = 0 ; i< IDsOfNodes.length(); i++) { + CORBA::Long index = IDsOfNodes[i]; + _myMeshDS->RemoveNode(index); + MESSAGE ( "Node "<< index << " was removed" ) + } + return true; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes) { + int NbNodes = IDsOfNodes.length(); + if ( NbNodes == 2 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + int idTri = _myMeshDS->AddEdge(index1,index2); + } + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x, + CORBA::Double y, + CORBA::Double z) { + MESSAGE( " AddNode " << x << " , " << y << " , " << z ) + int idNode = _myMeshDS->AddNode(x,y,z); + MESSAGE( " idNode " << idNode ) + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes) { + int NbNodes = IDsOfNodes.length(); + if ( NbNodes == 3 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + int idTri = _myMeshDS->AddFace(index1,index2,index3); + } else if ( NbNodes == 4 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + int idTri = _myMeshDS->AddFace(index1,index2,index3,index4); + } + return true; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array& IDsOfNodes) { + int NbNodes = IDsOfNodes.length(); + if ( NbNodes == 4 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + int idTetra = _myMeshDS->AddVolume(index1,index2,index3,index4); + } else if ( NbNodes == 5 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + int idPyramid = _myMeshDS->AddVolume(index1,index2,index3,index4,index5); + } else if ( NbNodes == 6 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + CORBA::Long index6 = IDsOfNodes[5]; + int idPrism = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6); + } else if ( NbNodes == 8 ) { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + CORBA::Long index6 = IDsOfNodes[5]; + CORBA::Long index7 = IDsOfNodes[6]; + CORBA::Long index8 = IDsOfNodes[7]; + int idHexa = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6,index7,index8); + } + return true; +}; diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx new file mode 100644 index 000000000..608677b30 --- /dev/null +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -0,0 +1,44 @@ +// File : SMESH_MeshEditor_i.hxx +// Created : Wed Jun 19 18:43:16 2002 +// Author : Nicolas REJNERI + +// Project : SALOME +// Module : SMESH +// Copyright : Open CASCADE 2002 +// $Header$ + +#ifndef _SMESH_MESHEDITOR_I_HXX_ +#define _SMESH_MESHEDIOTR_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + +#include "SMESHDS_Mesh.hxx" + + +class SMESH_MeshEditor_i: + public POA_SMESH::SMESH_MeshEditor +{ +public: + SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh); + + virtual ~SMESH_MeshEditor_i() {}; + + // --- CORBA + CORBA::Boolean RemoveElements(const SMESH::long_array& IDsOfElements); + CORBA::Boolean RemoveNodes(const SMESH::long_array& IDsOfNodes); + + CORBA::Boolean AddNode(CORBA::Double x, + CORBA::Double y, + CORBA::Double z); + CORBA::Boolean AddEdge(const SMESH::long_array& IDsOfNodes); + CORBA::Boolean AddFace(const SMESH::long_array& IDsOfNodes); + CORBA::Boolean AddVolume(const SMESH::long_array& IDsOfNodes); + +private: + SMESH::SMESH_subMesh_var _myMesh; + Handle (SMESHDS_Mesh) _myMeshDS; +}; + +#endif + diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx new file mode 100644 index 000000000..17cd20fd4 --- /dev/null +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -0,0 +1,636 @@ +using namespace std; +//============================================================================= +// File : SMESH_Mesh_i.cxx +// Created : lun mai 6 13:41:55 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Mesh_i.hxx" +#include "SMESH_subMesh_i.hxx" +#include "SMESH_MEDMesh_i.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +#include "SALOME_NamingService.hxx" +#include "Utils_SINGLETON.hxx" +#include "OpUtil.hxx" + +#include "TCollection_AsciiString.hxx" +// #include "SMESHDS_ListOfAsciiString.hxx" +// #include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" +#include "TColStd_ListOfInteger.hxx" +#include "TColStd_ListOfReal.hxx" +#include "TColStd_ListIteratorOfListOfInteger.hxx" +#include "TColStd_ListIteratorOfListOfReal.hxx" +#include "SMESHDS_Command.hxx" +#include "SMESHDS_CommandType.hxx" +#include "SMESHDS_ListOfCommand.hxx" +#include "SMESHDS_ListIteratorOfListOfCommand.hxx" +#include "Handle_SMESHDS_Command.hxx" + +#include "SMESH_MeshEditor_i.hxx" +#include +#include +//#include + +//**** SMESHDS en champ + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh_i::SMESH_Mesh_i() +{ + MESSAGE("SMESH_Mesh_i: default constructor, not for use"); + ASSERT(0); +}; + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= + +SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i, + GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + int localId) +{ + MESSAGE("SMESH_Mesh_i"); + _gen_i = gen_i; + _id = localId; + _geom = GEOM::GEOM_Gen::_narrow(geomEngine); + _studyId = studyId; +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= + +SMESH_Mesh_i::~SMESH_Mesh_i() +{ + MESSAGE("~SMESH_Mesh_i"); + // **** +}; + + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape, + SMESH::SMESH_Hypothesis_ptr anHyp) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("AddHypothesis"); + // **** proposer liste de subShape (selection multiple) + + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ + SALOME::BAD_PARAM); + + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); + if (CORBA::is_nil(myHyp)) + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \ + SALOME::BAD_PARAM); + bool ret = false; + try + { + TopoDS_Shape myLocSubShape= + _gen_i->_ShapeReader->GetShape(_geom,mySubShape); + int hypId = myHyp->GetId(); + ret = _impl->AddHypothesis(myLocSubShape, hypId); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ + SALOME::BAD_PARAM); + } + return ret; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean +SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape, + SMESH::SMESH_Hypothesis_ptr anHyp) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("RemoveHypothesis"); + // **** proposer liste de subShape (selection multiple) + + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ + SALOME::BAD_PARAM); + + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); + if (CORBA::is_nil(myHyp)) + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \ + SALOME::BAD_PARAM); + + bool ret = false; + try + { + TopoDS_Shape myLocSubShape= + _gen_i->_ShapeReader->GetShape(_geom,mySubShape); + int hypId = myHyp->GetId(); + ret = _impl->RemoveHypothesis(myLocSubShape, hypId); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ + SALOME::BAD_PARAM); + } + return ret; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::ListOfHypothesis* +SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("GetHypothesisList"); + // **** +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Mesh_i::GetElementsOnShape"); + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ + SALOME::BAD_PARAM); + + int subMeshId = 0; + try + { + SMESH_subMesh_i* subMeshServant; + TopoDS_Shape myLocSubShape + = _gen_i->_ShapeReader->GetShape(_geom,mySubShape); + + //Get or Create the SMESH_subMesh object implementation + + ::SMESH_subMesh * mySubMesh + = _impl->GetSubMesh(myLocSubShape); + subMeshId = mySubMesh->GetId(); + + // create a new subMesh object servant if there is none for the shape + + if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end()) + { + ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end()); + subMeshServant = _mapSubMesh_i[subMeshId]; + } + else + { + // create and activate the CORBA servant of Mesh + subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId); + SMESH::SMESH_subMesh_var subMesh + = SMESH::SMESH_subMesh::_narrow(subMeshServant->_this()); + _mapSubMesh[subMeshId] = mySubMesh; + _mapSubMesh_i[subMeshId] = subMeshServant; + _mapSubMeshIor[subMeshId] + = SMESH::SMESH_subMesh::_duplicate(subMesh); + } + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end()); + return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Mesh_i::GetLog"); + + SMESH::log_array_var aLog; + try + { + const SMESHDS_ListOfCommand& logDS =_impl->GetLog(); + aLog = new SMESH::log_array; + int indexLog = 0; + int lg = logDS.Extent(); + SCRUTE(lg); + aLog->length(lg); + SMESHDS_ListIteratorOfListOfCommand its(logDS); + while(its.More()) + { + Handle(SMESHDS_Command) com = its.Value(); + int comType = com->GetType(); + //SCRUTE(comType); + int lgcom = com->GetNumber(); + //SCRUTE(lgcom); + const TColStd_ListOfInteger& intList = com->GetIndexes(); + int inum = intList.Extent(); + //SCRUTE(inum); + TColStd_ListIteratorOfListOfInteger ii(intList); + const TColStd_ListOfReal& coordList = com->GetCoords(); + int rnum = coordList.Extent(); + //SCRUTE(rnum); + TColStd_ListIteratorOfListOfReal ir(coordList); + aLog[indexLog].commandType = comType; + aLog[indexLog].number = lgcom; + aLog[indexLog].coords.length(rnum); + aLog[indexLog].indexes.length(inum); + for (int i=0; iClearLog(); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + return aLog._retn(); +} + +// SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) +// throw (SALOME::SALOME_Exception) +// { +// MESSAGE("SMESH_Mesh_i::GetLog"); + +// SMESH::string_array_var aLog; +// try +// { +// const SMESHDS_ListOfCommand& logDS =_impl->GetLog(); +// aLog = new SMESH::string_array; +// int logSize = 0; +// int indexLog = 0; +// int lg = logDS.Extent(); +// SCRUTE(lg); +// SMESHDS_ListIteratorOfListOfCommand its(logDS); +// while(its.More()) +// { +// Handle(SMESHDS_Command) com = its.Value(); +// int comType = com->GetType(); +// SCRUTE(comType); +// int lgcom = com->GetNumber(); +// SCRUTE(lgcom); +// logSize += lgcom; +// aLog->length(logSize); +// SCRUTE(logSize); +// const TColStd_ListOfInteger& intList = com->GetIndexes(); +// TColStd_ListIteratorOfListOfInteger ii(intList); +// const TColStd_ListOfReal& coordList = com->GetCoords(); +// TColStd_ListIteratorOfListOfReal ir(coordList); +// for (int icom = 1; icom <= lgcom; icom++) +// { +// ostringstream S; +// switch (comType) +// { +// case SMESHDS_AddNode: +// S << "AddNode " << ii.Value(); ii.Next(); +// S << " " << ir.Value(); ir.Next(); +// S << " " << ir.Value(); ir.Next(); +// S << " " << ir.Value(); ir.Next(); +// break; +// case SMESHDS_AddEdge: +// S << "AddEdge " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddTriangle: +// S << "AddFace " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddQuadrangle: +// S << "AddFace " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddTetrahedron: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddPyramid: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddPrism: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddHexahedron: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_RemoveNode: +// S << "RemoveNode " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_RemoveElement: +// S << "RemoveElement " << ii.Value(); ii.Next(); +// break; +// default: +// ASSERT(0); +// break; +// } +// string ch = S.str(); +// SCRUTE(ch); +// aLog[indexLog++] = CORBA::string_dup(ch.c_str()); +// } +// its.Next(); +// } +// if (clearAfterGet) _impl->ClearLog(); +// } +// catch (SALOME_Exception& S_ex) +// { +// THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); +// } +// return aLog._retn(); +// } + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh_i::ClearLog() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Mesh_i::ClearLog"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_Mesh_i::GetId() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Mesh_i::GetId"); + return _id; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_Mesh_i::GetStudyId() + throw (SALOME::SALOME_Exception) +{ + return _studyId; +} +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl) +{ + MESSAGE("SMESH_Mesh_i::SetImpl"); + _impl = impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +::SMESH_Mesh& SMESH_Mesh_i::GetImpl() +{ + MESSAGE("SMESH_Mesh_i::GetImpl()"); + return *_impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine() +{ + MESSAGE("SMESH_Mesh_i::GetGeomEngine"); + return GEOM::GEOM_Gen::_duplicate(_geom); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor) +{ + MESSAGE("SMESH_Mesh_i::SetIor"); + _myIor = SMESH::SMESH_Mesh::_duplicate(myIor); + ASSERT(! CORBA::is_nil(_myIor)); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor() +{ + MESSAGE("SMESH_Mesh_i::GetIor"); + ASSERT(! CORBA::is_nil(_myIor)); + return SMESH::SMESH_Mesh::_duplicate(_myIor); +} +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() +{ + SMESH_MeshEditor_i* aMeshEditor = new SMESH_MeshEditor_i(_impl->GetMeshDS()); + SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this(); + return aMesh._retn(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh_i::ExportMED( const char* file ) + throw (SALOME::SALOME_Exception) +{ + _impl->ExportMED( file ); +} +void SMESH_Mesh_i::ExportDAT( const char* file ) + throw (SALOME::SALOME_Exception) +{ + _impl->ExportDAT( file ); +} +void SMESH_Mesh_i::ExportUNV( const char* file ) + throw (SALOME::SALOME_Exception) +{ + _impl->ExportUNV( file ); +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh() + throw (SALOME::SALOME_Exception) +{ + SMESH_MEDMesh_i* aMedMesh = new SMESH_MEDMesh_i( this ); + SALOME_MED::MESH_var aMesh = aMedMesh->_this(); + return aMesh._retn(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbNodes() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbNodes(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbEdges() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbEdges(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbFaces() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbFaces(); +} +CORBA::Long SMESH_Mesh_i::NbTriangles() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbTriangles(); +} +CORBA::Long SMESH_Mesh_i::NbQuadrangles() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbQuadrangles(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbVolumes() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbVolumes(); +} +CORBA::Long SMESH_Mesh_i::NbTetras() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbTetras(); +} +CORBA::Long SMESH_Mesh_i::NbHexas() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbHexas(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbSubMesh() + throw (SALOME::SALOME_Exception) +{ + return _impl->NbSubMesh(); +} diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx new file mode 100644 index 000000000..2cb3c7118 --- /dev/null +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -0,0 +1,140 @@ +//============================================================================= +// File : SMESH_Mesh_i.hxx +// Created : lun mai 6 13:41:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MESH_I_HXX_ +#define _SMESH_MESH_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_CLIENT_HEADER(GEOM_Gen) +#include CORBA_CLIENT_HEADER(GEOM_Shape) +#include CORBA_CLIENT_HEADER(MED) + +class SMESH_Gen_i; + +#include "SMESH_Mesh.hxx" +#include "SMESH_Gen_i.hxx" +#include "SMESH_subMesh_i.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_topo.hxx" + +#include + +class SMESH_Mesh_i: + public POA_SMESH::SMESH_Mesh +{ +public: + SMESH_Mesh_i(); + SMESH_Mesh_i(SMESH_Gen_i* myGen_i, + GEOM::GEOM_Gen_ptr geomEngine, + CORBA::Long studyId, + int localId); + + virtual ~SMESH_Mesh_i(); + + // --- CORBA + + CORBA::Boolean AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape, + SMESH::SMESH_Hypothesis_ptr anHyp) + throw (SALOME::SALOME_Exception); + + CORBA::Boolean RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape, + SMESH::SMESH_Hypothesis_ptr anHyp) + throw (SALOME::SALOME_Exception); + + SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape) + throw (SALOME::SALOME_Exception); + + SMESH::SMESH_subMesh_ptr GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape) + throw (SALOME::SALOME_Exception); + +// SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet) +// throw (SALOME::SALOME_Exception); + + SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet) + throw (SALOME::SALOME_Exception); + + SMESH::SMESH_MeshEditor_ptr GetMeshEditor(); + + void ClearLog() + throw (SALOME::SALOME_Exception); + + CORBA::Long GetId() + throw (SALOME::SALOME_Exception); + + CORBA::Long GetStudyId() + throw (SALOME::SALOME_Exception); + + // --- C++ interface + + void SetImpl(::SMESH_Mesh* impl); + + ::SMESH_Mesh& GetImpl(); // :: force no namespace here + GEOM::GEOM_Gen_ptr GetGeomEngine(); + void SetIor(SMESH::SMESH_Mesh_ptr myIor); + SMESH::SMESH_Mesh_ptr GetIor(); + + void ExportMED( const char* file ) + throw (SALOME::SALOME_Exception); + void ExportDAT( const char* file ) + throw (SALOME::SALOME_Exception); + void ExportUNV( const char* file ) + throw (SALOME::SALOME_Exception); + + SALOME_MED::MESH_ptr GetMEDMesh() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbNodes() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbEdges() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbFaces() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbTriangles() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbQuadrangles() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbVolumes() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbTetras() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbHexas() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbSubMesh() + throw (SALOME::SALOME_Exception); + + + map _mapSubMesh_i; //NRI + map _mapSubMesh; //NRI + +private: + + ::SMESH_Mesh* _impl; // :: force no namespace here + SMESH_Gen_i* _gen_i; + // CORBA::ORB_ptr _orb; +// SMESH_topo* _topo; // all local TopoDS_Shape of subShapes + int _id; // id given by creator (unique within the creator instance) + GEOM::GEOM_Gen_var _geom; + int _studyId; + // int _localId; // id attributed to all objects created by Mesh_i + map _mapSubMeshIor; + SMESH::SMESH_Mesh_var _myIor; +}; + +#endif + diff --git a/src/SMESH_I/SMESH_NumberOfSegments_i.cxx b/src/SMESH_I/SMESH_NumberOfSegments_i.cxx new file mode 100644 index 000000000..d50a6689a --- /dev/null +++ b/src/SMESH_I/SMESH_NumberOfSegments_i.cxx @@ -0,0 +1,80 @@ +using namespace std; +//============================================================================= +// File : SMESH_NumberOfSegments_i.cxx +// Created : jeu mai 16 13:09:33 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_NumberOfSegments_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * Constructor: + * _name is related to the class name: prefix = SMESH_ ; suffix = _i . + */ +//============================================================================= + +SMESH_NumberOfSegments_i::SMESH_NumberOfSegments_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_NumberOfSegments_i::SMESH_NumberOfSegments_i"); + _impl= new ::SMESH_NumberOfSegments(genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NumberOfSegments_i::~SMESH_NumberOfSegments_i() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void +SMESH_NumberOfSegments_i::SetNumberOfSegments(CORBA::Long segmentsNumber) + throw (SALOME::SALOME_Exception) +{ + ASSERT(_impl); + try + { + _impl->SetNumberOfSegments(segmentsNumber); + } + catch (SALOME_Exception& S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ + SALOME::BAD_PARAM); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_NumberOfSegments_i::GetNumberOfSegments() +{ + ASSERT(_impl); + return _impl->GetNumberOfSegments(); +} + diff --git a/src/SMESH_I/SMESH_NumberOfSegments_i.hxx b/src/SMESH_I/SMESH_NumberOfSegments_i.hxx new file mode 100644 index 000000000..fe3c079f7 --- /dev/null +++ b/src/SMESH_I/SMESH_NumberOfSegments_i.hxx @@ -0,0 +1,39 @@ +//============================================================================= +// File : SMESH_NumberOfSegments_i.hxx +// Created : jeu mai 16 13:09:38 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_ +#define _SMESH_NUMBEROFSEGMENTS_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_Hypothesis_i.hxx" + +#include "SMESH_NumberOfSegments.hxx" + +class SMESH_NumberOfSegments_i: + public POA_SMESH::SMESH_NumberOfSegments, + public SMESH_Hypothesis_i +{ +public: + SMESH_NumberOfSegments_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + virtual ~SMESH_NumberOfSegments_i(); + + void SetNumberOfSegments(CORBA::Long segmentsNumber) + throw (SALOME::SALOME_Exception); + + CORBA::Long GetNumberOfSegments(); + +protected: + ::SMESH_NumberOfSegments* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Quadrangle_2D_i.cxx b/src/SMESH_I/SMESH_Quadrangle_2D_i.cxx new file mode 100644 index 000000000..32e57571d --- /dev/null +++ b/src/SMESH_I/SMESH_Quadrangle_2D_i.cxx @@ -0,0 +1,61 @@ +using namespace std; +//============================================================================= +// File : SMESH_Quadrangle_2D_i.cxx +// Created : jeu mai 16 13:27:25 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Quadrangle_2D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Quadrangle_2D_i::SMESH_Quadrangle_2D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_Quadrangle_2D_i::SMESH_Quadrangle_2D_i"); + _genImpl = genImpl; + ::SMESH_Quadrangle_2D* impl + = new ::SMESH_Quadrangle_2D(_genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + SetImpl(impl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Quadrangle_2D_i::~SMESH_Quadrangle_2D_i() +{ + MESSAGE("SMESH_Quadrangle_2D_i::~SMESH_Quadrangle_2D_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Quadrangle_2D_i::SetImpl(::SMESH_Quadrangle_2D* impl) +{ + MESSAGE("SMESH_Quadrangle_2D_i::SetImpl"); + SMESH_2D_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_Quadrangle_2D_i.hxx b/src/SMESH_I/SMESH_Quadrangle_2D_i.hxx new file mode 100644 index 000000000..2579ebb57 --- /dev/null +++ b/src/SMESH_I/SMESH_Quadrangle_2D_i.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_Quadrangle_2D_i.hxx +// Created : jeu mai 16 13:27:29 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_QUADRANGLE_2D_I_HXX_ +#define _SMESH_QUADRANGLE_2D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_2D_Algo_i.hxx" + +#include "SMESH_Quadrangle_2D.hxx" + +class SMESH_Quadrangle_2D_i: + public POA_SMESH::SMESH_Quadrangle_2D, + public SMESH_2D_Algo_i +{ +public: + SMESH_Quadrangle_2D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + + virtual ~SMESH_Quadrangle_2D_i(); + +protected: + virtual void SetImpl(::SMESH_Quadrangle_2D* impl); + + ::SMESH_Quadrangle_2D* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Regular_1D_i.cxx b/src/SMESH_I/SMESH_Regular_1D_i.cxx new file mode 100644 index 000000000..fa232eb55 --- /dev/null +++ b/src/SMESH_I/SMESH_Regular_1D_i.cxx @@ -0,0 +1,61 @@ +using namespace std; +//============================================================================= +// File : SMESH_Regular_1D_i.cxx +// Created : jeu mai 16 13:25:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Regular_1D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Regular_1D_i::SMESH_Regular_1D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_Regular_1D_i::SMESH_Regular_1D_i"); + _genImpl = genImpl; + ::SMESH_Regular_1D* impl + = new ::SMESH_Regular_1D(_genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + SetImpl(impl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Regular_1D_i::~SMESH_Regular_1D_i() +{ + MESSAGE("SMESH_Regular_1D_i::~SMESH_Regular_1D_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Regular_1D_i::SetImpl(::SMESH_Regular_1D* impl) +{ + MESSAGE("SMESH_Regular_1D_i::SetImpl"); + SMESH_1D_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_Regular_1D_i.hxx b/src/SMESH_I/SMESH_Regular_1D_i.hxx new file mode 100644 index 000000000..c8394ab84 --- /dev/null +++ b/src/SMESH_I/SMESH_Regular_1D_i.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_Regular_1D_i.hxx +// Created : jeu mai 16 13:25:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_REGULAR_1D_I_HXX_ +#define _SMESH_REGULAR_1D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_1D_Algo_i.hxx" + +#include "SMESH_Regular_1D.hxx" + +class SMESH_Regular_1D_i: + public POA_SMESH::SMESH_Regular_1D, + public SMESH_1D_Algo_i +{ +public: + SMESH_Regular_1D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + + virtual ~SMESH_Regular_1D_i(); + +protected: + virtual void SetImpl(::SMESH_Regular_1D* impl); + + ::SMESH_Regular_1D* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx new file mode 100644 index 000000000..b0d94e8c7 --- /dev/null +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -0,0 +1,155 @@ +using namespace std; +//============================================================================= +// File : SMESH_subMesh_i.cxx +// Created : jeu mai 30 10:01:12 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_subMesh_i.hxx" +#include "SMESH_Gen_i.hxx" +#include "SMESH_Mesh_i.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" +#include "OpUtil.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh_i::SMESH_subMesh_i() +{ + MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i default, not for use"); + ASSERT(0); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh_i::SMESH_subMesh_i(SMESH_Gen_i* gen_i, + SMESH_Mesh_i* mesh_i, + int localId) +{ + MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i"); + _gen_i = gen_i; + _mesh_i = mesh_i; + _localId = localId; + // **** +} +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh_i::~SMESH_subMesh_i() +{ + MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_subMesh_i::GetNumberOfElements() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_subMesh_i::GetNumberOfElements"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_subMesh_i::GetNumberOfNodes() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_subMesh_i::GetNumberOfNodes"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::long_array* SMESH_subMesh_i::GetElementsId() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_subMesh_i::GetElementsId"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::long_array* SMESH_subMesh_i::GetNodesId() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_subMesh_i::GetNodesId"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather() + throw (SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_subMesh_i::GetFather"); + SMESH::SMESH_Mesh_var meshIor = _mesh_i->GetIor(); + return SMESH::SMESH_Mesh::_duplicate(meshIor); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Long SMESH_subMesh_i::GetId() +{ + MESSAGE("SMESH_subMesh_i::GetId"); + return _localId; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily() + throw (SALOME::SALOME_Exception) +{ + SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh(); + + SALOME_MED::Family_array_var families = + MEDMesh->getFamilies(SALOME_MED::MED_NODE); + + for ( int i = 0; i < families->length(); i++ ) { + if ( families[i]->getIdentifier() == ( _localId ) ) + return families[i]; + } +} diff --git a/src/SMESH_I/SMESH_subMesh_i.hxx b/src/SMESH_I/SMESH_subMesh_i.hxx new file mode 100644 index 000000000..c67f4829b --- /dev/null +++ b/src/SMESH_I/SMESH_subMesh_i.hxx @@ -0,0 +1,60 @@ +//============================================================================= +// File : SMESH_subMesh_i.hxx +// Created : jeu mai 30 10:01:17 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_SUBMESH_I_HXX_ +#define _SMESH_SUBMESH_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include CORBA_SERVER_HEADER(SMESH_Hypothesis) +#include CORBA_CLIENT_HEADER(GEOM_Gen) +#include CORBA_CLIENT_HEADER(GEOM_Shape) +#include CORBA_CLIENT_HEADER(MED) + +class SMESH_Gen_i; +class SMESH_Mesh_i; + +class SMESH_subMesh_i: + public POA_SMESH::SMESH_subMesh +{ +public: + SMESH_subMesh_i(); + SMESH_subMesh_i(SMESH_Gen_i* gen_i, + SMESH_Mesh_i* mesh_i, + int localId); + ~SMESH_subMesh_i(); + + CORBA::Long GetNumberOfElements() + throw (SALOME::SALOME_Exception); + + CORBA::Long GetNumberOfNodes() + throw (SALOME::SALOME_Exception); + + SMESH::long_array* GetElementsId() + throw (SALOME::SALOME_Exception); + + SMESH::long_array* GetNodesId() + throw (SALOME::SALOME_Exception); + + SMESH::SMESH_Mesh_ptr GetFather() + throw (SALOME::SALOME_Exception); + + CORBA::Long GetId(); + + SALOME_MED::FAMILY_ptr GetFamily() + throw (SALOME::SALOME_Exception); + + SMESH_Mesh_i* _mesh_i; //NRI + +protected: + SMESH_Gen_i* _gen_i; + int _localId; +}; + +#endif diff --git a/src/SMESH_I/SMESH_test.py b/src/SMESH_I/SMESH_test.py new file mode 100644 index 000000000..412905767 --- /dev/null +++ b/src/SMESH_I/SMESH_test.py @@ -0,0 +1,203 @@ +# creer des geometries, en selectionner une + +import SMESH +import smeshpy +import salome +from salome import sg +import math +#import SMESH_BasicHypothesis_idl + +import geompy + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() +from geompy import gg + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +# ---- define a box + +box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) +idb = geompy.addToStudy(box,"box") + +# ---- add first face of box in study + +subShapeList=geompy.SubShapeAll(box,ShapeTypeFace) +face=subShapeList[0] +name = geompy.SubShapeName( face._get_Name(), box._get_Name() ) +print name +idf=geompy.addToStudyInFather(box,face,name) + +# ---- add shell from box in study + +subShellList=geompy.SubShapeAll(box,ShapeTypeShell) +shell = subShellList[0] +name = geompy.SubShapeName( shell._get_Name(), box._get_Name() ) +print name +ids=geompy.addToStudyInFather(box,shell,name) + +# ---- add first edge of face in study + +edgeList = geompy.SubShapeAll(face,ShapeTypeEdge) +edge=edgeList[0]; +name = geompy.SubShapeName( edge._get_Name(), face._get_Name() ) +print name +ide=geompy.addToStudyInFather(face,edge,name) + +# ---- launch SMESH, init a Mesh with the box +gen=smeshpy.smeshpy() +mesh=gen.Init(idb) + +# ---- create Hypothesis + +print "-------------------------- create Hypothesis" +print "-------------------------- LocalLength" +hyp1=gen.CreateHypothesis("LocalLength") +print hyp1.GetName() +print hyp1.GetId() +hypo1 = hyp1._narrow(SMESH.SMESH_LocalLength) +print hypo1.GetLength() +hypo1.SetLength(100) +print hypo1.GetLength() + +print "-------------------------- bidon" +hyp3=gen.CreateHypothesis("bidon") + +print "-------------------------- NumberOfSegments" +hyp3=gen.CreateHypothesis("NumberOfSegments") +hypo3=hyp3._narrow(SMESH.SMESH_NumberOfSegments) +hypo3.SetNumberOfSegments(7) +print hypo3.GetName() +print hypo3.GetNumberOfSegments() +print hypo3.GetId() + +print "-------------------------- MaxElementArea" +hyp4=gen.CreateHypothesis("MaxElementArea") +hypo4=hyp4._narrow(SMESH.SMESH_MaxElementArea) +hypo4.SetMaxElementArea(5000) +print hypo4.GetName() +print hypo4.GetMaxElementArea() +print hypo4.GetId() + +print "-------------------------- Regular_1D" +alg1=gen.CreateHypothesis("Regular_1D") +print alg1.GetName() +print alg1.GetId() +algo1=alg1._narrow(SMESH.SMESH_Algo) +listHyp=algo1.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp + +algo_1=alg1._narrow(SMESH.SMESH_Regular_1D) +print algo_1.GetId() + +print "-------------------------- MEFISTO_2D" +alg2=gen.CreateHypothesis("MEFISTO_2D") +print alg2.GetName() +print alg2.GetId() +algo2=alg2._narrow(SMESH.SMESH_Algo) +listHyp=algo2.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algo_2=alg2._narrow(SMESH.SMESH_MEFISTO_2D) +print algo_2.GetId() + +# ---- add hypothesis to edge + +print "-------------------------- add hypothesis to edge" +edge=salome.IDToObject(ide) +submesh=mesh.GetElementsOnShape(edge) +ret=mesh.AddHypothesis(edge,algo_1) +print ret +ret=mesh.AddHypothesis(edge,hypo1) +print ret + +# ---- compute edge + +##print "-------------------------- compute edge" +##ret=gen.Compute(mesh,ide) +##print ret +##log=mesh.GetLog(1); +##for a in log: +## print a + +# ---- add hypothesis to box + +print "-------------------------- add hypothesis to box" +box=salome.IDToObject(idb) +submesh=mesh.GetElementsOnShape(box) +ret=mesh.AddHypothesis(box,algo_1) +print ret +ret=mesh.AddHypothesis(box,hypo1) +print ret +ret=mesh.AddHypothesis(box,algo_2) +print ret +ret=mesh.AddHypothesis(box,hypo4) +print ret + +# ---- compute face + +print "-------------------------- compute face" +ret=gen.Compute(mesh,idf) +print ret +log=mesh.GetLog(1); +for a in log: + print "-------" + ii = 0 + ir = 0 + comType = a.commandType + if comType == 0: + for i in range(a.number): + ind = a.indexes[ii] + ii = ii+1 + r1 = a.coords[ir] + ir = ir+1 + r2 = a.coords[ir] + ir = ir+1 + r3 = a.coords[ir] + ir = ir+1 + print "AddNode %i - %g %g %g" % (ind, r1, r2, r3) + elif comType == 1: + for i in range(a.number): + ind = a.indexes[ii] + ii = ii+1 + i1 = a.indexes[ii] + ii = ii+1 + i2 = a.indexes[ii] + ii = ii+1 + print "AddEdge %i - %i %i" % (ind, i1, i2) + elif comType == 2: + for i in range(a.number): + ind = a.indexes[ii] + ii = ii+1 + i1 = a.indexes[ii] + ii = ii+1 + i2 = a.indexes[ii] + ii = ii+1 + i3 = a.indexes[ii] + ii = ii+1 + print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) + +# ---- compute box + +##print "-------------------------- compute box" +##ret=gen.Compute(mesh,idb) +##print ret +##log=mesh.GetLog(1); +##print log + +##shell=salome.IDToObject(ids) +##submesh=mesh.GetElementsOnShape(shell) +##ret=mesh.AddHypothesis(shell,algo_1) +##print ret +##ret=mesh.AddHypothesis(shell,hypo1) +##print ret +##ret=gen.Compute(mesh,ids) +##print ret + diff --git a/src/SMESH_I/SMESH_topo.cxx b/src/SMESH_I/SMESH_topo.cxx new file mode 100644 index 000000000..eeda6339d --- /dev/null +++ b/src/SMESH_I/SMESH_topo.cxx @@ -0,0 +1,40 @@ +using namespace std; +//============================================================================= +// File : SMESH_topo.cxx +// Created : lun mai 13 15:17:25 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_topo.hxx" +#include "utilities.h" + +SMESH_topo::SMESH_topo() +{ + MESSAGE("SMESH_topo()"); +} + +SMESH_topo::~SMESH_topo() +{ + MESSAGE("~SMESH_topo()"); +} + +//============================================================================= +/*! + * Static method, gives a unique local id for a given CORBA reference of + * a shape, within the SALOME session (multi studies). + * Internal geom id or stringified CORBA reference could be used here. + * GEOM Id is more efficient (shorter string). + */ +//============================================================================= + +string SMESH_topo::GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape) +{ + string str = aShape->ShapeId(); //geomId + MESSAGE(str); + return str; +} + diff --git a/src/SMESH_I/SMESH_topo.hxx b/src/SMESH_I/SMESH_topo.hxx new file mode 100644 index 000000000..29d5b6848 --- /dev/null +++ b/src/SMESH_I/SMESH_topo.hxx @@ -0,0 +1,61 @@ +//============================================================================= +// File : SMESH_topo.hxx +// Created : lun mai 13 15:17:20 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_TOPO_HXX_ +#define _SMESH_TOPO_HXX_ + +#include +#include CORBA_CLIENT_HEADER(GEOM_Shape) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static const char* const SMESH_shapeTypeNames[9] = { "0=TopAbs_COMPOUND", + "1=TopAbs_COMPSOLID", + "2=TopAbs_SOLID", + "3=TopAbs_SHELL", + "4=TopAbs_FACE", + "5=TopAbs_WIRE", + "6=TopAbs_EDGE", + "7=TopAbs_VERTEX", + "8=TopAbs_SHAPE" }; + +class SMESH_topo +{ +public: + + static string GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape); + + SMESH_topo(); + virtual ~SMESH_topo(); + + map _mapIndShapes[9]; + TopTools_IndexedMapOfShape _myShapes[9]; + +protected: + + +}; + +#endif diff --git a/src/SMESH_I/smeshpy.py b/src/SMESH_I/smeshpy.py new file mode 100644 index 000000000..986ffca7d --- /dev/null +++ b/src/SMESH_I/smeshpy.py @@ -0,0 +1,70 @@ + +import salome +import SMESH + +from SALOME_utilities import * + +#============================================================================= + +class smeshpy: + _geom = None + _smesh = None + _studyId = None + + #-------------------------------------------------------------------------- + + def __init__(self): + try: + self._geom = salome.lcc.FindOrLoadComponent("FactoryServer","Geometry") + self._smesh = salome.lcc.FindOrLoadComponent("FactoryServer","SMESH") + except: + MESSAGE( "exception in smeshpy:__init__" ) + self._studyId = salome.myStudyId + + #-------------------------------------------------------------------------- + + def Init(self, shapeId): + try: + shape = salome.IDToObject(shapeId) + aMesh = self._smesh.Init(self._geom, self._studyId, shape) + return aMesh + except: + MESSAGE( "exception in smeshpy:Init" ) + return None + + #-------------------------------------------------------------------------- + + def CreateHypothesis(self, name): + try: + hyp = self._smesh.CreateHypothesis(name,self._studyId) + return hyp + except: + MESSAGE( "exception in smeshpy:CreateHypothesis" ) + return None + + #-------------------------------------------------------------------------- + + def Compute(self, mesh, shapeId): + try: + shape = salome.IDToObject(shapeId) + ret=self._smesh.Compute(mesh, shape) + return ret + except: + MESSAGE( "exception in smeshpy:Compute" ) + return 0 + +#============================================================================= +## #-------------------------------------------------------------------------- + +##def SmeshInit(shapeId): +## import salome +## import SMESH +## geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +## smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") +## shape = salome.IDToObject(shapeId) +## studyId = salome.myStudyId +## MESSAGE( str(studyId) ) +## aMesh = smesh.Init(geom, studyId, shape) +## return aMesh + +## #-------------------------------------------------------------------------- diff --git a/src/SMESH_I/sstream b/src/SMESH_I/sstream new file mode 100644 index 000000000..323bbed45 --- /dev/null +++ b/src/SMESH_I/sstream @@ -0,0 +1,225 @@ +/* This is part of libio/iostream, providing -*- C++ -*- input/output. +Copyright (C) 2000 Free Software Foundation + +This file is part of the GNU IO Library. This library is free +software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ + +#ifndef __SSTREAM__ +#define __SSTREAM__ + +#include +#include +#include + +namespace std +{ + class stringbuf : public streambuf + { + public: + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + explicit stringbuf(int which=ios::in|ios::out) : + streambuf(which), buf(), mode(static_cast(which)), + rpos(0), bufsize(1) + { } + + explicit stringbuf(const std::string &s, int which=ios::in|ios::out) : + streambuf(which), buf(s), mode(static_cast(which)), + bufsize(1) + { + if(mode & ios::in) + { + setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize); + } + if(mode & ios::out) + { + setp(&defbuf, &defbuf + bufsize); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + std::string str() const + { + const_cast(this)->sync(); // Sigh, really ugly hack + return buf; + }; + + void str(const std::string& s) + { + buf = s; + if(mode & ios::in) + { + gbump(egptr() - gptr()); + } + if(mode & ios::out) + { + pbump(pbase() - pptr()); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + protected: + inline virtual int sync(); + inline virtual int overflow(int = EOF); + inline virtual int underflow(); + private: + std::string buf; + ios::open_mode mode; + std::string::size_type rpos; + streamsize bufsize; + char defbuf; + }; + + class stringstreambase : virtual public ios { + protected: + stringbuf __my_sb; + public: + std::string str() const + { + return dynamic_cast(_strbuf)->str(); + } + void str(const std::string& s) + { + clear(); + dynamic_cast(_strbuf)->str(s); + } + + stringbuf* rdbuf() + { + return &__my_sb; + } + protected: + stringstreambase(int which) : + __my_sb(which) + { + init (&__my_sb); + } + + stringstreambase(const std::string& s, int which) : + __my_sb(s, which) + { + init (&__my_sb); + } + }; + + class istringstream : public stringstreambase, public istream { + public: + istringstream(int which=ios::in) : + stringstreambase(which) + { } + + istringstream(const std::string& s, int which=ios::in) : + stringstreambase(s, which) + { } + }; + + class ostringstream : public stringstreambase, public ostream { + public: + ostringstream(int which=ios::out) : + stringstreambase(which) + { } + + ostringstream(const std::string& s, int which=ios::out) : + stringstreambase(s, which) + { } + }; + + class stringstream : public stringstreambase, public iostream { + public: + stringstream(int which=ios::in|ios::out) : + stringstreambase(which) + { } + + stringstream(const std::string &s, int which=ios::in|ios::out) : + stringstreambase(s, which) + { } + }; +} + +inline int std::stringbuf::sync() +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + if(n) + { + buf.replace(rpos, std::string::npos, pbase(), n); + if(buf.size() - rpos != n) + return EOF; + rpos += n; + pbump(-n); + gbump(egptr() - gptr()); + } + return 0; +} + +inline int std::stringbuf::overflow(int ch) +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + + if(n && sync()) + return EOF; + + if(ch != EOF) + { + std::string::size_type oldSize = buf.size(); + + buf.replace(rpos, std::string::npos, ch); + if(buf.size() - oldSize != 1) + return EOF; + ++rpos; + } + return 0; +} + +inline int std::stringbuf::underflow() +{ + sync(); + if((mode & ios::in) == 0) + { + return EOF; + } + if(rpos >= buf.size()) + { + return EOF; + } + + std::string::size_type n = egptr() - eback(); + std::string::size_type s; + + s = buf.copy(eback(), n, rpos); + pbump(pbase() - pptr()); + gbump(eback() - gptr()); + int res = (0377 & buf[rpos]); + rpos += s; + return res; +} + +#endif /* not __STRSTREAM__ */ diff --git a/src/SMESH_SWIG/Makefile.in b/src/SMESH_SWIG/Makefile.in new file mode 100644 index 000000000..56a008c03 --- /dev/null +++ b/src/SMESH_SWIG/Makefile.in @@ -0,0 +1,43 @@ +# File : Makefile.in +# Created : Tue Mar 26 15:04:48 2002 +# Author : Nicolas REJNERI, Paul RASCLE +# Project : SALOME +# Module : GEOM +# Copyright : Open CASCADE, EDF 2002 +# $Header$ + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets + +LIB = libSMESH_Swigcmodule.la +LIB_SRC = + +SWIG_DEF = libSMESH_Swig.i +EXPORT_PYSCRIPTS = libSMESH_Swig.py \ + SMESH_test0.py SMESH_test1.py SMESH_test2.py SMESH_test3.py SMESH_mechanic.py SMESH_fixation.py batchmode_smesh.py + +LIB_CLIENT_IDL = SALOMEDS.idl \ + SALOME_Exception.idl \ + GEOM_Gen.idl \ + GEOM_Shape.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Hypothesis.idl \ + SMESH_BasicHypothesis.idl \ + SALOME_ModuleCatalog.idl \ + SALOME_Component.idl \ + MED.idl + +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H +LIBS+= $(PYTHON_LIBS) +LDFLAGS+= -lSMESHGUI + +@CONCLUDE@ diff --git a/src/SMESH_SWIG/SMESH_fixation.py b/src/SMESH_SWIG/SMESH_fixation.py new file mode 100644 index 000000000..2864e93b2 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_fixation.py @@ -0,0 +1,464 @@ +#============================================================================== +# File : SMESH_fix_volute.py +# Created : mer sep 4 09:58:49 CEST 2002 +# Author : Paul RASCLE, EDF +# Project : SALOME +# Copyright : EDF 2002 +# $Header$ +#============================================================================== + +# +# les numeros d'edge dans les explode sont parfois decales de 1 entre +# le script et le gui +# piece1 --> piece : memes numeros +# ellipse : il faut decrementer de 1 dans le script +# + +import salome +from salome import sg + +import geompy + +##import SMESH +##import smeshpy +##import SMESH_BasicHypothesis_idl + +import math + +# ----------------------------------------------------------------------------- + +def MakeFace(lstEdges) : + """ + Creates a face from 4 edges + """ + lstWire = [] + for edge in lstEdges : + lstWire.append(edge._get_Name()) + wire = geompy.MakeWire(lstWire) + face = geompy.MakeFace(wire, 1) + return face + +def MakeShell(lstFaces) : + """ + Creates a shell from 6 faces + """ + lstShell = [] + for face in lstFaces : + lstShell.append(face._get_Name()) + shell = geompy.MakeSewing(lstShell, 0.00001) + return shell + +def MakeCompound(lstShells) : + """ + Creates a compound from several shells + """ + lstCompound = [] + for shell in lstShells : + lstCompound.append(shell._get_Name()) + compound = geompy.MakeCompound(lstCompound) + return compound + +# ----------------------------------------------------------------------------- + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +# ---- dimensions + +##longueurPlq = 0.686 +##largeurPlq = 0.573 +##epaisseurPlq = 0.150 + +##hauteurFlanc = 0.380 +##epaisseurFlanc = 0.112 +##rayonConge = 0.150 - epaisseurFlanc + +##epaisseurFond = 0.162 +##rayonTrou = 0.075 +##posAxeTrou = hauteurFlanc -(0.180 + rayonTrou) +##marge = 0.01 +##tol3d = 1.e-5 + +longueurPlq = 686 +largeurPlq = 573 +epaisseurPlq = 150 + +hauteurFlanc = 380 +epaisseurFlanc = 112 +rayonConge = 150 - epaisseurFlanc + +epaisseurFond = 162 +rayonTrou = 75 +posAxeTrou = hauteurFlanc -(180 + rayonTrou) +marge = 10 +tol3d = 1.e-3 + +# ---- points, directions de base + +p0 = geom.MakePointStruct(0., 0., 0.) +px = geom.MakePointStruct(100., 0., 0.) +vx = geom.MakeDirection(px) +py = geom.MakePointStruct(0., 100., 0.) +vy = geom.MakeDirection(py) +pz = geom.MakePointStruct(0., 0., 100.) +vz = geom.MakeDirection(pz) + +# ---- volumes de controle + +volglob = geom.MakeBox( 0., 0., 0., + longueurPlq, + largeurPlq, + hauteurFlanc + epaisseurPlq +marge) +idvolglob = geompy.addToStudy(volglob, "volglob") +volhaut = geom.MakeBox(-marge, + 0.5*(largeurPlq - epaisseurFond), + hauteurFlanc + epaisseurPlq, + longueurPlq+marge, + largeurPlq+marge, + hauteurFlanc + epaisseurPlq +2*marge) +idvolhaut = geompy.addToStudy(volhaut, "volhaut") + +# ---- base + +#plaque = geom.MakeBox( 0., 0., 0., longueurPlq, largeurPlq, epaisseurPlq ) +plaque = geom.MakeBox( -marge, -marge/2, 0., + longueurPlq +2*marge, largeurPlq, epaisseurPlq ) +# ---- fond + +fond = geom.MakeBox( rayonConge, + largeurPlq - epaisseurFond, + epaisseurPlq, + longueurPlq - rayonConge, + largeurPlq, + epaisseurPlq + hauteurFlanc +marge/2) + +# ---- trou du fond + +pAxe1 = geom.MakePointStruct( 0.5*longueurPlq, + 0., + epaisseurPlq + posAxeTrou) +cylFond = geom.MakeCylinder(pAxe1, vy, rayonTrou, 1.1*largeurPlq) +fondTroue = geom.MakeBoolean(fond, cylFond, 2) + +piece = geom.MakeBoolean(plaque, fondTroue, 3) +idPiece = geompy.addToStudy(piece, "piece") + +# ---- cotes + +cote1 = geom.MakeBox(rayonConge, + -marge/2, + epaisseurPlq, + epaisseurFlanc + rayonConge, + largeurPlq - epaisseurFond, + hauteurFlanc + epaisseurPlq +marge/2) +piece = geom.MakeBoolean(piece, cote1, 3) + +cote2 = geom.MakeBox(longueurPlq -epaisseurFlanc -rayonConge, + -marge/2, + epaisseurPlq, + longueurPlq -rayonConge, + largeurPlq - epaisseurFond, + hauteurFlanc + epaisseurPlq +marge/2) +piece = geom.MakeBoolean(piece, cote2, 3) +idPiece = geompy.addToStudy(piece, "piece1") + +# ---- ellipse du flanc + +he = hauteurFlanc -2*rayonConge +re = 0.5*(largeurPlq - epaisseurFond) - rayonConge +sine = re/he +cose = math.sqrt(1.-sine*sine) +pe = geom.MakePointStruct(sine, 0., cose) +ve = geom.MakeDirection(pe) +cyl0 = geom.MakeCylinder(p0, ve, re, 2*he) +axecy = geom.MakeAxisStruct(0., 0., 0.,sine, 0., cose) +cyl1 = geom.MakeRotation(cyl0, axecy, 0.5) +cyle = geom.MakeTranslation(cyl1, + -marge*sine, 0., -marge*cose) +boxe = geom.MakeBox(0., 0., 0., 3*he, -2*re, 3*he) +#idcyle = geompy.addToStudy(cyle, "cyle") +#idboxe = geompy.addToStudy(boxe, "boxe") +cylcoup = geom.MakeBoolean(cyle, boxe, 2) +idcylcoup = geompy.addToStudy(cylcoup, "cylcoup") +aretes = [] +aretes = geompy.SubShapeAll(cylcoup, ShapeTypeEdge) +# OCC3.1 : aretes[3], OCC4.0 aretes[5] +shape = geom.MakeCopy(aretes[5]) +aShape = geom.MakeTranslation(shape, + 0., rayonConge +re, epaisseurPlq +2*rayonConge) + +# ---- segments face objet decoupe des flancs + +pf1 = geom.MakePointStruct(0., + -marge, + hauteurFlanc + epaisseurPlq +marge) +pf2 = geom.MakePointStruct(0., + 0.5*(largeurPlq - epaisseurFond), + hauteurFlanc + epaisseurPlq +marge) +pf3 = geom.MakePointStruct(0., + 0.5*(largeurPlq - epaisseurFond), + hauteurFlanc + epaisseurPlq) +pf4 = geom.MakePointStruct(0., + rayonConge, + epaisseurPlq +2*rayonConge) +pf5 = geom.MakePointStruct(0., + rayonConge, + epaisseurPlq) +pf6 = geom.MakePointStruct(0., + -marge, + epaisseurPlq) + +vf1 = geom.MakeEdge(pf1,pf2) +vf2 = geom.MakeEdge(pf2,pf3) +vf4 = geom.MakeEdge(pf4,pf5) +vf5 = geom.MakeEdge(pf5,pf6) +vf6 = geom.MakeEdge(pf6,pf1) + +id1 = geompy.addToStudy(vf1,"vf1") +id2 = geompy.addToStudy(vf2,"vf2") +ids = geompy.addToStudy(aShape,"aShape") +id4 = geompy.addToStudy(vf4,"vf4") +id5 = geompy.addToStudy(vf5,"vf5") +id6 = geompy.addToStudy(vf6,"vf6") + +faceDec = MakeFace([vf1,vf2,aShape,vf4,vf5,vf6]) +idf = geompy.addToStudy(faceDec,"faceDec") + +# forme de decoupe par extrusion + +pfe = geom.MakePointStruct(longueurPlq+4*marge, 0., 0.) +decoupe = geom.MakePrism(faceDec, p0, pfe) +decoupe = geom.MakeTranslation(decoupe, -2*marge, 0., 0.) +idec = geompy.addToStudy(decoupe, "decoupe") + +# decoupe piece1 par decoupe + +piece2 = geom.MakeBoolean(piece, decoupe, 2) +idpiece = geompy.addToStudy(piece2, "piece2") + +# conges +conges = [] +conges = geompy.SubShapeAllSorted(piece2, ShapeTypeEdge) + + +# boucle pour trouver les bons indices +#ind = 0 +#for ff in conges: +# print ind, ff._get_Index() +# name = "edge%d"%(ind) +# geompy.addToStudy(ff, name) +# ind = ind + 1 + + +index1 = conges[7]._get_Index() +index2 = conges[11]._get_Index() +index3 = conges[36]._get_Index() +index4 = conges[43]._get_Index() + +#piece3 = geompy.MakeFillet (piece2, rayonConge, ShapeTypeEdge, [3,4,8,9]) +piece3 = geompy.MakeFillet (piece2, rayonConge, ShapeTypeEdge, [index1[0],index2[0],index3[0],index4[0]]) + +idPiece = geompy.addToStudy(piece3, "piece3") + +# partie incluse dans le volume de controle (devient non valide) + +piece4 = geom.MakeBoolean(piece3, volglob, 1) +idPiece = geompy.addToStudy(piece4, "piece4") + +# enlever volume haut + +piece = geom.MakeBoolean(piece4, volhaut, 2) +idpiece = geompy.addToStudy(piece, "piece") + +# ----------------------------------------------------------------------------- +# ---- decoupage de la piece en volumes a 6 faces de 4 cotes +# ----------------------------------------------------------------------------- + +# ---- cotes x + +x0 = 0. +x0h = rayonConge +x1 = rayonConge + epaisseurFlanc +xc = longueurPlq/2 +x2 = longueurPlq - rayonConge - epaisseurFlanc +x3h = longueurPlq - rayonConge +x3 = longueurPlq + +# ---- cotes y + +y0 = 0. +y0h = rayonConge +y1 = largeurPlq - epaisseurFond +y1m = y1 -marge +y2 = largeurPlq +y2p = largeurPlq + marge + +# ---- cotes z + +z0 = 0. +z1m = epaisseurPlq -marge +z1 = epaisseurPlq +z2 = epaisseurPlq + rayonConge +z3 = epaisseurPlq + 2*rayonConge +z4 = epaisseurPlq + hauteurFlanc +z4p = epaisseurPlq + hauteurFlanc + marge + +zc = epaisseurPlq + posAxeTrou +zc2 = epaisseurPlq + (posAxeTrou -rayonTrou)/3 +zc3 = epaisseurPlq + 2*(posAxeTrou -rayonTrou)/3 + +# ---- decoupe du fond + +p11 = geom.MakePointStruct(x1, y1m, z1) +p12 = geom.MakePointStruct(x1, y1m, z2) +p13 = geom.MakePointStruct(x1, y1m, z3) +p14 = geom.MakePointStruct(x1, y1m, z4) +pc1 = geom.MakePointStruct(xc, y1m, z1) +pc2 = geom.MakePointStruct(xc, y1m, zc2) +pc3 = geom.MakePointStruct(xc, y1m, zc3) +pcc = geom.MakePointStruct(xc, y1m, zc) +pc4 = geom.MakePointStruct(xc, y1m, z4) +p21 = geom.MakePointStruct(x2, y1m, z1) +p22 = geom.MakePointStruct(x2, y1m, z2) +p23 = geom.MakePointStruct(x2, y1m, z3) +p24 = geom.MakePointStruct(x2, y1m, z4) +pcf = geom.MakePointStruct(xc, y2p, zc) + +arc2 = geom.MakeArc(p12,pc2,p22) +arc3 = geom.MakeArc(p13,pc3,p23) + +segz1 = geom.MakeVector(p11,p21) +#segz4 = geom.MakeVector(p14,p24) +segz41 = geom.MakeVector(p14,pc4) +segz42 = geom.MakeVector(pc4,p24) +segx11 = geom.MakeVector(p11,p12) +segx12 = geom.MakeVector(p12,p13) +segx13 = geom.MakeVector(p13,p14) +segxc2 = geom.MakeVector(pc1,pc2) +segxc3 = geom.MakeVector(pc2,pc3) +segxc4 = geom.MakeVector(pcc,pc4) +segx21 = geom.MakeVector(p21,p22) +segx22 = geom.MakeVector(p22,p23) +segx23 = geom.MakeVector(p23,p24) +segx1c1 = geom.MakeVector(p13,pcc) +segx1c2 = geom.MakeVector(p14,pcc) +segx2c1 = geom.MakeVector(p23,pcc) +segx2c2 = geom.MakeVector(p24,pcc) + +facef = [] +facef.append(MakeFace([segx13,segx1c2,segx1c1])) +facef.append(MakeFace([segx23,segx2c2,segx2c1])) +facef.append(MakeFace([segx2c2,segxc4,segz42])) +facef.append(MakeFace([segx1c2,segz41,segxc4])) +facef.append(MakeFace([segx1c1,arc3,segx2c1])) +facef.append(MakeFace([segx12,arc2,segx22,arc3])) +facef.append(MakeFace([segx11,segz1,segx21,arc2])) + +decf =[] +for face in facef: + decf.append(geom.MakePrism(face,pcc,pcf)) + +axeCyl = geom.MakeAxisStruct( 0.5*longueurPlq, + 0., + epaisseurPlq + posAxeTrou, + 0., + largeurPlq, + 0.) +cylFond2 = geom.MakeRotation(geom.MakeCopy(cylFond),axeCyl,math.pi) +idcylfond2 = geompy.addToStudy(cylFond2,"cylFond2") + +fondec =[] +for id in (0,1,2,3): + fondec.append(geom.MakeBoolean(decf[id],cylFond2,2)) +fondec.append(geom.MakeBoolean(decf[4],cylFond,2)) +for id in (5,6): + fondec.append(decf[id]) + +iff=0 +for ff in fondec: + idfo = geompy.addToStudy(ff, "ff%d"%(iff)) + iff = iff +1 + +# ----- autres blocs de decoupe + +bcong1=geom.MakeBox(x0,y0,z1, x1,y1,z2) +bcong2=geom.MakeBox(x0,y1,z1, x1,y2,z2) +bcong3=geom.MakeBox(x2,y0,z1, x3,y1,z2) +bcong4=geom.MakeBox(x2,y1,z1, x3,y2,z2) + +pcylx0 = geom.MakePointStruct(0., -marge, z2) +cylcongx0 = geom.MakeCylinder(pcylx0, vy, rayonConge, largeurPlq +2*marge) +idcylcongx0 = geompy.addToStudy(cylcongx0,"cylcongx0") +pcylx3 = geom.MakePointStruct(longueurPlq, -marge, z2) +cylcongx3 = geom.MakeCylinder(pcylx3, vy, rayonConge, largeurPlq +2*marge) +idcylcongx3 = geompy.addToStudy(cylcongx3,"cylcongx3") +pcyly0 = geom.MakePointStruct(-marge, 0., z2) +cylcongy0 = geom.MakeCylinder(pcyly0, vx, rayonConge, longueurPlq +2*marge) +idcylcongy0 = geompy.addToStudy(cylcongy0,"cylcongy0") + +bcong1=geom.MakeBoolean(bcong1,cylcongx0,2) +bcong2=geom.MakeBoolean(bcong2,cylcongx0,2) +bcong1=geom.MakeBoolean(bcong1,cylcongy0,2) +bcong3=geom.MakeBoolean(bcong3,cylcongx3,2) +bcong4=geom.MakeBoolean(bcong4,cylcongx3,2) +bcong3=geom.MakeBoolean(bcong3,cylcongy0,2) + +pf1 = geom.MakePointStruct(0., y0h, z3) +pf2 = geom.MakePointStruct(0., y1, z3) +pf3 = geom.MakePointStruct(0., y1, z4) +pf4 = geom.MakePointStruct(0.,0.5*(largeurPlq - epaisseurFond) , z4) +vf1 = geom.MakeEdge(pf1,pf2) +vf2 = geom.MakeEdge(pf2,pf3) +vf3 = geom.MakeEdge(pf3,pf4) +faceFlanc = MakeFace([vf1,vf2,vf3,aShape]) +idfaceFlanc = geompy.addToStudy(faceFlanc,"faceFlanc") +pfe = geom.MakePointStruct(epaisseurFlanc, 0., 0.) +flanc1 = geom.MakePrism(faceFlanc, p0, pfe) +flanc2 = geom.MakeCopy(flanc1) +flanc1 = geom.MakeTranslation(flanc1, + rayonConge,0.,0.) +flanc2 = geom.MakeTranslation(flanc2, + longueurPlq-rayonConge-epaisseurFlanc,0.,0.) + +# ---- constitution et decoupe des blocs +boxfond2 = geom.MakeBox(x0, y1, z0, x3, y2, z4p) +idboxfond2 = geompy.addToStudy(boxfond2,"boxfond2") + +blocs = [] +for dec in fondec: + blocs.append(geom.MakeBoolean(boxfond2, dec, 1)) +blocs.append(geom.MakeBox(x0,y1,z0, x1,y2,z1)) +blocs.append(geom.MakeBox(x1,y1,z0, x2,y2,z1)) +blocs.append(geom.MakeBox(x2,y1,z0, x3,y2,z1)) +blocs.append(geom.MakeBox(x0,y0,z0, x1,y1,z1)) +blocs.append(geom.MakeBox(x1,y0,z0, x2,y1,z1)) +blocs.append(geom.MakeBox(x2,y0,z0, x3,y1,z1)) +blocs.append(bcong2) +blocs.append(bcong4) +blocs.append(bcong1) +blocs.append(bcong3) +blocs.append(geom.MakeBox(x0h,y1, z2, x1, y2, z3)) +blocs.append(geom.MakeBox(x2, y1, z2, x3h,y2, z3)) +blocs.append(geom.MakeBox(x0h,y0h,z2, x1, y1, z3)) +blocs.append(geom.MakeBox(x2, y0h,z2, x3h,y1, z3)) +blocs.append(geom.MakeBox(x0h,y1, z3, x1, y2, z4)) +blocs.append(geom.MakeBox(x2, y1, z3, x3h,y2, z4)) +blocs.append(flanc1) +blocs.append(flanc2) + +compbloc = MakeCompound(blocs) +idcomp = geompy.addToStudy(compbloc,"compbloc") + +# ---- eliminer les faces en double, solid-->shell + +compshell = geom.MakeGlueFaces(compbloc,tol3d) +idcomp = geompy.addToStudy(compshell,"compshell") + diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py new file mode 100644 index 000000000..c7ed695c7 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -0,0 +1,308 @@ +#============================================================================== +# File : SMESH_withHole.py +# Created : 26 august 2002 +# Author : Lucien PIGNOLONI +# Project : SALOME +# Copyright : Open CASCADE, 2002 +# $Header$ +#============================================================================== + +import SMESH +import smeshpy +import salome +from salome import sg +import math +#import SMESH_BasicHypothesis_idl + +import geompy + + + +# ---------------------------- GEOM -------------------------------------- +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() +#from geompy import gg + +smeshgui = salome.ImportComponentGUI("SMESH") +smeshgui.Init(salome.myStudyId); + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + + +# ---- define contigous arcs and segment to define a closed wire + +p1 = geom.MakePointStruct( 100.0, 0.0, 0.0 ) +p2 = geom.MakePointStruct( 50.0, 50.0, 0.0 ) +p3 = geom.MakePointStruct( 100.0, 100.0, 0.0 ) +arc1 = geom.MakeArc( p1, p2, p3 ) + +p4 = geom.MakePointStruct( 170.0, 100.0, 0.0 ) +seg1 = geom.MakeVector( p3, p4 ) + +p5 = geom.MakePointStruct( 200.0, 70.0, 0.0 ) +p6 = geom.MakePointStruct( 170.0, 40.0, 0.0 ) +arc2 = geom.MakeArc( p4, p5, p6 ) + +p7 = geom.MakePointStruct( 120.0, 30.0, 0.0 ) +arc3 = geom.MakeArc( p6, p7, p1 ) + + +# ---- define a closed wire with arcs and segment + +List1 = [] +List1.append( arc1 ) +List1.append( seg1 ) +List1.append( arc2 ) +List1.append( arc3 ) + +ListIOR1 = [] +for S in List1 : + ListIOR1.append( S._get_Name() ) +wire1 = geom.MakeWire( ListIOR1 ) + +Id_wire1 = geompy.addToStudy( wire1, "wire1") + + +# ---- define a planar face with wire +WantPlanarFace = 1 #True +face1 = geom.MakeFace( wire1, WantPlanarFace ) +Id_face1 = geompy.addToStudy( face1, "face1") + + +# ---- create a shape by extrusion +pO = geom.MakePointStruct( 0.0, 0.0, 0.0 ) +pz = geom.MakePointStruct( 0.0, 0.0, 100.0 ) + +prism1 = geom.MakePrism( face1, pO, pz ) +Id_prism1 = geompy.addToStudy( prism1, "prism1") + + + +# ---- create two cylinders + +pc1 = geom.MakePointStruct( 90.0, 50.0, -40.0 ) +pc2 = geom.MakePointStruct( 170.0, 70.0, -40.0 ) +vz = geom.MakeDirection( pz ) +radius = 20.0 +height = 180.0 +cyl1 = geom.MakeCylinder( pc1, vz, radius, height ) +cyl2 = geom.MakeCylinder( pc2, vz, radius, height ) + +Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" ) +Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" ) + + +# ---- cut with cyl1 +shape = geom.MakeBoolean( prism1, cyl1, 2 ) + +# ---- fuse with cyl2 +shape1 = geom.MakeBoolean( shape, cyl2, 3 ) + +Id_shape1 = geompy.addToStudy( shape1, "shape1") + + +# ---- add a face sub shape in study to be meshed different +IdSubFaceList = [] +IdSubFaceList.append(10) +sub_face = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceList ) +name = geompy.SubShapeName( sub_face._get_Name(), shape1._get_Name() ) + +Id_SubFace = geompy.addToStudyInFather( shape1, sub_face, name ) + + +# ---- add a face sub shape in study to be meshed different +IdSubFaceL = [] +IdSubFaceL.append(7) +sub_face2 = geompy.SubShapeSorted( shape1, ShapeTypeFace, IdSubFaceL ) +name = geompy.SubShapeName( sub_face2._get_Name(), shape1._get_Name() ) + +Id_SubFace2 = geompy.addToStudyInFather( shape1, sub_face2, name ) + + + + +# ---------------------------- SMESH -------------------------------------- + +# ---- launch SMESH, init a Mesh with shape 'shape1' +gen = smeshpy.smeshpy() +mesh = gen.Init( Id_shape1 ) + +idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) ) +smeshgui.SetName( idmesh, "Mesh_meca" ); +smeshgui.SetShape( Id_shape1, idmesh ); + + +# ------------------------------ Length Hypothesis + +print "-------------------------- create Hypothesis" +print "-------------------------- LocalLength" +hyp1 = gen.CreateHypothesis( "LocalLength" ) +hypLen1 = hyp1._narrow( SMESH.SMESH_LocalLength ) +hypLen1.SetLength( 100.0 ) +print hypLen1.GetName() +print hypLen1.GetId() +print hypLen1.GetLength() + +idlength = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLen1) ); +smeshgui.SetName(idlength, "Local_Length_100"); + + +print "-------------------------- NumberOfSegments" + +hyp2 = gen.CreateHypothesis( "NumberOfSegments" ) +hypNbSeg1 = hyp2._narrow( SMESH.SMESH_NumberOfSegments ) +hypNbSeg1.SetNumberOfSegments( 10 ) +print hypNbSeg1.GetName() +print hypNbSeg1.GetId() +print hypNbSeg1.GetNumberOfSegments() + +idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg1) ); +smeshgui.SetName(idseg, "NumberOfSegments_12"); + + +print "-------------------------- MaxElementArea" + +hyp3 = gen.CreateHypothesis( "MaxElementArea" ) +hypArea1 = hyp3._narrow( SMESH.SMESH_MaxElementArea ) +hypArea1.SetMaxElementArea( 25 ) +print hypArea1.GetName() +print hypArea1.GetId() +print hypArea1.GetMaxElementArea() + +idarea1 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea1) ); +smeshgui.SetName(idarea1, "MaxElementArea_20"); + + + +print "-------------------------- MaxElementArea" + +hyp4 = gen.CreateHypothesis( "MaxElementArea" ) +hypArea2 = hyp4._narrow( SMESH.SMESH_MaxElementArea ) +hypArea2.SetMaxElementArea( 35 ) +print hypArea2. GetName() +print hypArea2.GetId() +print hypArea2.GetMaxElementArea() + +idarea2 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea2) ); +smeshgui.SetName(idarea2, "MaxElementArea_30"); + + +print "-------------------------- Regular_1D" + +alg1 = gen.CreateHypothesis( "Regular_1D" ) +algo1 = alg1._narrow( SMESH.SMESH_Algo ) +listHyp =algo1.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algoReg1d = alg1._narrow( SMESH.SMESH_Regular_1D ) +print algoReg1d.GetName() +print algoReg1d.GetId() + +idreg1d = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoReg1d) ); +smeshgui.SetName( idreg1d, "Regular_1D" ); + + + +print "-------------------------- MEFISTO_2D" + +alg2 = gen.CreateHypothesis( "MEFISTO_2D" ) +algo2 = alg2._narrow( SMESH.SMESH_Algo ) +listHyp = algo2.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algoMef = alg2._narrow( SMESH.SMESH_MEFISTO_2D ) +print algoMef.GetName() +print algoMef.GetId() + +idmef = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoMef) ); +smeshgui.SetName( idmef, "MEFISTO_2D" ); + + + +print "-------------------------- SMESH_Quadrangle_2D" + +alg3 = gen.CreateHypothesis( "Quadrangle_2D" ) +algo3 = alg3._narrow( SMESH.SMESH_2D_Algo ) +listHyp = algo3.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algoQad2 = alg3._narrow( SMESH.SMESH_Quadrangle_2D ) +print algoQad2.GetName() +print algoQad2.GetId() + +idqad2 = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoQad2) ); +smeshgui.SetName( idqad2, "SMESH_Quadrangle_2D" ); + + + +print "-------------------------- add hypothesis to main shape1" + +shape_mesh = salome.IDToObject( Id_shape1 ) +submesh = mesh.GetElementsOnShape( shape_mesh ) + +ret = mesh.AddHypothesis( shape_mesh, algoReg1d ) # Regular 1D/wire discretisation +print ret +ret = mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D +print ret +ret = mesh.AddHypothesis( shape_mesh, hypNbSeg1 ) # nb segments +print ret +ret = mesh.AddHypothesis( shape_mesh, hypArea1 ) # max area +print ret + +smeshgui.SetAlgorithms( idmesh, idreg1d ); # Regular 1D/wire discretisation +smeshgui.SetAlgorithms( idmesh, idmef ); # MEFISTO 2D +smeshgui.SetHypothesis( idmesh, idseg ); # nb segments +smeshgui.SetHypothesis( idmesh, idarea1 ); # max area + + + +print "-------------------------- add hypothesis and algorith to sub face" + +sub_face = salome.IDToObject( Id_SubFace ) +submesh = mesh.GetElementsOnShape( sub_face ) + +ret = mesh.AddHypothesis( sub_face, algoQad2 ) # Quadrangle 2D +print ret +ret = mesh.AddHypothesis( sub_face, hypArea2 ) # max area +print ret + +idsm2 = smeshgui.AddSubMeshOnShape( idmesh, + Id_SubFace, + salome.orb.object_to_string(submesh), + ShapeTypeFace ) + +smeshgui.SetName(idsm2, "SubMeshFace") +smeshgui.SetAlgorithms( idsm2, idqad2 ); # Quadrangle 2D +smeshgui.SetHypothesis( idsm2, idarea2 ); # max area + + + +print "-------------------------- add hypothesis and algorith to sub face" + +sub_face2 = salome.IDToObject( Id_SubFace2 ) +submesh = mesh.GetElementsOnShape( sub_face2 ) + +ret = mesh.AddHypothesis( sub_face2, algoQad2 ) # Quadrangle 2D +print ret +ret = mesh.AddHypothesis( sub_face2, hypArea2 ) # max area +print ret + +idsm3 = smeshgui.AddSubMeshOnShape( idmesh, + Id_SubFace2, + salome.orb.object_to_string(submesh), + ShapeTypeFace ) + +smeshgui.SetName(idsm3, "SubMeshFace2") +smeshgui.SetAlgorithms( idsm3, idqad2 ); # Quadrangle 2D +smeshgui.SetHypothesis( idsm3, idarea2 ); # max area + + + + +sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_test0.py b/src/SMESH_SWIG/SMESH_test0.py new file mode 100644 index 000000000..efa887ea2 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_test0.py @@ -0,0 +1,54 @@ +import SMESH +import smeshpy +import salome +from salome import sg +import math +#import SMESH_BasicHypothesis_idl + +import geompy + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() +from geompy import gg + +smeshgui = salome.ImportComponentGUI("SMESH") +smeshgui.Init(salome.myStudyId); + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +# ---- define a box + +box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) +idbox = geompy.addToStudy(box,"box") + +# ---- add first face of box in study + +subShapeList=geompy.SubShapeAll(box,ShapeTypeFace) +face=subShapeList[0] +name = geompy.SubShapeName( face._get_Name(), box._get_Name() ) +print name +idface=geompy.addToStudyInFather(box,face,name) + +# ---- add shell from box in study + +subShellList=geompy.SubShapeAll(box,ShapeTypeShell) +shell = subShellList[0] +name = geompy.SubShapeName( shell._get_Name(), box._get_Name() ) +print name +idshell=geompy.addToStudyInFather(box,shell,name) + +# ---- add first edge of face in study + +edgeList = geompy.SubShapeAll(face,ShapeTypeEdge) +edge=edgeList[0]; +name = geompy.SubShapeName( edge._get_Name(), face._get_Name() ) +print name +idedge=geompy.addToStudyInFather(face,edge,name) + +sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py new file mode 100644 index 000000000..d36f7bec4 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_test1.py @@ -0,0 +1,185 @@ +import SMESH +import smeshpy +import salome +from salome import sg +import math +#import SMESH_BasicHypothesis_idl + +import geompy + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() +from geompy import gg + +smeshgui = salome.ImportComponentGUI("SMESH") +smeshgui.Init(salome.myStudyId); + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +# ---- define a box + +box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) +idbox = geompy.addToStudy(box,"box") + +# ---- add first face of box in study + +subShapeList=geompy.SubShapeAll(box,ShapeTypeFace) +face=subShapeList[0] +name = geompy.SubShapeName( face._get_Name(), box._get_Name() ) +print name +idface=geompy.addToStudyInFather(box,face,name) + +# ---- add shell from box in study + +subShellList=geompy.SubShapeAll(box,ShapeTypeShell) +shell = subShellList[0] +name = geompy.SubShapeName( shell._get_Name(), box._get_Name() ) +print name +idshell=geompy.addToStudyInFather(box,shell,name) + +# ---- add first edge of face in study + +edgeList = geompy.SubShapeAll(face,ShapeTypeEdge) +edge=edgeList[0]; +name = geompy.SubShapeName( edge._get_Name(), face._get_Name() ) +print name +idedge=geompy.addToStudyInFather(face,edge,name) + +# ---- launch SMESH, init a Mesh with the box +gen=smeshpy.smeshpy() +mesh=gen.Init(idbox) + +idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) ) +smeshgui.SetName(idmesh, "Meshbox"); +smeshgui.SetShape(idbox, idmesh); + +# ---- create Hypothesis + +print "-------------------------- create Hypothesis" +print "-------------------------- LocalLength" +hyp1=gen.CreateHypothesis("LocalLength") +hypLen1 = hyp1._narrow(SMESH.SMESH_LocalLength) +hypLen1.SetLength(100) +print hypLen1.GetName() +print hypLen1.GetId() +print hypLen1.GetLength() + +idlength = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLen1) ); +smeshgui.SetName(idlength, "Local_Length_100"); + +print "-------------------------- NumberOfSegments" +hyp2=gen.CreateHypothesis("NumberOfSegments") +hypNbSeg1=hyp2._narrow(SMESH.SMESH_NumberOfSegments) +hypNbSeg1.SetNumberOfSegments(7) +print hypNbSeg1.GetName() +print hypNbSeg1.GetId() +print hypNbSeg1.GetNumberOfSegments() + +idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg1) ); +smeshgui.SetName(idseg, "NumberOfSegments_7"); + +print "-------------------------- MaxElementArea" +hyp3=gen.CreateHypothesis("MaxElementArea") +hypArea1=hyp3._narrow(SMESH.SMESH_MaxElementArea) +hypArea1.SetMaxElementArea(2500) +print hypArea1.GetName() +print hypArea1.GetId() +print hypArea1.GetMaxElementArea() + +idarea1 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea1) ); +smeshgui.SetName(idarea1, "MaxElementArea_2500"); + +print "-------------------------- MaxElementArea" +hyp3=gen.CreateHypothesis("MaxElementArea") +hypArea2=hyp3._narrow(SMESH.SMESH_MaxElementArea) +hypArea2.SetMaxElementArea(500) +print hypArea2.GetName() +print hypArea2.GetId() +print hypArea2.GetMaxElementArea() + +idarea2 = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea2) ); +smeshgui.SetName(idarea2, "MaxElementArea_500"); + +print "-------------------------- Regular_1D" +alg1=gen.CreateHypothesis("Regular_1D") +algo1=alg1._narrow(SMESH.SMESH_Algo) +listHyp=algo1.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algoReg=alg1._narrow(SMESH.SMESH_Regular_1D) +print algoReg.GetName() +print algoReg.GetId() + +idreg = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoReg) ); +smeshgui.SetName(idreg, "Regular_1D"); + +print "-------------------------- MEFISTO_2D" +alg2=gen.CreateHypothesis("MEFISTO_2D") +algo2=alg2._narrow(SMESH.SMESH_Algo) +listHyp=algo2.GetCompatibleHypothesis() +for hyp in listHyp: + print hyp +algoMef=alg2._narrow(SMESH.SMESH_MEFISTO_2D) +print algoMef.GetName() +print algoMef.GetId() + +idmef = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoMef) ); +smeshgui.SetName(idmef, "MEFISTO_2D"); + +# ---- add hypothesis to edge + +print "-------------------------- add hypothesis to edge" +edge=salome.IDToObject(idedge) +submesh=mesh.GetElementsOnShape(edge) +ret=mesh.AddHypothesis(edge,algoReg) +print ret +ret=mesh.AddHypothesis(edge,hypLen1) +print ret + +idsm1 = smeshgui.AddSubMeshOnShape( idmesh, + idedge, + salome.orb.object_to_string(submesh), + ShapeTypeEdge ) +smeshgui.SetName(idsm1, "SubMeshEdge") +smeshgui.SetAlgorithms( idsm1, idreg ); +smeshgui.SetHypothesis( idsm1, idlength ); + +print "-------------------------- add hypothesis to face" +face=salome.IDToObject(idface) +submesh=mesh.GetElementsOnShape(face) +ret=mesh.AddHypothesis(face,hypArea2) +print ret + +idsm2 = smeshgui.AddSubMeshOnShape( idmesh, + idface, + salome.orb.object_to_string(submesh), + ShapeTypeFace ) +smeshgui.SetName(idsm2, "SubMeshFace") +smeshgui.SetHypothesis( idsm2, idarea2 ); + +# ---- add hypothesis to box + +print "-------------------------- add hypothesis to box" +box=salome.IDToObject(idbox) +submesh=mesh.GetElementsOnShape(box) +ret=mesh.AddHypothesis(box,algoReg) +print ret +ret=mesh.AddHypothesis(box,hypNbSeg1) +print ret +ret=mesh.AddHypothesis(box,algoMef) +print ret +ret=mesh.AddHypothesis(box,hypArea1) +print ret + +smeshgui.SetAlgorithms( idmesh, idreg ); +smeshgui.SetHypothesis( idmesh, idseg ); +smeshgui.SetAlgorithms( idmesh, idmef ); +smeshgui.SetHypothesis( idmesh, idarea1 ); + +sg.updateObjBrowser(1); diff --git a/src/SMESH_SWIG/SMESH_test2.py b/src/SMESH_SWIG/SMESH_test2.py new file mode 100644 index 000000000..e35b2c467 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_test2.py @@ -0,0 +1,43 @@ + +from SMESH_test1 import * + +# ---- compute box + +print "-------------------------- compute box" +ret=gen.Compute(mesh,idbox) +print ret +log=mesh.GetLog(0); # no erase trace +for linelog in log: + print linelog + + +sg.updateObjBrowser(1); + +# ---- compute edge + +##print "-------------------------- compute edge" +##ret=gen.Compute(mesh,idedge) +##print ret +##log=mesh.GetLog(1); +##for a in log: +## print a + +# ---- add hypothesis to face + +# ---- compute face + +#print "-------------------------- compute face" +#ret=gen.Compute(mesh,idface) +#print ret +#log=mesh.GetLog(1); +#for a in log: +# print a + +##shell=salome.IDToObject(ids) +##submesh=mesh.GetElementsOnShape(shell) +##ret=mesh.AddHypothesis(shell,algoReg) +##print ret +##ret=mesh.AddHypothesis(shell,hypLen1) +##print ret +##ret=gen.Compute(mesh,ids) +##print ret diff --git a/src/SMESH_SWIG/SMESH_test3.py b/src/SMESH_SWIG/SMESH_test3.py new file mode 100644 index 000000000..f2267a112 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_test3.py @@ -0,0 +1,90 @@ +#import SMESH +import smeshpy +import salome +from salome import sg +import math +#import SMESH_BasicHypothesis_idl + +import geompy + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry") +myBuilder = salome.myStudy.NewBuilder() +from geompy import gg + +smeshgui = salome.ImportComponentGUI("SMESH") +smeshgui.Init(salome.myStudyId); + +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +pi=math.pi + +# --------------------------------------------- +xa=math.sin(pi/12) +ya=0 +za=math.cos(pi/12) + +xb=0 +yb=math.sin(pi/18) +zb=math.cos(pi/18) + +xc=math.cos(-pi/18) +yc=0 +zc=math.sin(-pi/18) + +rc1=150 +hc1=300 +rc2=150 +rc3=150 +rc4=300 +# --------------------------------------------- +point_0 = geom.MakePointStruct(0, 0, 0) +point_z = geom.MakePointStruct(0, 0, 1) + +point_a = geom.MakePointStruct(xa, ya, za) +point_b = geom.MakePointStruct(xb, yb, zb) +point_c = geom.MakePointStruct(xc, yc, zc) + +dir_z = geom.MakeDirection(point_z) +axe_z = geom.MakeAxisStruct(0, 0, 0, 0, 0, 1) + +dir_a = geom.MakeDirection(point_a) +axe_a = geom.MakeAxisStruct(0, 0, 0, xa, ya, za) + +dir_b = geom.MakeDirection(point_b) +axe_b = geom.MakeAxisStruct(0, 0, 0, xb, yb, zb) + +dir_c = geom.MakeDirection(point_c) +axe_c = geom.MakeAxisStruct(0, 0, 0, xc, yc, zc) + +cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1) + +hc2=2*hc1 +cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2) +cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1) + +hc3=2*hc1 +cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3) +cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1) + +hc4=2*hc1 +cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4) +cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2) +cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0) +cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4) + +inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common + +blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut +blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2) + +blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common + +idblob = geompy.addToStudy(blob,"blob") +#idc = geompy.addToStudy(cyl_c,"cyl_c") +#idd = geompy.addToStudy(cyl_d,"cyl_d") diff --git a/src/SMESH_SWIG/batchmode_smesh.py b/src/SMESH_SWIG/batchmode_smesh.py new file mode 100644 index 000000000..6ee609495 --- /dev/null +++ b/src/SMESH_SWIG/batchmode_smesh.py @@ -0,0 +1,302 @@ +#============================================================================== +# File : batchmode_smesh.py +# Created : Fri Nov 15 13:51:00 2002 +# Author : Oksana TCHEBANOVA +# Project : SALOME +# Copyright : OPEN CASCADE 2002 +# $Header$ +#============================================================================== + +#-------------------------------------------------------------------------- + +from batchmode_salome import * +import SMESH + +#-------------------------------------------------------------------------- +modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog") + +smesh = lcc.FindOrLoadComponent("FactoryServer", "SMESH") +myStudyBuilder = myStudy.NewBuilder() + +if myStudyBuilder is None: + raise RuntimeError, " Null myStudyBuilder" + +father = myStudy.FindComponent("MESH") +if father is None: + father = myStudyBuilder.NewComponent("MESH") + A1 = myStudyBuilder.FindOrCreateAttribute(father, "AttributeName"); + FName = A1._narrow(SALOMEDS.AttributeName) +# FName.SetValue("Mesh") + + Comp = modulecatalog.GetComponent( "SMESH" ) + FName.SetValue( Comp._get_componentusername() ) + + A2 = myStudyBuilder.FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Mesh" ); + +myStudyBuilder.DefineComponentInstance(father,smesh) + +mySComponentMesh = father._narrow(SALOMEDS.SComponent) + +Tag_HypothesisRoot = 1; +Tag_AlgorithmsRoot = 2; + +Tag_RefOnShape = 1; +Tag_RefOnAppliedHypothesis = 2; +Tag_RefOnAppliedAlgorithms = 3; + +Tag_SubMeshOnVertex = 4; +Tag_SubMeshOnEdge = 5; +Tag_SubMeshOnFace = 6; +Tag_SubMeshOnSolid = 7; +Tag_SubMeshOnCompound = 8; + +Tag = {"HypothesisRoot":1,"AlgorithmsRoot":2,"RefOnShape":1,"RefOnAppliedHypothesis":2,"RefOnAppliedAlgorithms":3,"SubMeshOnVertex":4,"SubMeshOnEdge":5,"SubMeshOnFace":6,"SubMeshOnSolid":7,"SubMeshOnCompound":8} + +# -- enumeration -- +ShapeTypeCompSolid = 1 +ShapeTypeSolid = 2 +ShapeTypeShell = 3 +ShapeTypeFace = 4 +ShapeTypeWire = 5 +ShapeTypeEdge = 6 +ShapeTypeVertex = 7 + +# -- enumeration ShapeType as a dictionary -- +ShapeType = {"CompSolid":1, "Solid":2, "Shell":3, "Face":4, "Wire":5, "Edge":6, "Vertex":7} + +#------------------------------------------------------------ +def Init(): + pass +#------------------------------------------------------------ +def AddNewMesh(IOR): + res,HypothesisRoot = mySComponentMesh.FindSubObject ( Tag_HypothesisRoot ) + if HypothesisRoot is None or res == 0: + HypothesisRoot = myStudyBuilder.NewObjectToTag(mySComponentMesh, Tag_HypothesisRoot) + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName") + aName = anAttr._narrow(SALOMEDS.AttributeName) + aName.SetValue("Hypothesis Definition") + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap") + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap) + aPixmap.SetPixMap( "mesh_tree_hypo.png" ) + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable") + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable) + aSelAttr.SetSelectable(0); + + res, AlgorithmsRoot = mySComponentMesh.FindSubObject (Tag_AlgorithmsRoot) + if AlgorithmsRoot is None or res == 0: + AlgorithmsRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot) + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName") + aName = anAttr._narrow(SALOMEDS.AttributeName) + aName.SetValue("Algorithms Definition"); + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "mesh_tree_algo.png" ); + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable"); + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + + HypothesisRoot = HypothesisRoot._narrow(SALOMEDS.SObject) + newMesh = myStudyBuilder.NewObject(mySComponentMesh) + newMesh = newMesh._narrow(SALOMEDS.SObject) + anAttr = myStudyBuilder.FindOrCreateAttribute(newMesh, "AttributePixMap") + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap) + aPixmap.SetPixMap( "mesh_tree_mesh.png" ) + anAttr = myStudyBuilder.FindOrCreateAttribute(newMesh, "AttributeIOR") + anIOR = anAttr._narrow(SALOMEDS.AttributeIOR) + anIOR.SetValue(IOR) + return newMesh.GetID() + +#------------------------------------------------------------ +def AddNewHypothesis(IOR): + res, HypothesisRoot = mySComponentMesh.FindSubObject (Tag_HypothesisRoot) + if HypothesisRoot is None or res == 0: + HypothesisRoot = myStudyBuilder.NewObjectToTag (mySComponentMesh, Tag_HypothesisRoot) + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeName"); + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue("Hypothesis Definition"); + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributeSelectable"); + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + anAttr = myStudyBuilder.FindOrCreateAttribute(HypothesisRoot, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "mesh_tree_hypo.png" ); + + # Add New Hypothesis + newHypo = myStudyBuilder.NewObject(HypothesisRoot) + newHypo = newHypo._narrow(SALOMEDS.SObject) + anAttr = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap") + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap) + H = orb.string_to_object(IOR) + H = H._narrow( SMESH.SMESH_Hypothesis ); + aType = H.GetName(); + aPixmap.SetPixMap( "mesh_tree_hypo.png_" + aType ); + anAttr = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = anAttr._narrow(SALOMEDS.AttributeIOR); + anIOR.SetValue(IOR); + return newHypo.GetID(); + +#------------------------------------------------------------ +def AddNewAlgorithms(IOR): + res, AlgorithmsRoot = mySComponentMesh.FindSubObject (Tag_AlgorithmsRoot) + if AlgorithmsRoot is None or res == 0: + AlgorithmsRoot = myStudyBuilde.NewObjectToTag (mySComponentMesh, Tag_AlgorithmsRoot) + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeName") + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue("Algorithms Definition"); + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributeSelectable") + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + anAttr = myStudyBuilder.FindOrCreateAttribute(AlgorithmsRoot, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "mesh_tree_algo.png" ); + + # Add New Algorithms + newHypo = myStudyBuilder.NewObject(AlgorithmsRoot) + newHypo = newHypo._narrow(SALOMEDS.SObject) + anAttr = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + H = orb.string_to_object(IOR) + H = H._narrow( SMESH.SMESH_Hypothesis); + aType = H.GetName(); #QString in fact + aPixmap.SetPixMap( "mesh_tree_algo.png_" + aType ); + anAttr = myStudyBuilder.FindOrCreateAttribute(newHypo, "AttributeIOR"); + anIOR = anAttr._narrow(SALOMEDS.AttributeIOR); + anIOR.SetValue(IOR); + return newHypo.GetID(); + + +#------------------------------------------------------------ +def SetShape(ShapeEntry, MeshEntry): + + SO_MorSM = myStudy.FindObjectID( MeshEntry ) + SO_MorSM = SO_MorSM._narrow(SALOMEDS.SObject) + SO_GeomShape = myStudy.FindObjectID( ShapeEntry ); + SO_GeomShape = SO_GeomShape._narrow(SALOMEDS.SObject) + + if SO_MorSM is not None and SO_GeomShape is not None : + SO = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnShape); + SO = SO._narrow(SALOMEDS.SObject) + myStudyBuilder.Addreference (SO,SO_GeomShape); + + +#------------------------------------------------------------ +def SetHypothesis(Mesh_Or_SubMesh_Entry, Hypothesis_Entry): + SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry ); + SO_Hypothesis = myStudy.FindObjectID( Hypothesis_Entry ); + + if SO_MorSM is not None and SO_Hypothesis is not None : + + #Find or Create Applied Hypothesis root + res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedHypothesis) + if AHR is None or res == 0: + AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName"); + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue("Applied Hypothesis"); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "mesh_tree_hypo.png" ); + + SO = myStudyBuilder.NewObject(AHR); + SO = SO._narrow(SALOMEDS.SObject) + myStudyBuilder.Addreference (SO,SO_Hypothesis); + +#------------------------------------------------------------ +def SetAlgorithms(Mesh_Or_SubMesh_Entry, Algorithms_Entry): + SO_MorSM = myStudy.FindObjectID( Mesh_Or_SubMesh_Entry ) + SO_Algorithms = myStudy.FindObjectID( Algorithms_Entry ) + if SO_MorSM != None and SO_Algorithms != None : + #Find or Create Applied Algorithms root + res, AHR = SO_MorSM.FindSubObject (Tag_RefOnAppliedAlgorithms); + if AHR is None or res == 0: + AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedAlgorithms); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName"); + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue("Applied Algorithm"); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable"); + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap"); + aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "mesh_tree_algo.png" ); + + SO = myStudyBuilder.NewObject(AHR); + myStudyBuilder.Addreference (SO,SO_Algorithms); + + +#------------------------------------------------------------ +def UnSetHypothesis( Applied_Hypothesis_Entry ): + SO_Applied_Hypothesis = myStudy.FindObjectID( Applied_Hypothesis_Entry ); + if SO_Applied_Hypothesis : + myStudyBuilder.RemoveObject(SO_Applied_Hypothesis); + + +#------------------------------------------------------------ +def AddSubMesh ( SO_Mesh_Entry, SM_IOR, ST): + SO_Mesh = myStudy.FindObjectID( SO_Mesh_Entry ) + if ( SO_Mesh ) : + + if ST == ShapeTypeCompSolid : + Tag_Shape = Tag_SubMeshOnSolid; + Name = "SubMeshes On Solid"; + elif ST == ShapeTypeFace : + Tag_Shape = Tag_SubMeshOnFace; + Name = "SubMeshes On Face"; + elif ST == ShapeTypeEdge : + Tag_Shape = Tag_SubMeshOnEdge; + Name = "SubMeshes On Edge"; + elif ST == ShapeTypeVertex : + Tag_Shape = Tag_SubMeshOnVertex; + Name = "SubMeshes On Vertex"; + else : + Tag_Shape = Tag_SubMeshOnCompound; + Name = "SubMeshes On Compound"; + + res, SubmeshesRoot = SO_Mesh.FindSubObject (Tag_Shape) + if SubmeshesRoot is None or res == 0: + SubmeshesRoot = myStudyBuilder.NewObjectToTag (SO_Mesh, Tag_Shape); + anAttr = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeName"); + + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue(Name); + anAttr = myStudyBuilder.FindOrCreateAttribute(SubmeshesRoot, "AttributeSelectable"); + aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable); + aSelAttr.SetSelectable(0); + + SO = myStudyBuilder.NewObject (SubmeshesRoot); + SO = SO._narrow(SALOMEDS.SObject) + anAttr = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeIOR"); + anIOR = anAttr._narrow(SALOMEDS.AttributeIOR); + anIOR.SetValue(SM_IOR); + return SO.GetID(); + + return None; + +#------------------------------------------------------------ +def AddSubMeshOnShape (Mesh_Entry, GeomShape_Entry, SM_IOR, ST) : + SO_GeomShape = myStudy.FindObjectID( GeomShape_Entry ); + if SO_GeomShape != None : + SM_Entry = AddSubMesh (Mesh_Entry,SM_IOR,ST); + SO_SM = myStudy.FindObjectID( SM_Entry ); + + if SO_SM != None : + SetShape (GeomShape_Entry, SM_Entry); + return SO_SM.GetID(); + + return None; + + +#------------------------------------------------------------ +def SetName(Entry, Name): + SO = myStudy.FindObjectID( Entry ); + if SO != None : + anAttr = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeName"); + aName = anAttr._narrow(SALOMEDS.AttributeName); + aName.SetValue(Name); + + diff --git a/src/SMESH_SWIG/libSMESH_Swig.i b/src/SMESH_SWIG/libSMESH_Swig.i new file mode 100644 index 000000000..ff2e47467 --- /dev/null +++ b/src/SMESH_SWIG/libSMESH_Swig.i @@ -0,0 +1,12 @@ +// File : libGeometry_Swig.i +// Created : Tue Mar 26 15:04:48 2002 +// Author : Nicolas REJNERI, Paul RASCLE +// Project : SALOME +// Module : GEOM +// Copyright : Open CASCADE, EDF 2002 +// $Header$ + +%module libSMESH_Swig + +%include "SMESHGUI_Swig.i" + -- 2.39.2