1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingCartesianAMRMesh.hxx"
44 #include "MEDCouplingMatrix.hxx"
45 #include "MEDCouplingTypemaps.i"
47 #include "InterpKernelAutoPtr.hxx"
48 #include "BoxSplittingOptions.hxx"
50 using namespace ParaMEDMEM;
51 using namespace INTERP_KERNEL;
55 %template(ivec) std::vector<int>;
56 %template(dvec) std::vector<double>;
57 %template(svec) std::vector<std::string>;
60 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
62 $result=convertMesh($1,$owner);
65 %typemap(out) MEDCouplingMesh*
67 $result=convertMesh($1,$owner);
72 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
74 $result=convertMesh($1,$owner);
77 %typemap(out) MEDCouplingPointSet*
79 $result=convertMesh($1,$owner);
85 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
87 $result=convertMesh($1,$owner);
90 %typemap(out) MEDCoupling1GTUMesh*
92 $result=convertMesh($1,$owner);
97 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
99 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCouplingStructuredMesh*
104 $result=convertMesh($1,$owner);
109 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
111 $result=convertFieldDiscretization($1,$owner);
114 %typemap(out) MEDCouplingFieldDiscretization*
116 $result=convertFieldDiscretization($1,$owner);
121 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
123 $result=convertMultiFields($1,$owner);
126 %typemap(out) MEDCouplingMultiFields*
128 $result=convertMultiFields($1,$owner);
133 %init %{ import_array(); %}
136 %feature("autodoc", "1");
137 %feature("docstring");
139 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
140 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
141 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
192 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
193 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
194 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
195 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
196 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
197 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
200 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
202 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
203 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
204 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
206 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
207 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
208 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
209 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
210 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
211 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
212 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
213 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
226 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
227 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
228 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
280 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
281 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
282 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
283 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
284 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
289 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
290 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
291 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
294 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
295 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
296 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
297 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
298 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
302 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
303 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
304 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
308 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
309 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
310 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
311 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
312 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
313 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
314 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
315 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
316 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
317 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
318 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
322 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
323 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
324 %newobject ParaMEDMEM::DenseMatrix::New;
325 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
326 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
327 %newobject ParaMEDMEM::DenseMatrix::getData;
328 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
329 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
330 %newobject ParaMEDMEM::DenseMatrix::__add__;
331 %newobject ParaMEDMEM::DenseMatrix::__sub__;
332 %newobject ParaMEDMEM::DenseMatrix::__mul__;
334 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
335 %feature("unref") MEDCouplingMesh "$this->decrRef();"
336 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
337 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
338 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
339 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
340 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
341 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
342 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
343 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
344 %feature("unref") MEDCouplingField "$this->decrRef();"
345 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
346 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
347 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
348 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
349 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
350 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
351 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
352 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
353 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
354 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
355 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
356 %feature("unref") DenseMatrix "$this->decrRef();"
358 %rename(assign) *::operator=;
359 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
360 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
361 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
362 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
366 %rename (InterpKernelException) INTERP_KERNEL::Exception;
368 %include "MEDCouplingRefCountObject.i"
369 %include "MEDCouplingMemArray.i"
371 namespace INTERP_KERNEL
374 * \class BoxSplittingOptions
375 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
377 class BoxSplittingOptions
380 BoxSplittingOptions();
381 void init() throw(INTERP_KERNEL::Exception);
382 double getEffeciency() const throw(INTERP_KERNEL::Exception);
383 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
384 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
385 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
386 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
387 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
388 int getMaxCells() const throw(INTERP_KERNEL::Exception);
389 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
390 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
391 std::string printOptions() const throw(INTERP_KERNEL::Exception);
411 CONST_ON_TIME_INTERVAL = 7
412 } TypeOfTimeDiscretization;
420 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
421 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
423 } MEDCouplingMeshType;
426 class DataArrayDouble;
427 class MEDCouplingUMesh;
428 class MEDCouplingFieldDouble;
430 %extend RefCountObject
432 std::string getHiddenCppPointer() const
434 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
439 %extend MEDCouplingGaussLocalization
441 std::string __str__() const throw(INTERP_KERNEL::Exception)
443 return self->getStringRepr();
446 std::string __repr__() const throw(INTERP_KERNEL::Exception)
448 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
449 oss << self->getStringRepr();
456 class MEDCouplingMesh : public RefCountObject, public TimeLabel
459 void setName(const std::string& name);
460 std::string getName() const;
461 void setDescription(const std::string& descr);
462 std::string getDescription() const;
463 void setTime(double val, int iteration, int order);
464 void setTimeUnit(const std::string& unit);
465 std::string getTimeUnit() const;
466 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
467 bool isStructured() const throw(INTERP_KERNEL::Exception);
468 virtual MEDCouplingMesh *deepCpy() const;
469 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
470 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
471 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
472 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
473 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
474 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
475 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
476 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
477 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
478 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
479 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
480 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
481 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
482 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
483 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
484 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
485 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
486 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
487 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
488 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
489 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
490 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
491 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
492 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
493 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
495 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
496 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
497 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
498 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
499 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
500 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
501 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
502 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
503 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
504 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
505 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
506 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
507 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
508 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
509 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
510 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
511 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
514 std::string __str__() const throw(INTERP_KERNEL::Exception)
516 return self->simpleRepr();
519 PyObject *getTime() throw(INTERP_KERNEL::Exception)
522 double tmp0=self->getTime(tmp1,tmp2);
523 PyObject *res = PyList_New(3);
524 PyList_SetItem(res,0,SWIG_From_double(tmp0));
525 PyList_SetItem(res,1,SWIG_From_int(tmp1));
526 PyList_SetItem(res,2,SWIG_From_int(tmp2));
530 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
534 DataArrayDoubleTuple *aa;
535 std::vector<double> bb;
537 int spaceDim=self->getSpaceDimension();
538 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
539 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
540 return self->getCellContainingPoint(pos,eps);
543 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
547 DataArrayDoubleTuple *aa;
548 std::vector<double> bb;
550 int spaceDim=self->getSpaceDimension();
551 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
552 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
553 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
554 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
555 PyObject *ret=PyTuple_New(2);
556 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
557 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
561 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
563 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
564 int spaceDim=self->getSpaceDimension();
566 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
567 if (!SWIG_IsOK(res1))
570 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
571 int nbOfPoints=size/spaceDim;
574 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
576 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
580 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
582 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
583 da2->checkAllocated();
584 int size=da2->getNumberOfTuples();
585 int nbOfCompo=da2->getNumberOfComponents();
586 if(nbOfCompo!=spaceDim)
588 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
590 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
592 PyObject *ret=PyTuple_New(2);
593 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
594 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
598 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
602 DataArrayDoubleTuple *aa;
603 std::vector<double> bb;
605 int spaceDim=self->getSpaceDimension();
606 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
607 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
608 std::vector<int> elts;
609 self->getCellsContainingPoint(pos,eps,elts);
610 DataArrayInt *ret=DataArrayInt::New();
611 ret->alloc((int)elts.size(),1);
612 std::copy(elts.begin(),elts.end(),ret->getPointer());
613 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
616 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
618 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
619 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
620 self->getReverseNodalConnectivity(d0,d1);
621 PyObject *ret=PyTuple_New(2);
622 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
623 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
627 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
630 int v0; std::vector<int> v1;
631 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
632 self->renumberCells(ids,check);
635 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
637 DataArrayInt *cellCor, *nodeCor;
638 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
639 PyObject *res = PyList_New(2);
640 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
641 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
645 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
647 DataArrayInt *cellCor=0,*nodeCor=0;
648 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
649 PyObject *res = PyList_New(2);
650 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
651 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
655 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
657 DataArrayInt *cellCor=0;
658 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
662 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
665 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
666 if (!SWIG_IsOK(res1))
669 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
670 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
674 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
676 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
677 da2->checkAllocated();
678 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
681 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
683 std::vector<int> conn;
684 self->getNodeIdsOfCell(cellId,conn);
685 return convertIntArrToPyList2(conn);
688 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
690 std::vector<double> coo;
691 self->getCoordinatesOfNode(nodeId,coo);
692 return convertDblArrToPyList2(coo);
695 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
699 DataArrayDoubleTuple *aa;
700 std::vector<double> bb;
702 int spaceDim=self->getSpaceDimension();
703 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
704 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
705 self->scale(pointPtr,factor);
708 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
710 int spaceDim=self->getSpaceDimension();
711 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
712 self->getBoundingBox(tmp);
713 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
717 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
720 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
721 PyObject *ret=PyTuple_New(2);
722 PyObject *ret0Py=ret0?Py_True:Py_False;
724 PyTuple_SetItem(ret,0,ret0Py);
725 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
729 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
731 int szArr,sw,iTypppArr;
732 std::vector<int> stdvecTyyppArr;
733 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
734 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
735 if(sw==3)//DataArrayInt
737 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
738 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
739 std::string name=argpt->getName();
741 ret->setName(name.c_str());
743 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
746 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
748 int szArr,sw,iTypppArr;
749 std::vector<int> stdvecTyyppArr;
751 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
752 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
753 if(sw==3)//DataArrayInt
755 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
756 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
757 std::string name=argpt->getName();
759 ret->setName(name.c_str());
762 PyObject *res = PyList_New(2);
763 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
764 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
765 PyList_SetItem(res,0,obj0);
766 PyList_SetItem(res,1,obj1);
770 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
774 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
775 PyObject *res = PyTuple_New(2);
776 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
779 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
781 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
782 PyTuple_SetItem(res,0,obj0);
783 PyTuple_SetItem(res,1,obj1);
787 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
789 std::vector<int> vals=self->getDistributionOfTypes();
791 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
792 PyObject *ret=PyList_New((int)vals.size()/3);
793 for(int j=0;j<(int)vals.size()/3;j++)
795 PyObject *ret1=PyList_New(3);
796 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
797 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
798 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
799 PyList_SetItem(ret,j,ret1);
804 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
806 std::vector<int> code;
807 std::vector<const DataArrayInt *> idsPerType;
808 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
809 convertPyToNewIntArr4(li,1,3,code);
810 return self->checkTypeConsistencyAndContig(code,idsPerType);
813 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
815 std::vector<int> code;
816 std::vector<DataArrayInt *> idsInPflPerType;
817 std::vector<DataArrayInt *> idsPerType;
818 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
819 PyObject *ret=PyTuple_New(3);
822 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
823 PyObject *ret0=PyList_New((int)code.size()/3);
824 for(int j=0;j<(int)code.size()/3;j++)
826 PyObject *ret00=PyList_New(3);
827 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
828 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
829 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
830 PyList_SetItem(ret0,j,ret00);
832 PyTuple_SetItem(ret,0,ret0);
834 PyObject *ret1=PyList_New(idsInPflPerType.size());
835 for(std::size_t j=0;j<idsInPflPerType.size();j++)
836 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
837 PyTuple_SetItem(ret,1,ret1);
838 int n=idsPerType.size();
839 PyObject *ret2=PyList_New(n);
841 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
842 PyTuple_SetItem(ret,2,ret2);
846 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
850 DataArrayDoubleTuple *aa;
851 std::vector<double> bb;
853 int spaceDim=self->getSpaceDimension();
854 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
855 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
856 self->translate(vectorPtr);
859 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
861 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
864 DataArrayDoubleTuple *aa;
865 std::vector<double> bb;
867 int spaceDim=self->getSpaceDimension();
868 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
869 self->rotate(centerPtr,0,alpha);
872 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
874 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
876 DataArrayDouble *a,*a2;
877 DataArrayDoubleTuple *aa,*aa2;
878 std::vector<double> bb,bb2;
880 int spaceDim=self->getSpaceDimension();
881 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
882 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
883 self->rotate(centerPtr,vectorPtr,alpha);
886 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
888 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
889 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
890 PyObject *res=PyList_New(result.size());
891 for(int i=0;iL!=result.end(); i++, iL++)
892 PyList_SetItem(res,i,PyInt_FromLong(*iL));
896 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
898 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
899 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
900 return MEDCouplingMesh::MergeMeshes(tmp);
906 //== MEDCouplingMesh End
908 %include "NormalizedGeometricTypes"
909 %include "MEDCouplingNatureOfFieldEnum"
913 class MEDCouplingNatureOfField
916 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
917 static std::string GetReprNoThrow(NatureOfField nat);
918 static std::string GetAllPossibilitiesStr();
922 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
923 // include "MEDCouplingTimeDiscretization.i"
927 class MEDCouplingGaussLocalization
930 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
931 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
932 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
933 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
934 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
935 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
936 int getDimension() const throw(INTERP_KERNEL::Exception);
937 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
938 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
939 void checkCoherency() const throw(INTERP_KERNEL::Exception);
940 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
942 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
943 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
944 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
945 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
946 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
947 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
948 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
949 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
950 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
951 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
952 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
953 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
955 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
959 %include "MEDCouplingFieldDiscretization.i"
961 //== MEDCouplingPointSet
965 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
968 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
969 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
970 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
971 void zipCoords() throw(INTERP_KERNEL::Exception);
972 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
973 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
974 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
975 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
976 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
977 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
978 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
979 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
980 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
981 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
982 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
983 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
984 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
985 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
986 virtual DataArrayInt *findBoundaryNodes() const;
987 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
988 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
989 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
990 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
991 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
992 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
995 std::string __str__() const throw(INTERP_KERNEL::Exception)
997 return self->simpleRepr();
1000 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1003 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1004 PyObject *res = PyList_New(2);
1005 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1006 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1010 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1012 DataArrayInt *comm, *commIndex;
1013 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1014 PyObject *res = PyList_New(2);
1015 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1016 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1020 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1022 DataArrayDouble *ret1=self->getCoords();
1025 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1028 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1030 int szArr,sw,iTypppArr;
1031 std::vector<int> stdvecTyyppArr;
1032 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1033 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1034 if(sw==3)//DataArrayInt
1036 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1037 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1038 std::string name=argpt->getName();
1040 ret->setName(name.c_str());
1042 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1045 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1047 int szArr,sw,iTypppArr;
1048 std::vector<int> stdvecTyyppArr;
1049 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1050 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1051 if(sw==3)//DataArrayInt
1053 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1054 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1055 std::string name=argpt->getName();
1057 ret->setName(name.c_str());
1059 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1062 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1064 int szArr,sw,iTypppArr;
1065 std::vector<int> stdvecTyyppArr;
1066 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1067 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1068 if(sw==3)//DataArrayInt
1070 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1071 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1072 std::string name=argpt->getName();
1074 ret->setName(name.c_str());
1076 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1079 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1081 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1082 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1085 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1087 int szArr,sw,iTypppArr;
1088 std::vector<int> stdvecTyyppArr;
1089 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1090 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1091 if(sw==3)//DataArrayInt
1093 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1094 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1095 std::string name=argpt->getName();
1097 ret->setName(name.c_str());
1099 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1102 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1104 int szArr,sw,iTypppArr;
1105 std::vector<int> stdvecTyyppArr;
1106 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1107 self->renumberNodes(tmp,newNbOfNodes);
1110 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1112 int szArr,sw,iTypppArr;
1113 std::vector<int> stdvecTyyppArr;
1114 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1115 self->renumberNodes2(tmp,newNbOfNodes);
1118 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1120 int spaceDim=self->getSpaceDimension();
1122 DataArrayDouble *a,*a2;
1123 DataArrayDoubleTuple *aa,*aa2;
1124 std::vector<double> bb,bb2;
1126 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1127 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1128 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1129 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1130 std::vector<int> nodes;
1131 self->findNodesOnLine(p,v,eps,nodes);
1132 DataArrayInt *ret=DataArrayInt::New();
1133 ret->alloc((int)nodes.size(),1);
1134 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1135 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1137 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1139 int spaceDim=self->getSpaceDimension();
1141 DataArrayDouble *a,*a2;
1142 DataArrayDoubleTuple *aa,*aa2;
1143 std::vector<double> bb,bb2;
1145 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1146 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1147 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1148 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1149 std::vector<int> nodes;
1150 self->findNodesOnPlane(p,v,eps,nodes);
1151 DataArrayInt *ret=DataArrayInt::New();
1152 ret->alloc((int)nodes.size(),1);
1153 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1154 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1157 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1161 DataArrayDoubleTuple *aa;
1162 std::vector<double> bb;
1164 int spaceDim=self->getSpaceDimension();
1165 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1166 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1167 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1168 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1171 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1173 DataArrayInt *c=0,*cI=0;
1177 DataArrayDoubleTuple *aa;
1178 std::vector<double> bb;
1180 int spaceDim=self->getSpaceDimension();
1181 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1182 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1183 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1184 PyObject *ret=PyTuple_New(2);
1185 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1186 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1190 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1192 DataArrayInt *c=0,*cI=0;
1193 int spaceDim=self->getSpaceDimension();
1196 DataArrayDoubleTuple *aa;
1197 std::vector<double> bb;
1200 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1201 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1203 PyObject *ret=PyTuple_New(2);
1204 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1205 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1209 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1213 DataArrayDoubleTuple *aa;
1214 std::vector<double> bb;
1216 int spaceDim=self->getSpaceDimension();
1217 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1218 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1220 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1221 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1224 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1228 std::vector<int> multiVal;
1229 std::pair<int, std::pair<int,int> > slic;
1230 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1231 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1235 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1237 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1239 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1241 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1245 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1247 DataArrayInt *v0=0,*v1=0;
1248 self->findCommonCells(compType,startCellId,v0,v1);
1249 PyObject *res = PyList_New(2);
1250 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1251 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1256 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1259 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1260 if (!SWIG_IsOK(res1))
1263 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1264 self->renumberNodesInConn(tmp);
1268 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1270 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1271 da2->checkAllocated();
1272 self->renumberNodesInConn(da2->getConstPointer());
1276 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1279 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1280 PyObject *ret=PyTuple_New(2);
1281 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1282 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1286 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1288 DataArrayInt *ret=0;
1290 int szArr,sw,iTypppArr;
1291 std::vector<int> stdvecTyyppArr;
1292 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1293 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1297 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1301 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1302 PyObject *res = PyList_New(3);
1303 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1304 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1305 PyList_SetItem(res,2,SWIG_From_int(ret2));
1309 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1313 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1314 PyObject *res = PyList_New(3);
1315 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1316 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1317 PyList_SetItem(res,2,SWIG_From_int(ret2));
1321 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1324 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1325 if (!SWIG_IsOK(res1))
1328 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1329 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1333 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1335 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1336 da2->checkAllocated();
1337 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1341 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1345 std::vector<int> multiVal;
1346 std::pair<int, std::pair<int,int> > slic;
1347 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1348 int nbc=self->getNumberOfCells();
1349 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1356 std::ostringstream oss;
1357 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1358 throw INTERP_KERNEL::Exception(oss.str().c_str());
1361 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1366 int tmp=nbc+singleVal;
1367 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1371 std::ostringstream oss;
1372 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1373 throw INTERP_KERNEL::Exception(oss.str().c_str());
1379 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1383 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1388 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1389 daIntTyypp->checkAllocated();
1390 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1393 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1397 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1400 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1401 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1402 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1403 for(int i=0;i<sz;i++)
1404 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1407 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1410 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1412 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1413 std::vector<double> val3;
1414 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1415 "Rotate2DAlg",2,true,nbNodes);
1417 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1418 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1421 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1424 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1425 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1426 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1427 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1428 for(int i=0;i<sz;i++)
1429 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1432 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1435 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1437 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1438 std::vector<double> val3;
1439 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1440 "Rotate3DAlg",3,true,nbNodes);
1442 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1443 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1444 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1449 //== MEDCouplingPointSet End
1451 class MEDCouplingUMeshCell
1454 INTERP_KERNEL::NormalizedCellType getType() const;
1457 std::string __str__() const throw(INTERP_KERNEL::Exception)
1459 return self->repr();
1462 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1465 const int *r=self->getAllConn(ret2);
1466 PyObject *ret=PyTuple_New(ret2);
1467 for(int i=0;i<ret2;i++)
1468 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1474 class MEDCouplingUMeshCellIterator
1481 MEDCouplingUMeshCell *ret=self->nextt();
1483 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1486 PyErr_SetString(PyExc_StopIteration,"No more data.");
1493 class MEDCouplingUMeshCellByTypeIterator
1496 ~MEDCouplingUMeshCellByTypeIterator();
1501 MEDCouplingUMeshCellEntry *ret=self->nextt();
1503 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1506 PyErr_SetString(PyExc_StopIteration,"No more data.");
1513 class MEDCouplingUMeshCellByTypeEntry
1516 ~MEDCouplingUMeshCellByTypeEntry();
1519 MEDCouplingUMeshCellByTypeIterator *__iter__()
1521 return self->iterator();
1526 class MEDCouplingUMeshCellEntry
1529 INTERP_KERNEL::NormalizedCellType getType() const;
1530 int getNumberOfElems() const;
1533 MEDCouplingUMeshCellIterator *__iter__()
1535 return self->iterator();
1540 //== MEDCouplingUMesh
1542 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1545 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1546 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1547 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1548 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1549 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1550 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1551 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1552 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1553 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1554 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1555 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1556 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1557 void computeTypes() throw(INTERP_KERNEL::Exception);
1558 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1559 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1561 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1562 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1563 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1564 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1565 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1566 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1567 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1568 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1569 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1570 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1571 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1572 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1573 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1574 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1575 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1576 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1577 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1578 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1579 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1580 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1581 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1582 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1583 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1584 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1585 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1586 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1587 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1588 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1589 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1590 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1591 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1592 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1593 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1594 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1595 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1596 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1597 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1598 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1599 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1600 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1601 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1602 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1603 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1604 int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) throw(INTERP_KERNEL::Exception);
1605 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1606 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1607 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1608 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1609 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1611 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1613 return MEDCouplingUMesh::New();
1616 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1618 return MEDCouplingUMesh::New(meshName,meshDim);
1621 std::string __str__() const throw(INTERP_KERNEL::Exception)
1623 return self->simpleRepr();
1626 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1628 std::ostringstream oss;
1629 self->reprQuickOverview(oss);
1633 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1635 return self->cellIterator();
1638 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1640 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1641 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1642 PyObject *res=PyList_New(result.size());
1643 for(int i=0;iL!=result.end(); i++, iL++)
1644 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1648 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1652 std::vector<int> multiVal;
1653 std::pair<int, std::pair<int,int> > slic;
1654 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1655 int nbc=self->getNumberOfCells();
1656 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1663 std::ostringstream oss;
1664 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1665 throw INTERP_KERNEL::Exception(oss.str().c_str());
1669 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1676 int tmp=nbc+singleVal;
1677 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1682 std::ostringstream oss;
1683 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1684 throw INTERP_KERNEL::Exception(oss.str().c_str());
1690 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1696 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1697 daIntTyypp->checkAllocated();
1698 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1702 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1706 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1710 std::vector<int> multiVal;
1711 std::pair<int, std::pair<int,int> > slic;
1712 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1713 int nbc=self->getNumberOfCells();
1714 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1721 std::ostringstream oss;
1722 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1723 throw INTERP_KERNEL::Exception(oss.str().c_str());
1727 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1734 int tmp=nbc+singleVal;
1735 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1740 std::ostringstream oss;
1741 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1742 throw INTERP_KERNEL::Exception(oss.str().c_str());
1748 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1753 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1759 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1760 daIntTyypp->checkAllocated();
1761 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1765 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1769 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1771 int szArr,sw,iTypppArr;
1772 std::vector<int> stdvecTyyppArr;
1773 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1776 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1777 throw INTERP_KERNEL::Exception(oss.str().c_str());
1779 self->insertNextCell(type,size,tmp);
1782 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1784 int szArr,sw,iTypppArr;
1785 std::vector<int> stdvecTyyppArr;
1786 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1787 self->insertNextCell(type,szArr,tmp);
1790 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1792 DataArrayInt *ret=self->getNodalConnectivity();
1797 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1799 DataArrayInt *ret=self->getNodalConnectivityIndex();
1805 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1807 int szArr,sw,iTypppArr;
1808 std::vector<int> stdvecTyyppArr;
1809 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1810 int nbOfDepthPeelingPerformed=0;
1811 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1812 PyObject *res=PyTuple_New(2);
1813 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1814 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1818 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1820 DataArrayInt *v0=0,*v1=0;
1821 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1822 PyObject *res = PyList_New(2);
1823 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1824 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1828 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1832 DataArrayDoubleTuple *aa;
1833 std::vector<double> bb;
1835 int nbOfCompo=self->getSpaceDimension();
1836 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1839 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1840 PyObject *ret=PyTuple_New(2);
1841 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1842 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1846 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1848 DataArrayInt *ret1=0;
1849 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1850 PyObject *ret=PyTuple_New(2);
1851 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1852 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1856 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1859 DataArrayInt *ret1(0);
1860 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1861 PyObject *ret=PyTuple_New(3);
1862 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1863 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1864 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1868 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1870 std::vector<int> cells;
1871 self->checkButterflyCells(cells,eps);
1872 DataArrayInt *ret=DataArrayInt::New();
1873 ret->alloc((int)cells.size(),1);
1874 std::copy(cells.begin(),cells.end(),ret->getPointer());
1875 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1878 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1880 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1882 PyObject *ret = PyList_New(sz);
1883 for(int i=0;i<sz;i++)
1884 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1888 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1890 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1891 int sz=retCpp.size();
1892 PyObject *ret=PyList_New(sz);
1893 for(int i=0;i<sz;i++)
1894 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1898 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1901 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1902 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1903 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1906 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1909 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1910 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1914 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1917 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1918 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1922 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1924 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1925 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1926 PyObject *ret=PyTuple_New(3);
1927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1935 DataArrayInt *tmp0=0,*tmp1=0;
1936 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1937 PyObject *ret=PyTuple_New(2);
1938 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1947 std::vector<int> multiVal;
1948 std::pair<int, std::pair<int,int> > slic;
1949 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1950 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1954 return self->duplicateNodes(&singleVal,&singleVal+1);
1956 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1958 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1960 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1964 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1968 std::vector<int> multiVal;
1969 std::pair<int, std::pair<int,int> > slic;
1970 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1971 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1975 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1977 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1979 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1981 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1985 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1988 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1989 DataArrayInt *tmp0,*tmp1=0;
1990 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1991 PyObject *ret=PyTuple_New(2);
1992 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1993 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1997 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1999 DataArrayInt *ret0=0,*ret1=0;
2000 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2001 PyObject *ret=PyTuple_New(2);
2002 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2003 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2007 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2009 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2010 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2011 DataArrayInt *ret1=0,*ret2=0;
2012 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2013 PyObject *ret=PyTuple_New(3);
2014 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2015 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2016 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2020 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2022 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2023 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2024 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2025 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2028 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2031 std::vector<const MEDCouplingUMesh *> meshes;
2032 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2033 std::vector<DataArrayInt *> corr;
2034 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2036 PyObject *ret1=PyList_New(sz);
2037 for(int i=0;i<sz;i++)
2038 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2039 PyObject *ret=PyList_New(2);
2040 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2041 PyList_SetItem(ret,1,ret1);
2045 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2047 std::vector<MEDCouplingUMesh *> meshes;
2048 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2049 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2052 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2054 std::vector<MEDCouplingUMesh *> meshes;
2055 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2056 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2059 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2063 std::vector<int> multiVal;
2064 std::pair<int, std::pair<int,int> > slic;
2065 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2067 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2068 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2072 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2074 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2076 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2078 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2082 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2084 DataArrayInt *arrOut=0,*arrIndexOut=0;
2087 std::vector<int> multiVal;
2088 std::pair<int, std::pair<int,int> > slic;
2089 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2091 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2092 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2097 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2102 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2107 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2111 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2113 PyObject *ret=PyTuple_New(2);
2114 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2115 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2119 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2121 DataArrayInt *arrOut=0,*arrIndexOut=0;
2122 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2123 PyObject *ret=PyTuple_New(2);
2124 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2125 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2129 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2131 if(!PySlice_Check(slic))
2132 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2133 Py_ssize_t strt=2,stp=2,step=2;
2134 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2136 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2137 arrIndxIn->checkAllocated();
2138 if(arrIndxIn->getNumberOfComponents()!=1)
2139 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2140 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2141 DataArrayInt *arrOut=0,*arrIndexOut=0;
2142 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2143 PyObject *ret=PyTuple_New(2);
2144 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2145 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2149 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2150 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2151 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2153 DataArrayInt *arrOut=0,*arrIndexOut=0;
2156 std::vector<int> multiVal;
2157 std::pair<int, std::pair<int,int> > slic;
2158 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2160 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2161 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2166 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2171 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2176 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2180 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2182 PyObject *ret=PyTuple_New(2);
2183 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2184 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2188 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2189 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2193 std::vector<int> multiVal;
2194 std::pair<int, std::pair<int,int> > slic;
2195 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2197 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2198 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2203 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2208 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2213 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2217 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2221 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2225 DataArrayDoubleTuple *aa;
2226 std::vector<double> bb;
2228 int spaceDim=self->getSpaceDimension();
2229 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2230 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2232 std::vector<int> cells;
2233 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2234 DataArrayInt *ret=DataArrayInt::New();
2235 ret->alloc((int)cells.size(),1);
2236 std::copy(cells.begin(),cells.end(),ret->getPointer());
2237 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2240 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2244 DataArrayDoubleTuple *aa;
2245 std::vector<double> bb;
2247 int spaceDim=self->getSpaceDimension();
2248 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2249 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2250 self->orientCorrectly2DCells(v,polyOnly);
2253 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2255 std::vector<int> cells;
2256 self->arePolyhedronsNotCorrectlyOriented(cells);
2257 DataArrayInt *ret=DataArrayInt::New();
2258 ret->alloc((int)cells.size(),1);
2259 std::copy(cells.begin(),cells.end(),ret->getPointer());
2260 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2263 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2267 self->getFastAveragePlaneOfThis(vec,pos);
2269 std::copy(vec,vec+3,vals);
2270 std::copy(pos,pos+3,vals+3);
2271 return convertDblArrToPyListOfTuple(vals,3,2);
2274 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2276 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2277 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2278 return MEDCouplingUMesh::MergeUMeshes(tmp);
2281 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2284 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2285 PyObject *ret=PyTuple_New(2);
2286 PyObject *ret0Py=ret0?Py_True:Py_False;
2288 PyTuple_SetItem(ret,0,ret0Py);
2289 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2293 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2296 bool ret0=self->areCellsIncludedIn2(other,ret1);
2297 PyObject *ret=PyTuple_New(2);
2298 PyObject *ret0Py=ret0?Py_True:Py_False;
2300 PyTuple_SetItem(ret,0,ret0Py);
2301 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2305 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2308 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2309 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2310 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2311 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2312 PyObject *ret=PyTuple_New(5);
2313 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2314 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2315 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2316 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2317 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2321 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2323 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2324 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2325 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2326 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2327 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2328 PyObject *ret=PyTuple_New(5);
2329 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2330 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2332 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2333 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2337 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2339 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2340 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2341 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2342 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2343 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2344 PyObject *ret=PyTuple_New(5);
2345 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2348 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2349 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2353 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2355 DataArrayInt *neighbors=0,*neighborsIdx=0;
2356 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2357 PyObject *ret=PyTuple_New(2);
2358 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2359 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2365 DataArrayInt *neighbors=0,*neighborsIdx=0;
2366 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2367 PyObject *ret=PyTuple_New(2);
2368 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2375 DataArrayInt *neighbors=0,*neighborsIdx=0;
2376 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2377 PyObject *ret=PyTuple_New(2);
2378 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2385 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2386 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2387 DataArrayInt *d2,*d3,*d4,*dd5;
2388 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2389 PyObject *ret=PyTuple_New(7);
2390 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2391 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2392 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2394 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2396 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2400 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2403 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2404 da->checkAllocated();
2405 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2408 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2411 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2412 da->checkAllocated();
2413 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2416 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2419 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2420 da->checkAllocated();
2421 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2424 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2427 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2428 da->checkAllocated();
2429 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2430 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2431 PyObject *res = PyList_New(result.size());
2432 for (int i=0;iL!=result.end(); i++, iL++)
2433 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2437 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2440 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2441 da->checkAllocated();
2442 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2443 ret->setName(da->getName().c_str());
2447 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2449 DataArrayInt *cellNb1=0,*cellNb2=0;
2450 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2451 PyObject *ret=PyTuple_New(3);
2452 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2454 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2458 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2460 int spaceDim=self->getSpaceDimension();
2462 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2464 DataArrayDouble *a,*a2;
2465 DataArrayDoubleTuple *aa,*aa2;
2466 std::vector<double> bb,bb2;
2468 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2469 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2470 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2471 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2473 DataArrayInt *cellIds=0;
2474 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2475 PyObject *ret=PyTuple_New(2);
2476 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2477 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2481 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2483 int spaceDim=self->getSpaceDimension();
2485 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2487 DataArrayDouble *a,*a2;
2488 DataArrayDoubleTuple *aa,*aa2;
2489 std::vector<double> bb,bb2;
2491 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2492 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2493 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2494 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2496 DataArrayInt *cellIds=0;
2497 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2498 PyObject *ret=PyTuple_New(2);
2499 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2500 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2504 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2506 int spaceDim=self->getSpaceDimension();
2508 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2510 DataArrayDouble *a,*a2;
2511 DataArrayDoubleTuple *aa,*aa2;
2512 std::vector<double> bb,bb2;
2514 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2515 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2516 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2517 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2518 return self->getCellIdsCrossingPlane(orig,vect,eps);
2521 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2525 std::vector<int> pos2;
2526 DataArrayInt *pos3=0;
2527 DataArrayIntTuple *pos4=0;
2528 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2533 self->convertToPolyTypes(&pos1,&pos1+1);
2540 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2545 self->convertToPolyTypes(pos3->begin(),pos3->end());
2549 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2553 void convertAllToPoly();
2554 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2555 bool unPolyze() throw(INTERP_KERNEL::Exception);
2556 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2557 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2558 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2561 //== MEDCouplingUMesh End
2563 //== MEDCouplingExtrudedMesh
2565 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2568 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2569 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2571 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2573 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2576 std::string __str__() const throw(INTERP_KERNEL::Exception)
2578 return self->simpleRepr();
2581 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2583 std::ostringstream oss;
2584 self->reprQuickOverview(oss);
2588 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2590 MEDCouplingUMesh *ret=self->getMesh2D();
2593 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2595 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2597 MEDCouplingUMesh *ret=self->getMesh1D();
2600 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2602 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2604 DataArrayInt *ret=self->getMesh3DIds();
2607 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2612 //== MEDCouplingExtrudedMesh End
2614 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2617 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2618 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2619 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2620 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2621 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2622 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2625 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2627 int szArr,sw,iTypppArr;
2628 std::vector<int> stdvecTyyppArr;
2629 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2630 self->insertNextCell(tmp,tmp+szArr);
2633 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2635 DataArrayInt *ret=self->getNodalConnectivity();
2636 if(ret) ret->incrRef();
2640 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2642 std::vector< const MEDCoupling1GTUMesh *> parts;
2643 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2644 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2649 //== MEDCoupling1SGTUMesh
2651 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2654 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2655 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2656 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2657 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2658 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2659 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2660 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2661 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2662 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2665 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2667 return MEDCoupling1SGTUMesh::New(name,type);
2670 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2672 return MEDCoupling1SGTUMesh::New(m);
2675 std::string __str__() const throw(INTERP_KERNEL::Exception)
2677 return self->simpleRepr();
2680 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2682 std::ostringstream oss;
2683 self->reprQuickOverview(oss);
2687 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2689 DataArrayInt *cellPerm(0),*nodePerm(0);
2690 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2691 PyObject *ret(PyTuple_New(3));
2692 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2693 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2694 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2698 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2700 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2701 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2702 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2705 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2707 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2708 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2709 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2714 //== MEDCoupling1SGTUMesh End
2716 //== MEDCoupling1DGTUMesh
2718 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2721 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2722 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2723 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2724 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2725 bool isPacked() const throw(INTERP_KERNEL::Exception);
2728 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2730 return MEDCoupling1DGTUMesh::New(name,type);
2733 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2735 return MEDCoupling1DGTUMesh::New(m);
2738 std::string __str__() const throw(INTERP_KERNEL::Exception)
2740 return self->simpleRepr();
2743 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2745 std::ostringstream oss;
2746 self->reprQuickOverview(oss);
2750 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2752 DataArrayInt *ret=self->getNodalConnectivityIndex();
2753 if(ret) ret->incrRef();
2757 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2759 DataArrayInt *ret1=0,*ret2=0;
2760 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2761 PyObject *ret0Py=ret0?Py_True:Py_False;
2763 PyObject *ret=PyTuple_New(3);
2764 PyTuple_SetItem(ret,0,ret0Py);
2765 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2766 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2770 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2773 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2774 PyObject *ret=PyTuple_New(2);
2775 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2776 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2777 PyTuple_SetItem(ret,1,ret1Py);
2781 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2783 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2784 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2785 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2788 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2790 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2791 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2792 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2795 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2797 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2798 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2799 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2804 //== MEDCoupling1DGTUMeshEnd
2806 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2809 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2810 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2811 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2812 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2813 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2814 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2815 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2816 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2817 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2818 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2819 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2822 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2824 int tmpp1=-1,tmpp2=-1;
2825 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2826 std::vector< std::pair<int,int> > inp;
2830 for(int i=0;i<tmpp1;i++)
2831 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2836 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2837 inp.resize(tmpp1/2);
2838 for(int i=0;i<tmpp1/2;i++)
2839 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2842 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2843 return self->buildStructuredSubPart(inp);
2846 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2848 std::vector< std::pair<int,int> > inp;
2849 convertPyToVectorPairInt(part,inp);
2851 int szArr,sw,iTypppArr;
2852 std::vector<int> stdvecTyyppArr;
2853 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2854 std::vector<int> tmp5(tmp4,tmp4+szArr);
2856 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2859 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2861 std::vector< std::pair<int,int> > inp;
2862 convertPyToVectorPairInt(part,inp);
2863 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2866 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2868 int szArr,sw,iTypppArr;
2869 std::vector<int> stdvecTyyppArr;
2870 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2871 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2874 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2876 int szArr,sw,iTypppArr;
2877 std::vector<int> stdvecTyyppArr;
2878 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2879 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2882 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2884 std::vector< std::pair<int,int> > inp;
2885 convertPyToVectorPairInt(partCompactFormat,inp);
2886 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2889 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2891 int szArr,sw,iTypppArr;
2892 std::vector<int> stdvecTyyppArr;
2893 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2894 int szArr2,sw2,iTypppArr2;
2895 std::vector<int> stdvecTyyppArr2;
2896 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2897 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2898 std::vector< std::pair<int,int> > partCompactFormat;
2899 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2900 PyObject *ret=PyTuple_New(2);
2901 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2902 PyTuple_SetItem(ret,0,ret0Py);
2903 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2904 for(std::size_t i=0;i<partCompactFormat.size();i++)
2906 PyObject *tmp4=PyTuple_New(2);
2907 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2908 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2909 PyList_SetItem(ret1Py,i,tmp4);
2911 PyTuple_SetItem(ret,1,ret1Py);
2917 //== MEDCouplingCMesh
2919 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2922 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2923 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2924 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2925 void setCoords(const DataArrayDouble *coordsX,
2926 const DataArrayDouble *coordsY=0,
2927 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2928 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2930 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2932 return MEDCouplingCMesh::New();
2934 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2936 return MEDCouplingCMesh::New(meshName);
2938 std::string __str__() const throw(INTERP_KERNEL::Exception)
2940 return self->simpleRepr();
2942 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2944 std::ostringstream oss;
2945 self->reprQuickOverview(oss);
2948 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2950 DataArrayDouble *ret=self->getCoordsAt(i);
2958 //== MEDCouplingCMesh End
2960 //== MEDCouplingCurveLinearMesh
2962 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2965 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
2966 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2967 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2968 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2970 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
2972 return MEDCouplingCurveLinearMesh::New();
2974 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2976 return MEDCouplingCurveLinearMesh::New(meshName);
2978 std::string __str__() const throw(INTERP_KERNEL::Exception)
2980 return self->simpleRepr();
2982 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2984 std::ostringstream oss;
2985 self->reprQuickOverview(oss);
2988 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2990 DataArrayDouble *ret=self->getCoords();
2995 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2997 int szArr,sw,iTypppArr;
2998 std::vector<int> stdvecTyyppArr;
2999 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3000 self->setNodeGridStructure(tmp,tmp+szArr);
3005 //== MEDCouplingCurveLinearMesh End
3007 //== MEDCouplingIMesh
3009 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3012 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3014 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3015 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3016 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3017 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3018 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3019 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3020 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3021 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3022 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3027 return MEDCouplingIMesh::New();
3029 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3031 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3032 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3033 const int *nodeStrctPtr(0);
3034 const double *originPtr(0),*dxyzPtr(0);
3036 std::vector<int> bb0;
3037 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3040 std::vector<double> bb,bb2;
3042 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3043 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3045 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3048 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3050 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3053 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3056 std::vector<int> bb0;
3057 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3058 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3061 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3063 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3066 DataArrayDoubleTuple *aa;
3067 std::vector<double> bb;
3069 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3070 self->setOrigin(originPtr,originPtr+nbTuples);
3073 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3075 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3078 DataArrayDoubleTuple *aa;
3079 std::vector<double> bb;
3081 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3082 self->setDXYZ(originPtr,originPtr+nbTuples);
3085 static void CondenseFineToCoarse(DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3087 std::vector< std::pair<int,int> > inp;
3088 convertPyToVectorPairInt(fineLocInCoarse,inp);
3089 MEDCouplingIMesh::CondenseFineToCoarse(coarseDA,coarseSt,fineDA,inp,facts);
3092 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3094 std::vector< std::pair<int,int> > inp;
3095 convertPyToVectorPairInt(fineLocInCoarse,inp);
3096 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3099 std::string __str__() const throw(INTERP_KERNEL::Exception)
3101 return self->simpleRepr();
3103 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3105 std::ostringstream oss;
3106 self->reprQuickOverview(oss);
3112 //== MEDCouplingIMesh End
3116 namespace ParaMEDMEM
3118 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3121 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3122 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3123 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3124 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3125 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3126 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3127 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3128 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3129 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3130 std::string getName() const throw(INTERP_KERNEL::Exception);
3131 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3132 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3133 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3134 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3135 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3136 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3137 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3138 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3139 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3140 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3141 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3142 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3143 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3144 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3145 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3146 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3148 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3150 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3153 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3156 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3158 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3161 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3164 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3166 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3167 return convertIntArrToPyList3(ret);
3170 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3173 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3174 PyObject *ret=PyTuple_New(2);
3175 PyObject *ret0Py=ret0?Py_True:Py_False;
3177 PyTuple_SetItem(ret,0,ret0Py);
3178 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3182 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3184 DataArrayInt *ret1=0;
3185 MEDCouplingMesh *ret0=0;
3187 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3188 if (!SWIG_IsOK(res1))
3191 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3192 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3196 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3198 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3199 da2->checkAllocated();
3200 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3202 PyObject *res = PyList_New(2);
3203 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3204 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3208 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3210 DataArrayInt *ret1=0;
3212 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3213 PyObject *res=PyTuple_New(2);
3214 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3216 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3219 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3220 PyTuple_SetItem(res,1,res1);
3225 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3228 int v0; std::vector<int> v1;
3229 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3230 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3233 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3234 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3237 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3238 if (!SWIG_IsOK(res1))
3241 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3242 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3246 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3248 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3249 da2->checkAllocated();
3250 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3254 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3256 std::vector<int> tmp;
3257 self->getCellIdsHavingGaussLocalization(locId,tmp);
3258 DataArrayInt *ret=DataArrayInt::New();
3259 ret->alloc((int)tmp.size(),1);
3260 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3261 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3264 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3266 std::vector<int> inp0;
3267 convertPyToNewIntArr4(code,1,3,inp0);
3268 std::vector<const DataArrayInt *> inp1;
3269 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3270 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3275 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3278 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3279 static MEDCouplingFieldTemplate *New(TypeOfField type);
3280 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3281 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3284 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3286 return MEDCouplingFieldTemplate::New(f);
3289 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3291 return MEDCouplingFieldTemplate::New(type);
3294 std::string __str__() const throw(INTERP_KERNEL::Exception)
3296 return self->simpleRepr();
3299 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3301 std::ostringstream oss;
3302 self->reprQuickOverview(oss);
3308 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3311 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3312 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3313 void setTimeUnit(const std::string& unit);
3314 std::string getTimeUnit() const;
3315 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3316 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3317 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3318 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3319 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3320 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3321 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3322 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3323 MEDCouplingFieldDouble *deepCpy() const;
3324 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3325 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3326 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3327 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3328 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3329 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3330 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3331 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3332 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3333 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3334 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3335 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3336 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3337 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3338 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3339 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3340 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3341 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3342 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3343 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3344 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3345 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3346 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3347 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3348 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3349 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3350 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3351 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3352 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3353 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3354 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3355 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3356 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3357 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3358 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3359 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3360 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3361 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3362 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3363 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3364 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3365 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3366 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3367 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3368 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3369 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3370 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3371 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3372 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3373 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3374 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3375 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3376 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3377 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3378 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3379 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3380 double getMinValue() const throw(INTERP_KERNEL::Exception);
3381 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3382 double norm2() const throw(INTERP_KERNEL::Exception);
3383 double normMax() const throw(INTERP_KERNEL::Exception);
3384 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3385 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3386 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3387 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3388 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3389 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3390 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3391 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3392 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3393 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3394 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3395 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3396 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3397 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3398 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3399 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3400 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3401 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3402 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3403 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3404 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3405 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3407 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3409 return MEDCouplingFieldDouble::New(type,td);
3412 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3414 return MEDCouplingFieldDouble::New(ft,td);
3417 std::string __str__() const throw(INTERP_KERNEL::Exception)
3419 return self->simpleRepr();
3422 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3424 std::ostringstream oss;
3425 self->reprQuickOverview(oss);
3429 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3431 DataArrayDouble *ret=self->getArray();
3437 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3439 std::vector<DataArrayDouble *> arrs=self->getArrays();
3440 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3444 PyObject *ret=PyTuple_New(sz);
3445 for(int i=0;i<sz;i++)
3448 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3450 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3455 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3457 std::vector<const DataArrayDouble *> tmp;
3458 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3460 std::vector<DataArrayDouble *> arrs(sz);
3461 for(int i=0;i<sz;i++)
3462 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3463 self->setArrays(arrs);
3466 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3468 DataArrayDouble *ret=self->getEndArray();
3474 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3478 DataArrayDoubleTuple *aa;
3479 std::vector<double> bb;
3481 const MEDCouplingMesh *mesh=self->getMesh();
3483 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3484 int spaceDim=mesh->getSpaceDimension();
3485 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3486 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3488 int sz=self->getNumberOfComponents();
3489 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3490 self->getValueOn(spaceLoc,res);
3491 return convertDblArrToPyList(res,sz);
3494 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3496 int sz=self->getNumberOfComponents();
3497 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3498 self->getValueOnPos(i,j,k,res);
3499 return convertDblArrToPyList(res,sz);
3502 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3504 const MEDCouplingMesh *mesh(self->getMesh());
3506 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3509 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3510 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3511 mesh->getSpaceDimension(),true,nbPts);
3512 return self->getValueOnMulti(inp,nbPts);
3515 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3519 DataArrayDoubleTuple *aa;
3520 std::vector<double> bb;
3522 const MEDCouplingMesh *mesh=self->getMesh();
3524 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3525 int spaceDim=mesh->getSpaceDimension();
3526 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3527 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3530 int sz=self->getNumberOfComponents();
3531 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3532 self->getValueOn(spaceLoc,time,res);
3533 return convertDblArrToPyList(res,sz);
3536 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3538 if(self->getArray()!=0)
3539 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3542 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3543 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3544 self->setArray(arr);
3548 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3551 double tmp0=self->getTime(tmp1,tmp2);
3552 PyObject *res = PyList_New(3);
3553 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3554 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3555 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3559 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3562 double tmp0=self->getStartTime(tmp1,tmp2);
3563 PyObject *res = PyList_New(3);
3564 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3565 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3566 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3570 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3573 double tmp0=self->getEndTime(tmp1,tmp2);
3574 PyObject *res = PyList_New(3);
3575 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3576 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3577 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3580 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3582 int sz=self->getNumberOfComponents();
3583 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3584 self->accumulate(tmp);
3585 return convertDblArrToPyList(tmp,sz);
3587 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3589 int sz=self->getNumberOfComponents();
3590 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3591 self->integral(isWAbs,tmp);
3592 return convertDblArrToPyList(tmp,sz);
3594 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3596 int sz=self->getNumberOfComponents();
3597 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3598 self->getWeightedAverageValue(tmp,isWAbs);
3599 return convertDblArrToPyList(tmp,sz);
3601 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3603 int sz=self->getNumberOfComponents();
3604 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3606 return convertDblArrToPyList(tmp,sz);
3608 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3610 int sz=self->getNumberOfComponents();
3611 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3613 return convertDblArrToPyList(tmp,sz);
3615 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3617 int szArr,sw,iTypppArr;
3618 std::vector<int> stdvecTyyppArr;
3619 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3620 self->renumberCells(tmp,check);
3623 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3625 int szArr,sw,iTypppArr;
3626 std::vector<int> stdvecTyyppArr;
3627 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3628 self->renumberCellsWithoutMesh(tmp,check);
3631 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3633 int szArr,sw,iTypppArr;
3634 std::vector<int> stdvecTyyppArr;
3635 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3636 self->renumberNodes(tmp,eps);
3639 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3641 int szArr,sw,iTypppArr;
3642 std::vector<int> stdvecTyyppArr;
3643 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3644 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3647 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3651 std::vector<int> multiVal;
3652 std::pair<int, std::pair<int,int> > slic;
3653 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3654 const MEDCouplingMesh *mesh=self->getMesh();
3656 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3657 int nbc=mesh->getNumberOfCells();
3658 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3665 std::ostringstream oss;
3666 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3667 throw INTERP_KERNEL::Exception(oss.str().c_str());
3670 return self->buildSubPart(&singleVal,&singleVal+1);
3675 int tmp=nbc+singleVal;
3676 return self->buildSubPart(&tmp,&tmp+1);
3680 std::ostringstream oss;
3681 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3682 throw INTERP_KERNEL::Exception(oss.str().c_str());
3688 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3692 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3697 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3698 daIntTyypp->checkAllocated();
3699 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3702 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3706 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3708 const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
3709 if(PyTuple_Check(li))
3711 Py_ssize_t sz=PyTuple_Size(li);
3713 throw INTERP_KERNEL::Exception(msg);
3714 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3717 std::vector<int> multiVal;
3718 std::pair<int, std::pair<int,int> > slic;
3719 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3720 if(!self->getArray())
3721 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3723 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3724 catch(INTERP_KERNEL::Exception& e)
3725 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3726 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3727 DataArrayDouble *ret0Arr=ret0->getArray();
3729 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3734 std::vector<int> v2(1,singleVal);
3735 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3736 ret0->setArray(aarr);
3741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3742 ret0->setArray(aarr);
3747 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3748 std::vector<int> v2(nbOfComp);
3749 for(int i=0;i<nbOfComp;i++)
3750 v2[i]=slic.first+i*slic.second.second;
3751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3752 ret0->setArray(aarr);
3756 throw INTERP_KERNEL::Exception(msg);
3761 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3764 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3767 double r1=self->getMaxValue2(tmp);
3768 PyObject *ret=PyTuple_New(2);
3769 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3770 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3774 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3777 double r1=self->getMinValue2(tmp);
3778 PyObject *ret=PyTuple_New(2);
3779 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3780 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3784 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3786 std::vector<int> tmp;
3787 convertPyToNewIntArr3(li,tmp);
3788 return self->keepSelectedComponents(tmp);
3791 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3793 std::vector<int> tmp;
3794 convertPyToNewIntArr3(li,tmp);
3795 self->setSelectedComponents(f,tmp);
3798 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3801 DataArrayDouble *a,*a2;
3802 DataArrayDoubleTuple *aa,*aa2;
3803 std::vector<double> bb,bb2;
3806 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3807 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3808 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3809 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3811 return self->extractSlice3D(orig,vect,eps);
3814 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3816 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3819 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3821 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3824 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3826 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3827 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3830 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3832 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3834 return (*self)-(*other);
3836 throw INTERP_KERNEL::Exception(msg);
3841 DataArrayDoubleTuple *aa;
3842 std::vector<double> bb;
3844 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3849 if(!self->getArray())
3850 throw INTERP_KERNEL::Exception(msg2);
3851 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3852 ret->applyLin(1.,-val);
3853 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3854 ret2->setArray(ret);
3859 if(!self->getArray())
3860 throw INTERP_KERNEL::Exception(msg2);
3861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3862 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3863 ret2->setArray(ret);
3868 if(!self->getArray())
3869 throw INTERP_KERNEL::Exception(msg2);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3871 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3872 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3873 ret2->setArray(ret);
3878 if(!self->getArray())
3879 throw INTERP_KERNEL::Exception(msg2);
3880 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3881 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3882 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3883 ret2->setArray(ret);
3887 { throw INTERP_KERNEL::Exception(msg); }
3891 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3893 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3896 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3898 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3901 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3903 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3906 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3908 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3909 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3912 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3914 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3916 return (*self)/(*other);
3918 throw INTERP_KERNEL::Exception(msg);
3923 DataArrayDoubleTuple *aa;
3924 std::vector<double> bb;
3926 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3932 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3933 if(!self->getArray())
3934 throw INTERP_KERNEL::Exception(msg2);
3935 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3936 ret->applyLin(1./val,0);
3937 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3938 ret2->setArray(ret);
3943 if(!self->getArray())
3944 throw INTERP_KERNEL::Exception(msg2);
3945 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3946 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3947 ret2->setArray(ret);
3952 if(!self->getArray())
3953 throw INTERP_KERNEL::Exception(msg2);
3954 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3955 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3956 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3957 ret2->setArray(ret);
3962 if(!self->getArray())
3963 throw INTERP_KERNEL::Exception(msg2);
3964 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3965 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3966 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3967 ret2->setArray(ret);
3971 { throw INTERP_KERNEL::Exception(msg); }
3975 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3977 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3980 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3982 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3983 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3986 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3988 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3990 return (*self)^(*other);
3992 throw INTERP_KERNEL::Exception(msg);
3997 DataArrayDoubleTuple *aa;
3998 std::vector<double> bb;
4000 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4005 if(!self->getArray())
4006 throw INTERP_KERNEL::Exception(msg2);
4007 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4009 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4010 ret2->setArray(ret);
4015 if(!self->getArray())
4016 throw INTERP_KERNEL::Exception(msg2);
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4018 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4019 ret2->setArray(ret);
4024 if(!self->getArray())
4025 throw INTERP_KERNEL::Exception(msg2);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4028 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4029 ret2->setArray(ret);
4034 if(!self->getArray())
4035 throw INTERP_KERNEL::Exception(msg2);
4036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4038 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4039 ret2->setArray(ret);
4043 { throw INTERP_KERNEL::Exception(msg); }
4047 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4049 return self->negate();
4052 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4054 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4055 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4058 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4060 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4064 Py_XINCREF(trueSelf);
4068 throw INTERP_KERNEL::Exception(msg);
4073 DataArrayDoubleTuple *aa;
4074 std::vector<double> bb;
4076 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4081 if(!self->getArray())
4082 throw INTERP_KERNEL::Exception(msg2);
4083 self->getArray()->applyLin(1.,val);
4084 Py_XINCREF(trueSelf);
4089 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4092 Py_XINCREF(trueSelf);
4097 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4098 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4099 ret2->setArray(aaa);
4101 Py_XINCREF(trueSelf);
4106 if(!self->getArray())
4107 throw INTERP_KERNEL::Exception(msg2);
4108 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4109 self->getArray()->addEqual(aaa);
4110 Py_XINCREF(trueSelf);
4114 { throw INTERP_KERNEL::Exception(msg); }
4118 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4120 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4121 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4124 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4126 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4130 Py_XINCREF(trueSelf);
4134 throw INTERP_KERNEL::Exception(msg);
4139 DataArrayDoubleTuple *aa;
4140 std::vector<double> bb;
4142 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4147 if(!self->getArray())
4148 throw INTERP_KERNEL::Exception(msg2);
4149 self->getArray()->applyLin(1.,-val);
4150 Py_XINCREF(trueSelf);
4155 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4158 Py_XINCREF(trueSelf);
4163 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4164 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4165 ret2->setArray(aaa);
4167 Py_XINCREF(trueSelf);
4172 if(!self->getArray())
4173 throw INTERP_KERNEL::Exception(msg2);
4174 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4175 self->getArray()->substractEqual(aaa);
4176 Py_XINCREF(trueSelf);
4180 { throw INTERP_KERNEL::Exception(msg); }
4184 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4186 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4187 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4190 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4192 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4196 Py_XINCREF(trueSelf);
4200 throw INTERP_KERNEL::Exception(msg);
4205 DataArrayDoubleTuple *aa;
4206 std::vector<double> bb;
4208 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4213 if(!self->getArray())
4214 throw INTERP_KERNEL::Exception(msg2);
4215 self->getArray()->applyLin(val,0);
4216 Py_XINCREF(trueSelf);
4221 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4224 Py_XINCREF(trueSelf);
4229 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4230 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4231 ret2->setArray(aaa);
4233 Py_XINCREF(trueSelf);
4238 if(!self->getArray())
4239 throw INTERP_KERNEL::Exception(msg2);
4240 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4241 self->getArray()->multiplyEqual(aaa);
4242 Py_XINCREF(trueSelf);
4246 { throw INTERP_KERNEL::Exception(msg); }
4250 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4252 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4253 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4256 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4258 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4262 Py_XINCREF(trueSelf);
4266 throw INTERP_KERNEL::Exception(msg);
4271 DataArrayDoubleTuple *aa;
4272 std::vector<double> bb;
4274 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4280 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4281 if(!self->getArray())
4282 throw INTERP_KERNEL::Exception(msg2);
4283 self->getArray()->applyLin(1./val,0);
4284 Py_XINCREF(trueSelf);
4289 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4292 Py_XINCREF(trueSelf);
4297 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4298 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4299 ret2->setArray(aaa);
4301 Py_XINCREF(trueSelf);
4306 if(!self->getArray())
4307 throw INTERP_KERNEL::Exception(msg2);
4308 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4309 self->getArray()->divideEqual(aaa);
4310 Py_XINCREF(trueSelf);
4314 { throw INTERP_KERNEL::Exception(msg); }
4318 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4320 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4321 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4324 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4326 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4330 Py_XINCREF(trueSelf);
4334 throw INTERP_KERNEL::Exception(msg);
4339 DataArrayDoubleTuple *aa;
4340 std::vector<double> bb;
4342 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4347 if(!self->getArray())
4348 throw INTERP_KERNEL::Exception(msg2);
4349 self->getArray()->applyPow(val);
4350 Py_XINCREF(trueSelf);
4355 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4358 Py_XINCREF(trueSelf);
4363 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4364 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4365 ret2->setArray(aaa);
4367 Py_XINCREF(trueSelf);
4372 if(!self->getArray())
4373 throw INTERP_KERNEL::Exception(msg2);
4374 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4375 self->getArray()->powEqual(aaa);
4376 Py_XINCREF(trueSelf);
4380 { throw INTERP_KERNEL::Exception(msg); }
4384 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4386 std::vector<const MEDCouplingFieldDouble *> tmp;
4387 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4388 return MEDCouplingFieldDouble::MergeFields(tmp);
4391 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4393 std::vector<const MEDCouplingFieldDouble *> tmp;
4394 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4395 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4400 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4403 int getNumberOfFields() const;
4404 MEDCouplingMultiFields *deepCpy() const;
4405 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4406 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4407 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4408 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4409 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4412 std::string __str__() const throw(INTERP_KERNEL::Exception)
4414 return self->simpleRepr();
4416 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4418 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4419 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4421 std::vector<MEDCouplingFieldDouble *> fs(sz);
4422 for(int i=0;i<sz;i++)
4423 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4424 return MEDCouplingMultiFields::New(fs);
4426 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4428 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4429 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4431 std::vector<MEDCouplingFieldDouble *> fs(sz);
4432 for(int i=0;i<sz;i++)
4433 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4434 return MEDCouplingMultiFields::New(fs);
4436 PyObject *getFields() const
4438 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4439 int sz=fields.size();
4440 PyObject *res = PyList_New(sz);
4441 for(int i=0;i<sz;i++)
4445 fields[i]->incrRef();
4446 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4450 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4455 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4457 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4461 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4464 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4466 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4468 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4470 PyObject *res = PyList_New(sz);
4471 for(int i=0;i<sz;i++)
4476 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4480 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4485 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4487 std::vector<int> refs;
4488 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4490 PyObject *res = PyList_New(sz);
4491 for(int i=0;i<sz;i++)
4496 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4500 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4504 PyObject *ret=PyTuple_New(2);
4505 PyTuple_SetItem(ret,0,res);
4506 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4509 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4511 std::vector<DataArrayDouble *> ms=self->getArrays();
4513 PyObject *res = PyList_New(sz);
4514 for(int i=0;i<sz;i++)
4519 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4523 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4528 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4530 std::vector< std::vector<int> > refs;
4531 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4533 PyObject *res = PyList_New(sz);
4534 PyObject *res2 = PyList_New(sz);
4535 for(int i=0;i<sz;i++)
4540 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4544 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4546 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4549 PyObject *ret=PyTuple_New(2);
4550 PyTuple_SetItem(ret,0,res);
4551 PyTuple_SetItem(ret,1,res2);
4557 class MEDCouplingDefinitionTime
4560 MEDCouplingDefinitionTime();
4561 void assign(const MEDCouplingDefinitionTime& other);
4562 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4563 double getTimeResolution() const;
4564 std::vector<double> getHotSpotsTime() const;
4567 std::string __str__() const throw(INTERP_KERNEL::Exception)
4569 std::ostringstream oss;
4570 self->appendRepr(oss);
4574 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4576 int meshId,arrId,arrIdInField,fieldId;
4577 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4578 PyObject *res=PyList_New(4);
4579 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4580 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4581 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4582 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4586 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4588 int meshId,arrId,arrIdInField,fieldId;
4589 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4590 PyObject *res=PyList_New(4);
4591 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4592 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4593 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4594 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4600 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4603 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4604 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4608 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4610 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4611 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4613 std::vector<MEDCouplingFieldDouble *> fs(sz);
4614 for(int i=0;i<sz;i++)
4615 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4616 return MEDCouplingFieldOverTime::New(fs);
4618 std::string __str__() const throw(INTERP_KERNEL::Exception)
4620 return self->simpleRepr();
4622 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4624 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4625 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4627 std::vector<MEDCouplingFieldDouble *> fs(sz);
4628 for(int i=0;i<sz;i++)
4629 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4630 return MEDCouplingFieldOverTime::New(fs);
4635 class MEDCouplingCartesianAMRMesh;
4637 class MEDCouplingCartesianAMRPatch : public RefCountObject
4640 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4641 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4642 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4643 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4646 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4648 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4649 return convertFromVectorPairInt(ret);
4652 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4654 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4660 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4662 std::vector< std::pair<int,int> > inp;
4663 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4664 self->addPatch(inp,factors);
4667 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4669 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4671 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4672 if(patchId==mesh->getNumberOfPatches())
4674 std::ostringstream oss;
4675 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4676 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4679 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4685 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4687 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4689 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4690 mesh->removePatch(patchId);
4693 int __len__() const throw(INTERP_KERNEL::Exception)
4695 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4697 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4698 return mesh->getNumberOfPatches();
4703 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4707 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4708 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4709 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4710 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4711 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4713 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4714 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4715 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4716 void detachFromFather() throw(INTERP_KERNEL::Exception);
4719 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4721 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4722 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4723 const int *nodeStrctPtr(0);
4724 const double *originPtr(0),*dxyzPtr(0);
4726 std::vector<int> bb0;
4727 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4730 std::vector<double> bb,bb2;
4732 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4733 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4735 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4738 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4740 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4743 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4745 std::vector< std::pair<int,int> > inp;
4746 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4747 self->addPatch(inp,factors);
4750 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4752 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4758 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4760 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4766 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4768 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4774 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4776 if(patchId==self->getNumberOfPatches())
4778 std::ostringstream oss;
4779 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4780 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4783 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4789 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4791 self->removePatch(patchId);
4794 int __len__() const throw(INTERP_KERNEL::Exception)
4796 return self->getNumberOfPatches();
4801 class DenseMatrix : public RefCountObject, public TimeLabel
4804 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4805 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4806 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
4807 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
4809 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
4810 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
4811 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
4812 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
4813 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4814 void transpose() throw(INTERP_KERNEL::Exception);
4816 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
4817 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
4818 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
4821 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4823 return DenseMatrix::New(nbRows,nbCols);
4826 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4828 return DenseMatrix::New(array,nbRows,nbCols);
4831 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
4834 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
4835 PyObject *ret=PyTuple_New(2);
4836 PyObject *ret0Py=ret0?Py_True:Py_False;
4838 PyTuple_SetItem(ret,0,ret0Py);
4839 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4843 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
4845 DataArrayDouble *ret(self->getData());
4851 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4853 return ParaMEDMEM::DenseMatrix::Add(self,other);
4856 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4858 return ParaMEDMEM::DenseMatrix::Substract(self,other);
4861 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4863 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4866 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
4868 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4871 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4873 self->addEqual(other);
4874 Py_XINCREF(trueSelf);
4878 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4880 self->substractEqual(other);
4881 Py_XINCREF(trueSelf);
4885 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
4887 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
4897 __filename=os.environ.get('PYTHONSTARTUP')
4898 if __filename and os.path.isfile(__filename):
4899 execfile(__filename)