medcoupling 9.13.0__cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CaseIO.py +31 -0
- CaseReader.py +424 -0
- CaseWriter.py +349 -0
- MEDCoupling.py +15020 -0
- MEDCouplingRemapper.py +15491 -0
- MEDLoader.py +21994 -0
- MEDLoaderFinalize.py +66 -0
- MEDLoaderSplitter.py +199 -0
- MEDPartitioner.py +163 -0
- MEDRenumber.py +14946 -0
- VTKReader.py +306 -0
- _MEDCoupling.so +0 -0
- _MEDCouplingRemapper.so +0 -0
- _MEDLoader.so +0 -0
- _MEDPartitioner.so +0 -0
- _MEDRenumber.so +0 -0
- _medcoupling.so +0 -0
- geom2medcoupling.py +99 -0
- medcoupling-9.13.0.dist-info/METADATA +45 -0
- medcoupling-9.13.0.dist-info/RECORD +37 -0
- medcoupling-9.13.0.dist-info/WHEEL +6 -0
- medcoupling.libs/libgfortran-040039e1.so.5.0.0 +0 -0
- medcoupling.libs/libhdf5-1c824725.so.103.0.0 +0 -0
- medcoupling.libs/libinterpkernel-71542653.so +0 -0
- medcoupling.libs/libmedC-33a5e5d1.so.11.1.1 +0 -0
- medcoupling.libs/libmedcoupling-837c78c0.so +0 -0
- medcoupling.libs/libmedcouplingremapper-9bb9d18f.so +0 -0
- medcoupling.libs/libmedfwrap-292e4f7f.so.11.1.1 +0 -0
- medcoupling.libs/libmedicoco-ba7f6be6.so +0 -0
- medcoupling.libs/libmedloader-deccdcc9.so +0 -0
- medcoupling.libs/libmedpartitionercpp-c7f41708.so +0 -0
- medcoupling.libs/libmetis-ace54c0c.so +0 -0
- medcoupling.libs/libquadmath-96973f99.so.0.0.0 +0 -0
- medcoupling.libs/librenumbercpp-8a16a450.so +0 -0
- medcoupling.libs/libxml2-e666f9db.so.2.10.3 +0 -0
- medcoupling.py +22874 -0
- vtk2medcoupling.py +72 -0
vtk2medcoupling.py
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#! /usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Copyright (C) 2020-2024 CEA, EDF
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18
|
+
#
|
19
|
+
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
20
|
+
#
|
21
|
+
# Author : Anthony GEAY (EDF R&D)
|
22
|
+
|
23
|
+
import vtk
|
24
|
+
from vtk.util import numpy_support
|
25
|
+
import medcoupling as mc
|
26
|
+
import numpy as np
|
27
|
+
|
28
|
+
def mesh_convertor(fileName):
|
29
|
+
#vtk.vtkDataSetReader()
|
30
|
+
reader = vtk.vtkXMLUnstructuredGridReader()
|
31
|
+
reader.SetFileName(fileName)
|
32
|
+
reader.Update()
|
33
|
+
ug = reader.GetOutput()
|
34
|
+
return mesh_convertor_mem(ug),ug
|
35
|
+
|
36
|
+
def mesh_convertor_mem(ug):
|
37
|
+
from distutils.version import LooseVersion
|
38
|
+
#
|
39
|
+
pts = numpy_support.vtk_to_numpy(ug.GetPoints().GetData())
|
40
|
+
#
|
41
|
+
cla = numpy_support.vtk_to_numpy(ug.GetCellLocationsArray())
|
42
|
+
ctvtk = numpy_support.vtk_to_numpy(ug.GetCellTypesArray())
|
43
|
+
conn = numpy_support.vtk_to_numpy(ug.GetCells().GetData())
|
44
|
+
#
|
45
|
+
ct=mc.DataArrayInt(np.array(ctvtk,dtype="int{}".format(mc.MEDCouplingSizeOfIDs())))[:]
|
46
|
+
c=mc.DataArrayInt(conn)[:]
|
47
|
+
ci=mc.DataArrayInt(cla)[:]
|
48
|
+
# for pv580
|
49
|
+
if LooseVersion(vtk.vtkVersion().GetVTKVersion()) >= LooseVersion("8.90.0"):
|
50
|
+
ci = ci.deltaShiftIndex()+1
|
51
|
+
ci.computeOffsetsFull()
|
52
|
+
#
|
53
|
+
vtk2med = mc.DataArrayInt(mc.vtk2med_cell_types())
|
54
|
+
#
|
55
|
+
ct.transformWithIndArr(vtk2med)
|
56
|
+
c[ci]=ct
|
57
|
+
ci = mc.DataArrayInt.Aggregate([ci,mc.DataArrayInt([len(c)])])
|
58
|
+
#
|
59
|
+
gtv = ct.getDifferentValues().getValues()
|
60
|
+
dimArray = mc.DataArrayInt(len(gtv)) ; dimArray[:] = -1
|
61
|
+
for i,gt in enumerate(gtv):
|
62
|
+
dimArray[i] = mc.MEDCouplingUMesh.GetDimensionOfGeometricType(gt)
|
63
|
+
dim = dimArray.getMaxValueInArray()
|
64
|
+
if not dimArray.isUniform(dim):
|
65
|
+
raise RuntimeError("The input vtkUnstructuredGrid instance is not a single level mesh ! need to split it !")
|
66
|
+
#
|
67
|
+
m=mc.MEDCouplingUMesh("mesh",dim)
|
68
|
+
m.setCoords(mc.DataArrayDouble(np.array(pts,dtype=np.float64)))
|
69
|
+
m.setConnectivity(c,ci,True)
|
70
|
+
m.checkConsistencyLight()
|
71
|
+
#
|
72
|
+
return m
|