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::ExtractFieldOfDoubleFrom;
304 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
305 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
308 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
309 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
310 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
311 %newobject ParaMEDMEM::MEDCouplingIMesh::buildWithGhost;
312 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
313 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
314 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
315 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
316 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
317 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
318 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
322 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
323 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildMeshFromPatchEnvelop;
324 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getImageMesh;
325 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
326 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
327 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
328 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::createCellFieldOnPatch;
329 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::findPatchesInTheNeighborhoodOf;
330 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
331 %newobject ParaMEDMEM::DenseMatrix::New;
332 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
333 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
334 %newobject ParaMEDMEM::DenseMatrix::getData;
335 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
336 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
337 %newobject ParaMEDMEM::DenseMatrix::__add__;
338 %newobject ParaMEDMEM::DenseMatrix::__sub__;
339 %newobject ParaMEDMEM::DenseMatrix::__mul__;
341 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
342 %feature("unref") MEDCouplingMesh "$this->decrRef();"
343 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
344 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
345 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
346 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
347 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
348 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
349 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
350 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
351 %feature("unref") MEDCouplingField "$this->decrRef();"
352 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
353 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
354 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
355 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
356 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
357 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
358 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
359 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
360 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
361 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
362 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
363 %feature("unref") DenseMatrix "$this->decrRef();"
365 %rename(assign) *::operator=;
366 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
367 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
368 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
369 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
373 %rename (InterpKernelException) INTERP_KERNEL::Exception;
375 %include "MEDCouplingRefCountObject.i"
376 %include "MEDCouplingMemArray.i"
378 namespace INTERP_KERNEL
381 * \class BoxSplittingOptions
382 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
384 class BoxSplittingOptions
387 BoxSplittingOptions();
388 void init() throw(INTERP_KERNEL::Exception);
389 double getEffeciency() const throw(INTERP_KERNEL::Exception);
390 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
391 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
392 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
393 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
394 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
395 int getMaxCells() const throw(INTERP_KERNEL::Exception);
396 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
397 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
398 std::string printOptions() const throw(INTERP_KERNEL::Exception);
401 std::string __str__() const throw(INTERP_KERNEL::Exception)
403 return self->printOptions();
425 CONST_ON_TIME_INTERVAL = 7
426 } TypeOfTimeDiscretization;
434 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
435 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
437 } MEDCouplingMeshType;
440 class DataArrayDouble;
441 class MEDCouplingUMesh;
442 class MEDCouplingFieldDouble;
444 %extend RefCountObject
446 std::string getHiddenCppPointer() const
448 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
453 %extend MEDCouplingGaussLocalization
455 std::string __str__() const throw(INTERP_KERNEL::Exception)
457 return self->getStringRepr();
460 std::string __repr__() const throw(INTERP_KERNEL::Exception)
462 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
463 oss << self->getStringRepr();
470 class MEDCouplingMesh : public RefCountObject, public TimeLabel
473 void setName(const std::string& name);
474 std::string getName() const;
475 void setDescription(const std::string& descr);
476 std::string getDescription() const;
477 void setTime(double val, int iteration, int order);
478 void setTimeUnit(const std::string& unit);
479 std::string getTimeUnit() const;
480 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
481 bool isStructured() const throw(INTERP_KERNEL::Exception);
482 virtual MEDCouplingMesh *deepCpy() const;
483 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
484 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
485 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
486 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
487 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
488 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
489 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
490 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
491 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
492 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
493 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
494 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
495 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
496 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
497 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
498 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
499 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
500 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
501 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
502 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
503 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
504 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
505 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
506 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
507 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
509 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
510 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
511 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
512 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
513 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
514 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
515 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
516 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
517 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
518 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
519 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
520 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
521 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
522 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
523 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
524 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
525 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
528 std::string __str__() const throw(INTERP_KERNEL::Exception)
530 return self->simpleRepr();
533 PyObject *getTime() throw(INTERP_KERNEL::Exception)
536 double tmp0=self->getTime(tmp1,tmp2);
537 PyObject *res = PyList_New(3);
538 PyList_SetItem(res,0,SWIG_From_double(tmp0));
539 PyList_SetItem(res,1,SWIG_From_int(tmp1));
540 PyList_SetItem(res,2,SWIG_From_int(tmp2));
544 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
548 DataArrayDoubleTuple *aa;
549 std::vector<double> bb;
551 int spaceDim=self->getSpaceDimension();
552 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
553 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
554 return self->getCellContainingPoint(pos,eps);
557 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
561 DataArrayDoubleTuple *aa;
562 std::vector<double> bb;
564 int spaceDim=self->getSpaceDimension();
565 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
566 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
567 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
568 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
569 PyObject *ret=PyTuple_New(2);
570 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
571 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
575 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
577 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
578 int spaceDim=self->getSpaceDimension();
580 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
581 if (!SWIG_IsOK(res1))
584 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
585 int nbOfPoints=size/spaceDim;
588 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
590 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
594 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
596 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
597 da2->checkAllocated();
598 int size=da2->getNumberOfTuples();
599 int nbOfCompo=da2->getNumberOfComponents();
600 if(nbOfCompo!=spaceDim)
602 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
604 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
606 PyObject *ret=PyTuple_New(2);
607 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
608 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
612 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
616 DataArrayDoubleTuple *aa;
617 std::vector<double> bb;
619 int spaceDim=self->getSpaceDimension();
620 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
621 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
622 std::vector<int> elts;
623 self->getCellsContainingPoint(pos,eps,elts);
624 DataArrayInt *ret=DataArrayInt::New();
625 ret->alloc((int)elts.size(),1);
626 std::copy(elts.begin(),elts.end(),ret->getPointer());
627 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
630 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
632 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
633 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
634 self->getReverseNodalConnectivity(d0,d1);
635 PyObject *ret=PyTuple_New(2);
636 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
637 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
641 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
644 int v0; std::vector<int> v1;
645 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
646 self->renumberCells(ids,check);
649 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
651 DataArrayInt *cellCor, *nodeCor;
652 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
653 PyObject *res = PyList_New(2);
654 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
655 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
659 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
661 DataArrayInt *cellCor=0,*nodeCor=0;
662 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
663 PyObject *res = PyList_New(2);
664 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
665 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
669 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
671 DataArrayInt *cellCor=0;
672 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
676 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
679 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
680 if (!SWIG_IsOK(res1))
683 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
684 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
688 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
690 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
691 da2->checkAllocated();
692 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
695 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
697 std::vector<int> conn;
698 self->getNodeIdsOfCell(cellId,conn);
699 return convertIntArrToPyList2(conn);
702 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
704 std::vector<double> coo;
705 self->getCoordinatesOfNode(nodeId,coo);
706 return convertDblArrToPyList2(coo);
709 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
713 DataArrayDoubleTuple *aa;
714 std::vector<double> bb;
716 int spaceDim=self->getSpaceDimension();
717 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
718 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
719 self->scale(pointPtr,factor);
722 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
724 int spaceDim=self->getSpaceDimension();
725 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
726 self->getBoundingBox(tmp);
727 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
731 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
734 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
735 PyObject *ret=PyTuple_New(2);
736 PyObject *ret0Py=ret0?Py_True:Py_False;
738 PyTuple_SetItem(ret,0,ret0Py);
739 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
743 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
745 int szArr,sw,iTypppArr;
746 std::vector<int> stdvecTyyppArr;
747 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
748 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
749 if(sw==3)//DataArrayInt
751 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
752 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
753 std::string name=argpt->getName();
755 ret->setName(name.c_str());
757 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
760 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
762 int szArr,sw,iTypppArr;
763 std::vector<int> stdvecTyyppArr;
765 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
766 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
767 if(sw==3)//DataArrayInt
769 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
770 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
771 std::string name=argpt->getName();
773 ret->setName(name.c_str());
776 PyObject *res = PyList_New(2);
777 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
778 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
779 PyList_SetItem(res,0,obj0);
780 PyList_SetItem(res,1,obj1);
784 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
788 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
789 PyObject *res = PyTuple_New(2);
790 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
793 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
795 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
796 PyTuple_SetItem(res,0,obj0);
797 PyTuple_SetItem(res,1,obj1);
801 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
803 std::vector<int> vals=self->getDistributionOfTypes();
805 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
806 PyObject *ret=PyList_New((int)vals.size()/3);
807 for(int j=0;j<(int)vals.size()/3;j++)
809 PyObject *ret1=PyList_New(3);
810 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
811 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
812 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
813 PyList_SetItem(ret,j,ret1);
818 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
820 std::vector<int> code;
821 std::vector<const DataArrayInt *> idsPerType;
822 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
823 convertPyToNewIntArr4(li,1,3,code);
824 return self->checkTypeConsistencyAndContig(code,idsPerType);
827 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
829 std::vector<int> code;
830 std::vector<DataArrayInt *> idsInPflPerType;
831 std::vector<DataArrayInt *> idsPerType;
832 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
833 PyObject *ret=PyTuple_New(3);
836 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
837 PyObject *ret0=PyList_New((int)code.size()/3);
838 for(int j=0;j<(int)code.size()/3;j++)
840 PyObject *ret00=PyList_New(3);
841 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
842 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
843 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
844 PyList_SetItem(ret0,j,ret00);
846 PyTuple_SetItem(ret,0,ret0);
848 PyObject *ret1=PyList_New(idsInPflPerType.size());
849 for(std::size_t j=0;j<idsInPflPerType.size();j++)
850 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
851 PyTuple_SetItem(ret,1,ret1);
852 int n=idsPerType.size();
853 PyObject *ret2=PyList_New(n);
855 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
856 PyTuple_SetItem(ret,2,ret2);
860 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
864 DataArrayDoubleTuple *aa;
865 std::vector<double> bb;
867 int spaceDim=self->getSpaceDimension();
868 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
869 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
870 self->translate(vectorPtr);
873 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
875 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
878 DataArrayDoubleTuple *aa;
879 std::vector<double> bb;
881 int spaceDim=self->getSpaceDimension();
882 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
883 self->rotate(centerPtr,0,alpha);
886 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
888 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
890 DataArrayDouble *a,*a2;
891 DataArrayDoubleTuple *aa,*aa2;
892 std::vector<double> bb,bb2;
894 int spaceDim=self->getSpaceDimension();
895 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
896 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
897 self->rotate(centerPtr,vectorPtr,alpha);
900 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
902 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
903 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
904 PyObject *res=PyList_New(result.size());
905 for(int i=0;iL!=result.end(); i++, iL++)
906 PyList_SetItem(res,i,PyInt_FromLong(*iL));
910 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
912 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
913 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
914 return MEDCouplingMesh::MergeMeshes(tmp);
920 //== MEDCouplingMesh End
922 %include "NormalizedGeometricTypes"
923 %include "MEDCouplingNatureOfFieldEnum"
927 class MEDCouplingNatureOfField
930 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
931 static std::string GetReprNoThrow(NatureOfField nat);
932 static std::string GetAllPossibilitiesStr();
936 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
937 // include "MEDCouplingTimeDiscretization.i"
941 class MEDCouplingGaussLocalization
944 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
945 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
946 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
947 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
948 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
949 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
950 int getDimension() const throw(INTERP_KERNEL::Exception);
951 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
952 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
953 void checkCoherency() const throw(INTERP_KERNEL::Exception);
954 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
956 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
957 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
958 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
959 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
960 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
961 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
962 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
963 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
964 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
965 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
966 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
967 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
969 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
973 %include "MEDCouplingFieldDiscretization.i"
975 //== MEDCouplingPointSet
979 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
982 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
983 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
984 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
985 void zipCoords() throw(INTERP_KERNEL::Exception);
986 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
987 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
988 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
989 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
990 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
991 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
992 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
993 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
994 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
995 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
996 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
997 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
998 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
999 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
1000 virtual DataArrayInt *findBoundaryNodes() const;
1001 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
1002 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
1003 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1004 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1005 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1006 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1009 std::string __str__() const throw(INTERP_KERNEL::Exception)
1011 return self->simpleRepr();
1014 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1017 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1018 PyObject *res = PyList_New(2);
1019 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1020 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1024 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1026 DataArrayInt *comm, *commIndex;
1027 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1028 PyObject *res = PyList_New(2);
1029 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1030 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1034 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1036 DataArrayDouble *ret1=self->getCoords();
1039 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1042 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1044 int szArr,sw,iTypppArr;
1045 std::vector<int> stdvecTyyppArr;
1046 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1047 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1048 if(sw==3)//DataArrayInt
1050 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1051 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1052 std::string name=argpt->getName();
1054 ret->setName(name.c_str());
1056 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1059 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1061 int szArr,sw,iTypppArr;
1062 std::vector<int> stdvecTyyppArr;
1063 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1064 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1065 if(sw==3)//DataArrayInt
1067 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1068 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1069 std::string name=argpt->getName();
1071 ret->setName(name.c_str());
1073 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1076 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1078 int szArr,sw,iTypppArr;
1079 std::vector<int> stdvecTyyppArr;
1080 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1081 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1082 if(sw==3)//DataArrayInt
1084 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1085 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1086 std::string name=argpt->getName();
1088 ret->setName(name.c_str());
1090 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1093 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1095 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1096 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1099 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1101 int szArr,sw,iTypppArr;
1102 std::vector<int> stdvecTyyppArr;
1103 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1104 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1105 if(sw==3)//DataArrayInt
1107 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1108 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1109 std::string name=argpt->getName();
1111 ret->setName(name.c_str());
1113 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1116 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1118 int szArr,sw,iTypppArr;
1119 std::vector<int> stdvecTyyppArr;
1120 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1121 self->renumberNodes(tmp,newNbOfNodes);
1124 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1126 int szArr,sw,iTypppArr;
1127 std::vector<int> stdvecTyyppArr;
1128 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1129 self->renumberNodes2(tmp,newNbOfNodes);
1132 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1134 int spaceDim=self->getSpaceDimension();
1136 DataArrayDouble *a,*a2;
1137 DataArrayDoubleTuple *aa,*aa2;
1138 std::vector<double> bb,bb2;
1140 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1141 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1142 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1143 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1144 std::vector<int> nodes;
1145 self->findNodesOnLine(p,v,eps,nodes);
1146 DataArrayInt *ret=DataArrayInt::New();
1147 ret->alloc((int)nodes.size(),1);
1148 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1149 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1151 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1153 int spaceDim=self->getSpaceDimension();
1155 DataArrayDouble *a,*a2;
1156 DataArrayDoubleTuple *aa,*aa2;
1157 std::vector<double> bb,bb2;
1159 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1160 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1161 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1162 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1163 std::vector<int> nodes;
1164 self->findNodesOnPlane(p,v,eps,nodes);
1165 DataArrayInt *ret=DataArrayInt::New();
1166 ret->alloc((int)nodes.size(),1);
1167 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1168 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1171 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1175 DataArrayDoubleTuple *aa;
1176 std::vector<double> bb;
1178 int spaceDim=self->getSpaceDimension();
1179 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1180 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1181 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1182 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1185 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1187 DataArrayInt *c=0,*cI=0;
1191 DataArrayDoubleTuple *aa;
1192 std::vector<double> bb;
1194 int spaceDim=self->getSpaceDimension();
1195 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1196 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1197 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1198 PyObject *ret=PyTuple_New(2);
1199 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1200 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1204 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1206 DataArrayInt *c=0,*cI=0;
1207 int spaceDim=self->getSpaceDimension();
1210 DataArrayDoubleTuple *aa;
1211 std::vector<double> bb;
1214 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1215 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1217 PyObject *ret=PyTuple_New(2);
1218 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1219 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1223 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1227 DataArrayDoubleTuple *aa;
1228 std::vector<double> bb;
1230 int spaceDim=self->getSpaceDimension();
1231 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1232 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1234 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1235 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1238 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1242 std::vector<int> multiVal;
1243 std::pair<int, std::pair<int,int> > slic;
1244 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1245 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1249 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1251 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1253 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1255 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1259 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1261 DataArrayInt *v0=0,*v1=0;
1262 self->findCommonCells(compType,startCellId,v0,v1);
1263 PyObject *res = PyList_New(2);
1264 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1265 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1270 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1273 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1274 if (!SWIG_IsOK(res1))
1277 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1278 self->renumberNodesInConn(tmp);
1282 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1284 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1285 da2->checkAllocated();
1286 self->renumberNodesInConn(da2->getConstPointer());
1290 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1293 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1294 PyObject *ret=PyTuple_New(2);
1295 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1296 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1300 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1302 DataArrayInt *ret=0;
1304 int szArr,sw,iTypppArr;
1305 std::vector<int> stdvecTyyppArr;
1306 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1307 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1311 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1315 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1316 PyObject *res = PyList_New(3);
1317 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1318 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1319 PyList_SetItem(res,2,SWIG_From_int(ret2));
1323 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1327 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1328 PyObject *res = PyList_New(3);
1329 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1330 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1331 PyList_SetItem(res,2,SWIG_From_int(ret2));
1335 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1338 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1339 if (!SWIG_IsOK(res1))
1342 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1343 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1347 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1349 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1350 da2->checkAllocated();
1351 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1355 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1359 std::vector<int> multiVal;
1360 std::pair<int, std::pair<int,int> > slic;
1361 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1362 int nbc=self->getNumberOfCells();
1363 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1370 std::ostringstream oss;
1371 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1372 throw INTERP_KERNEL::Exception(oss.str().c_str());
1375 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1380 int tmp=nbc+singleVal;
1381 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1385 std::ostringstream oss;
1386 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1387 throw INTERP_KERNEL::Exception(oss.str().c_str());
1393 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1397 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1402 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1403 daIntTyypp->checkAllocated();
1404 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1407 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1411 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1414 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1415 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1416 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1417 for(int i=0;i<sz;i++)
1418 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1421 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1424 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1426 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1427 std::vector<double> val3;
1428 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1429 "Rotate2DAlg",2,true,nbNodes);
1431 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1432 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1435 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1438 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1439 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1440 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1441 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1442 for(int i=0;i<sz;i++)
1443 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1446 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1449 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1451 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1452 std::vector<double> val3;
1453 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1454 "Rotate3DAlg",3,true,nbNodes);
1456 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1457 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1458 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1463 //== MEDCouplingPointSet End
1465 class MEDCouplingUMeshCell
1468 INTERP_KERNEL::NormalizedCellType getType() const;
1471 std::string __str__() const throw(INTERP_KERNEL::Exception)
1473 return self->repr();
1476 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1479 const int *r=self->getAllConn(ret2);
1480 PyObject *ret=PyTuple_New(ret2);
1481 for(int i=0;i<ret2;i++)
1482 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1488 class MEDCouplingUMeshCellIterator
1495 MEDCouplingUMeshCell *ret=self->nextt();
1497 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1500 PyErr_SetString(PyExc_StopIteration,"No more data.");
1507 class MEDCouplingUMeshCellByTypeIterator
1510 ~MEDCouplingUMeshCellByTypeIterator();
1515 MEDCouplingUMeshCellEntry *ret=self->nextt();
1517 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1520 PyErr_SetString(PyExc_StopIteration,"No more data.");
1527 class MEDCouplingUMeshCellByTypeEntry
1530 ~MEDCouplingUMeshCellByTypeEntry();
1533 MEDCouplingUMeshCellByTypeIterator *__iter__()
1535 return self->iterator();
1540 class MEDCouplingUMeshCellEntry
1543 INTERP_KERNEL::NormalizedCellType getType() const;
1544 int getNumberOfElems() const;
1547 MEDCouplingUMeshCellIterator *__iter__()
1549 return self->iterator();
1554 //== MEDCouplingUMesh
1556 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1559 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1560 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1561 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1562 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1563 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1564 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1565 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1566 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1567 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1568 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1569 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1570 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1571 void computeTypes() throw(INTERP_KERNEL::Exception);
1572 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1573 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1575 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1576 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1577 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1578 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1579 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1580 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1581 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1582 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1583 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1584 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1585 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1586 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1587 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1588 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1589 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1590 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1591 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1592 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1593 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1594 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1595 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1596 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1597 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1598 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1599 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1600 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1601 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1602 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1603 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1604 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1605 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1606 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1607 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1608 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1609 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1611 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1612 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1613 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1614 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1615 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1616 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1617 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1618 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);
1619 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1620 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1621 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1622 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1623 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1625 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1627 return MEDCouplingUMesh::New();
1630 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1632 return MEDCouplingUMesh::New(meshName,meshDim);
1635 std::string __str__() const throw(INTERP_KERNEL::Exception)
1637 return self->simpleRepr();
1640 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1642 std::ostringstream oss;
1643 self->reprQuickOverview(oss);
1647 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1649 return self->cellIterator();
1652 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1654 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1655 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1656 PyObject *res=PyList_New(result.size());
1657 for(int i=0;iL!=result.end(); i++, iL++)
1658 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1662 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1666 std::vector<int> multiVal;
1667 std::pair<int, std::pair<int,int> > slic;
1668 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1669 int nbc=self->getNumberOfCells();
1670 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1677 std::ostringstream oss;
1678 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1679 throw INTERP_KERNEL::Exception(oss.str().c_str());
1683 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1690 int tmp=nbc+singleVal;
1691 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1696 std::ostringstream oss;
1697 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1698 throw INTERP_KERNEL::Exception(oss.str().c_str());
1704 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1710 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1711 daIntTyypp->checkAllocated();
1712 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1716 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1720 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1724 std::vector<int> multiVal;
1725 std::pair<int, std::pair<int,int> > slic;
1726 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1727 int nbc=self->getNumberOfCells();
1728 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1735 std::ostringstream oss;
1736 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1737 throw INTERP_KERNEL::Exception(oss.str().c_str());
1741 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1748 int tmp=nbc+singleVal;
1749 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1754 std::ostringstream oss;
1755 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1756 throw INTERP_KERNEL::Exception(oss.str().c_str());
1762 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1767 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1773 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1774 daIntTyypp->checkAllocated();
1775 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1779 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1783 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1785 int szArr,sw,iTypppArr;
1786 std::vector<int> stdvecTyyppArr;
1787 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1790 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1791 throw INTERP_KERNEL::Exception(oss.str().c_str());
1793 self->insertNextCell(type,size,tmp);
1796 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1798 int szArr,sw,iTypppArr;
1799 std::vector<int> stdvecTyyppArr;
1800 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1801 self->insertNextCell(type,szArr,tmp);
1804 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1806 DataArrayInt *ret=self->getNodalConnectivity();
1811 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1813 DataArrayInt *ret=self->getNodalConnectivityIndex();
1819 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1821 int szArr,sw,iTypppArr;
1822 std::vector<int> stdvecTyyppArr;
1823 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1824 int nbOfDepthPeelingPerformed=0;
1825 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1826 PyObject *res=PyTuple_New(2);
1827 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1828 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1832 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1834 DataArrayInt *v0=0,*v1=0;
1835 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1836 PyObject *res = PyList_New(2);
1837 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1838 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1842 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1846 DataArrayDoubleTuple *aa;
1847 std::vector<double> bb;
1849 int nbOfCompo=self->getSpaceDimension();
1850 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1853 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1854 PyObject *ret=PyTuple_New(2);
1855 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1856 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1860 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1862 DataArrayInt *ret1=0;
1863 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1864 PyObject *ret=PyTuple_New(2);
1865 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1866 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1870 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1873 DataArrayInt *ret1(0);
1874 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1875 PyObject *ret=PyTuple_New(3);
1876 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1877 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1878 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1882 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1884 std::vector<int> cells;
1885 self->checkButterflyCells(cells,eps);
1886 DataArrayInt *ret=DataArrayInt::New();
1887 ret->alloc((int)cells.size(),1);
1888 std::copy(cells.begin(),cells.end(),ret->getPointer());
1889 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1892 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1894 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1896 PyObject *ret = PyList_New(sz);
1897 for(int i=0;i<sz;i++)
1898 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1902 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1904 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1905 int sz=retCpp.size();
1906 PyObject *ret=PyList_New(sz);
1907 for(int i=0;i<sz;i++)
1908 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1912 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1915 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1916 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1917 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1920 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1923 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1924 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1928 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1931 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1932 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1936 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1938 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1939 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1940 PyObject *ret=PyTuple_New(3);
1941 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1942 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1947 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1949 DataArrayInt *tmp0=0,*tmp1=0;
1950 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1951 PyObject *ret=PyTuple_New(2);
1952 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1957 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1961 std::vector<int> multiVal;
1962 std::pair<int, std::pair<int,int> > slic;
1963 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1964 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1968 return self->duplicateNodes(&singleVal,&singleVal+1);
1970 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1972 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1974 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1978 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1982 std::vector<int> multiVal;
1983 std::pair<int, std::pair<int,int> > slic;
1984 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1985 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1989 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1991 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1993 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1995 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1999 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
2002 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
2003 DataArrayInt *tmp0,*tmp1=0;
2004 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2005 PyObject *ret=PyTuple_New(2);
2006 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2007 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2011 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2013 DataArrayInt *ret0=0,*ret1=0;
2014 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2015 PyObject *ret=PyTuple_New(2);
2016 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2017 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2021 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2023 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2024 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2025 DataArrayInt *ret1=0,*ret2=0;
2026 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2027 PyObject *ret=PyTuple_New(3);
2028 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2029 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2030 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2034 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2036 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2037 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2038 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2039 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2042 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2045 std::vector<const MEDCouplingUMesh *> meshes;
2046 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2047 std::vector<DataArrayInt *> corr;
2048 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2050 PyObject *ret1=PyList_New(sz);
2051 for(int i=0;i<sz;i++)
2052 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2053 PyObject *ret=PyList_New(2);
2054 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2055 PyList_SetItem(ret,1,ret1);
2059 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2061 std::vector<MEDCouplingUMesh *> meshes;
2062 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2063 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2066 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2068 std::vector<MEDCouplingUMesh *> meshes;
2069 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2070 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2073 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2077 std::vector<int> multiVal;
2078 std::pair<int, std::pair<int,int> > slic;
2079 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2081 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2082 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2086 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2088 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2090 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2092 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2096 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2098 DataArrayInt *arrOut=0,*arrIndexOut=0;
2101 std::vector<int> multiVal;
2102 std::pair<int, std::pair<int,int> > slic;
2103 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2105 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2106 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2111 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2116 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2121 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2125 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2127 PyObject *ret=PyTuple_New(2);
2128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2129 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2133 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2135 DataArrayInt *arrOut=0,*arrIndexOut=0;
2136 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2137 PyObject *ret=PyTuple_New(2);
2138 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2139 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2143 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2145 if(!PySlice_Check(slic))
2146 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2147 Py_ssize_t strt=2,stp=2,step=2;
2148 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2150 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2151 arrIndxIn->checkAllocated();
2152 if(arrIndxIn->getNumberOfComponents()!=1)
2153 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2154 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2155 DataArrayInt *arrOut=0,*arrIndexOut=0;
2156 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2157 PyObject *ret=PyTuple_New(2);
2158 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2163 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2164 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2165 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2167 DataArrayInt *arrOut=0,*arrIndexOut=0;
2170 std::vector<int> multiVal;
2171 std::pair<int, std::pair<int,int> > slic;
2172 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2174 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2175 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2180 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2185 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2190 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2194 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2196 PyObject *ret=PyTuple_New(2);
2197 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2202 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2203 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2207 std::vector<int> multiVal;
2208 std::pair<int, std::pair<int,int> > slic;
2209 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2211 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2212 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2217 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2222 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2227 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2231 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2235 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2239 DataArrayDoubleTuple *aa;
2240 std::vector<double> bb;
2242 int spaceDim=self->getSpaceDimension();
2243 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2244 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2246 std::vector<int> cells;
2247 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2248 DataArrayInt *ret=DataArrayInt::New();
2249 ret->alloc((int)cells.size(),1);
2250 std::copy(cells.begin(),cells.end(),ret->getPointer());
2251 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2254 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2258 DataArrayDoubleTuple *aa;
2259 std::vector<double> bb;
2261 int spaceDim=self->getSpaceDimension();
2262 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2263 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2264 self->orientCorrectly2DCells(v,polyOnly);
2267 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2269 std::vector<int> cells;
2270 self->arePolyhedronsNotCorrectlyOriented(cells);
2271 DataArrayInt *ret=DataArrayInt::New();
2272 ret->alloc((int)cells.size(),1);
2273 std::copy(cells.begin(),cells.end(),ret->getPointer());
2274 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2277 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2281 self->getFastAveragePlaneOfThis(vec,pos);
2283 std::copy(vec,vec+3,vals);
2284 std::copy(pos,pos+3,vals+3);
2285 return convertDblArrToPyListOfTuple(vals,3,2);
2288 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2290 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2291 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2292 return MEDCouplingUMesh::MergeUMeshes(tmp);
2295 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2298 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2299 PyObject *ret=PyTuple_New(2);
2300 PyObject *ret0Py=ret0?Py_True:Py_False;
2302 PyTuple_SetItem(ret,0,ret0Py);
2303 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2310 bool ret0=self->areCellsIncludedIn2(other,ret1);
2311 PyObject *ret=PyTuple_New(2);
2312 PyObject *ret0Py=ret0?Py_True:Py_False;
2314 PyTuple_SetItem(ret,0,ret0Py);
2315 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2319 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2321 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2322 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2323 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2324 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2325 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2326 PyObject *ret=PyTuple_New(5);
2327 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2328 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2329 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2330 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2335 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2337 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2339 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2340 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2341 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2342 PyObject *ret=PyTuple_New(5);
2343 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2344 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2345 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2346 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2351 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2353 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2354 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2355 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2357 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2358 PyObject *ret=PyTuple_New(5);
2359 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2360 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2361 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2362 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2367 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2369 DataArrayInt *neighbors=0,*neighborsIdx=0;
2370 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2371 PyObject *ret=PyTuple_New(2);
2372 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2377 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2379 DataArrayInt *neighbors=0,*neighborsIdx=0;
2380 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2381 PyObject *ret=PyTuple_New(2);
2382 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2387 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2389 DataArrayInt *neighbors=0,*neighborsIdx=0;
2390 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2391 PyObject *ret=PyTuple_New(2);
2392 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2397 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2399 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2400 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2401 DataArrayInt *d2,*d3,*d4,*dd5;
2402 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2403 PyObject *ret=PyTuple_New(7);
2404 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2407 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2408 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2409 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2410 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2414 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2417 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2418 da->checkAllocated();
2419 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2422 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2425 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2426 da->checkAllocated();
2427 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2430 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2433 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2434 da->checkAllocated();
2435 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2438 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2441 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2442 da->checkAllocated();
2443 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2444 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2445 PyObject *res = PyList_New(result.size());
2446 for (int i=0;iL!=result.end(); i++, iL++)
2447 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2451 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2454 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2455 da->checkAllocated();
2456 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2457 ret->setName(da->getName().c_str());
2461 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2463 DataArrayInt *cellNb1=0,*cellNb2=0;
2464 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2465 PyObject *ret=PyTuple_New(3);
2466 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2467 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2468 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2472 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2474 int spaceDim=self->getSpaceDimension();
2476 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2478 DataArrayDouble *a,*a2;
2479 DataArrayDoubleTuple *aa,*aa2;
2480 std::vector<double> bb,bb2;
2482 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2483 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2484 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2485 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2487 DataArrayInt *cellIds=0;
2488 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2489 PyObject *ret=PyTuple_New(2);
2490 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2491 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2495 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2497 int spaceDim=self->getSpaceDimension();
2499 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2501 DataArrayDouble *a,*a2;
2502 DataArrayDoubleTuple *aa,*aa2;
2503 std::vector<double> bb,bb2;
2505 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2506 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2507 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2508 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2510 DataArrayInt *cellIds=0;
2511 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2512 PyObject *ret=PyTuple_New(2);
2513 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2514 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2518 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2520 int spaceDim=self->getSpaceDimension();
2522 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2524 DataArrayDouble *a,*a2;
2525 DataArrayDoubleTuple *aa,*aa2;
2526 std::vector<double> bb,bb2;
2528 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2529 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2530 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2531 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2532 return self->getCellIdsCrossingPlane(orig,vect,eps);
2535 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2539 std::vector<int> pos2;
2540 DataArrayInt *pos3=0;
2541 DataArrayIntTuple *pos4=0;
2542 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2547 self->convertToPolyTypes(&pos1,&pos1+1);
2554 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2559 self->convertToPolyTypes(pos3->begin(),pos3->end());
2563 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2567 void convertAllToPoly();
2568 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2569 bool unPolyze() throw(INTERP_KERNEL::Exception);
2570 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2571 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2572 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2575 //== MEDCouplingUMesh End
2577 //== MEDCouplingExtrudedMesh
2579 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2582 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2583 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2585 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2587 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2590 std::string __str__() const throw(INTERP_KERNEL::Exception)
2592 return self->simpleRepr();
2595 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2597 std::ostringstream oss;
2598 self->reprQuickOverview(oss);
2602 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2604 MEDCouplingUMesh *ret=self->getMesh2D();
2607 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2609 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2611 MEDCouplingUMesh *ret=self->getMesh1D();
2614 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2616 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2618 DataArrayInt *ret=self->getMesh3DIds();
2621 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2626 //== MEDCouplingExtrudedMesh End
2628 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2631 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2632 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2633 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2634 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2635 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2636 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2639 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2641 int szArr,sw,iTypppArr;
2642 std::vector<int> stdvecTyyppArr;
2643 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2644 self->insertNextCell(tmp,tmp+szArr);
2647 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2649 DataArrayInt *ret=self->getNodalConnectivity();
2650 if(ret) ret->incrRef();
2654 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2656 std::vector< const MEDCoupling1GTUMesh *> parts;
2657 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2658 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2663 //== MEDCoupling1SGTUMesh
2665 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2668 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2669 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2670 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2671 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2672 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2673 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2674 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2675 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2679 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2681 return MEDCoupling1SGTUMesh::New(name,type);
2684 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2686 return MEDCoupling1SGTUMesh::New(m);
2689 std::string __str__() const throw(INTERP_KERNEL::Exception)
2691 return self->simpleRepr();
2694 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2696 std::ostringstream oss;
2697 self->reprQuickOverview(oss);
2701 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2703 DataArrayInt *cellPerm(0),*nodePerm(0);
2704 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2705 PyObject *ret(PyTuple_New(3));
2706 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2707 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2708 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2712 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2714 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2715 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2716 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2719 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2721 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2722 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2723 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2728 //== MEDCoupling1SGTUMesh End
2730 //== MEDCoupling1DGTUMesh
2732 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2735 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2736 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2737 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2738 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2739 bool isPacked() const throw(INTERP_KERNEL::Exception);
2742 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2744 return MEDCoupling1DGTUMesh::New(name,type);
2747 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2749 return MEDCoupling1DGTUMesh::New(m);
2752 std::string __str__() const throw(INTERP_KERNEL::Exception)
2754 return self->simpleRepr();
2757 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2759 std::ostringstream oss;
2760 self->reprQuickOverview(oss);
2764 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2766 DataArrayInt *ret=self->getNodalConnectivityIndex();
2767 if(ret) ret->incrRef();
2771 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2773 DataArrayInt *ret1=0,*ret2=0;
2774 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2775 PyObject *ret0Py=ret0?Py_True:Py_False;
2777 PyObject *ret=PyTuple_New(3);
2778 PyTuple_SetItem(ret,0,ret0Py);
2779 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2780 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2784 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2787 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2788 PyObject *ret=PyTuple_New(2);
2789 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2790 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2791 PyTuple_SetItem(ret,1,ret1Py);
2795 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2797 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2798 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2799 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2802 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2804 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2805 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2806 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2809 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2811 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2812 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2813 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2818 //== MEDCoupling1DGTUMeshEnd
2820 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2823 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2824 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2825 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2826 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2827 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2828 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2829 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2830 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2831 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2832 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2833 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2836 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2838 int tmpp1=-1,tmpp2=-1;
2839 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2840 std::vector< std::pair<int,int> > inp;
2844 for(int i=0;i<tmpp1;i++)
2845 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2850 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2851 inp.resize(tmpp1/2);
2852 for(int i=0;i<tmpp1/2;i++)
2853 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2856 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2857 return self->buildStructuredSubPart(inp);
2860 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2862 std::vector< std::pair<int,int> > inp;
2863 convertPyToVectorPairInt(part,inp);
2865 int szArr,sw,iTypppArr;
2866 std::vector<int> stdvecTyyppArr;
2867 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2868 std::vector<int> tmp5(tmp4,tmp4+szArr);
2870 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2873 static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector<int>& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2875 std::vector< std::pair<int,int> > inp;
2876 convertPyToVectorPairInt(partCompactFormat,inp);
2877 return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp);
2880 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2882 std::vector< std::pair<int,int> > inp;
2883 convertPyToVectorPairInt(part,inp);
2884 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2887 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2889 int szArr,sw,iTypppArr;
2890 std::vector<int> stdvecTyyppArr;
2891 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2892 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2895 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2897 int szArr,sw,iTypppArr;
2898 std::vector<int> stdvecTyyppArr;
2899 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2900 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2903 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2905 std::vector< std::pair<int,int> > inp;
2906 convertPyToVectorPairInt(partCompactFormat,inp);
2907 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2910 static PyObject *GetCompactFrmtFromDimensions(const std::vector<int>& dims) throw(INTERP_KERNEL::Exception)
2912 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims));
2913 PyObject *retPy=PyList_New(ret.size());
2914 for(std::size_t i=0;i<ret.size();i++)
2916 PyObject *tmp=PyTuple_New(2);
2917 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2918 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2919 PyList_SetItem(retPy,i,tmp);
2924 static PyObject *IntersectRanges(PyObject *r1, PyObject *r2) throw(INTERP_KERNEL::Exception)
2926 std::vector< std::pair<int,int> > r1Cpp,r2Cpp;
2927 convertPyToVectorPairInt(r1,r1Cpp);
2928 convertPyToVectorPairInt(r2,r2Cpp);
2929 std::vector< std::pair<int,int> > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp));
2930 PyObject *retPy=PyList_New(ret.size());
2931 for(std::size_t i=0;i<ret.size();i++)
2933 PyObject *tmp=PyTuple_New(2);
2934 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2935 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2936 PyList_SetItem(retPy,i,tmp);
2941 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2943 int szArr,sw,iTypppArr;
2944 std::vector<int> stdvecTyyppArr;
2945 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2946 int szArr2,sw2,iTypppArr2;
2947 std::vector<int> stdvecTyyppArr2;
2948 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2949 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2950 std::vector< std::pair<int,int> > partCompactFormat;
2951 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2952 PyObject *ret=PyTuple_New(2);
2953 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2954 PyTuple_SetItem(ret,0,ret0Py);
2955 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2956 for(std::size_t i=0;i<partCompactFormat.size();i++)
2958 PyObject *tmp4=PyTuple_New(2);
2959 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2960 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2961 PyList_SetItem(ret1Py,i,tmp4);
2963 PyTuple_SetItem(ret,1,ret1Py);
2967 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs) throw(INTERP_KERNEL::Exception)
2969 std::vector< std::pair<int,int> > param0,param1,ret;
2970 convertPyToVectorPairInt(bigInAbs,param0);
2971 convertPyToVectorPairInt(partOfBigInAbs,param1);
2972 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret);
2973 PyObject *retPy(PyList_New(ret.size()));
2974 for(std::size_t i=0;i<ret.size();i++)
2976 PyObject *tmp(PyTuple_New(2));
2977 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2978 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2979 PyList_SetItem(retPy,i,tmp);
2984 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig) throw(INTERP_KERNEL::Exception)
2986 std::vector< std::pair<int,int> > param0,param1,ret;
2987 convertPyToVectorPairInt(bigInAbs,param0);
2988 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
2989 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret);
2990 PyObject *retPy(PyList_New(ret.size()));
2991 for(std::size_t i=0;i<ret.size();i++)
2993 PyObject *tmp(PyTuple_New(2));
2994 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2995 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2996 PyList_SetItem(retPy,i,tmp);
3003 //== MEDCouplingCMesh
3005 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3008 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
3009 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3010 MEDCouplingCMesh *clone(bool recDeepCpy) const;
3011 void setCoords(const DataArrayDouble *coordsX,
3012 const DataArrayDouble *coordsY=0,
3013 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
3014 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
3016 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
3018 return MEDCouplingCMesh::New();
3020 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3022 return MEDCouplingCMesh::New(meshName);
3024 std::string __str__() const throw(INTERP_KERNEL::Exception)
3026 return self->simpleRepr();
3028 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3030 std::ostringstream oss;
3031 self->reprQuickOverview(oss);
3034 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
3036 DataArrayDouble *ret=self->getCoordsAt(i);
3044 //== MEDCouplingCMesh End
3046 //== MEDCouplingCurveLinearMesh
3048 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3051 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3052 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3053 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3054 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3056 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3058 return MEDCouplingCurveLinearMesh::New();
3060 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3062 return MEDCouplingCurveLinearMesh::New(meshName);
3064 std::string __str__() const throw(INTERP_KERNEL::Exception)
3066 return self->simpleRepr();
3068 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3070 std::ostringstream oss;
3071 self->reprQuickOverview(oss);
3074 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3076 DataArrayDouble *ret=self->getCoords();
3081 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3083 int szArr,sw,iTypppArr;
3084 std::vector<int> stdvecTyyppArr;
3085 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3086 self->setNodeGridStructure(tmp,tmp+szArr);
3091 //== MEDCouplingCurveLinearMesh End
3093 //== MEDCouplingIMesh
3095 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3098 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3100 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3101 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3102 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3103 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3104 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3105 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3106 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3107 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3108 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3109 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3110 MEDCouplingIMesh *buildWithGhost(int ghostLev) const throw(INTERP_KERNEL::Exception);
3115 return MEDCouplingIMesh::New();
3117 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3119 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3120 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3121 const int *nodeStrctPtr(0);
3122 const double *originPtr(0),*dxyzPtr(0);
3124 std::vector<int> bb0;
3125 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3128 std::vector<double> bb,bb2;
3130 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3131 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3133 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3136 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3138 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3141 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3144 std::vector<int> bb0;
3145 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3146 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3149 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3151 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3154 DataArrayDoubleTuple *aa;
3155 std::vector<double> bb;
3157 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3158 self->setOrigin(originPtr,originPtr+nbTuples);
3161 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3163 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3166 DataArrayDoubleTuple *aa;
3167 std::vector<double> bb;
3169 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3170 self->setDXYZ(originPtr,originPtr+nbTuples);
3173 static void CondenseFineToCoarse(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA) throw(INTERP_KERNEL::Exception)
3175 std::vector< std::pair<int,int> > inp;
3176 convertPyToVectorPairInt(fineLocInCoarse,inp);
3177 MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA);
3180 static void CondenseFineToCoarseGhost(const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, DataArrayDouble *coarseDA, int ghostSize) throw(INTERP_KERNEL::Exception)
3182 std::vector< std::pair<int,int> > inp;
3183 convertPyToVectorPairInt(fineLocInCoarse,inp);
3184 MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize);
3187 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3189 std::vector< std::pair<int,int> > inp;
3190 convertPyToVectorPairInt(fineLocInCoarse,inp);
3191 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3194 static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts, int ghostSize) throw(INTERP_KERNEL::Exception)
3196 std::vector< std::pair<int,int> > inp;
3197 convertPyToVectorPairInt(fineLocInCoarse,inp);
3198 MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize);
3201 std::string __str__() const throw(INTERP_KERNEL::Exception)
3203 return self->simpleRepr();
3205 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3207 std::ostringstream oss;
3208 self->reprQuickOverview(oss);
3214 //== MEDCouplingIMesh End
3218 namespace ParaMEDMEM
3220 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3223 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3224 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3225 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3226 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3227 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3228 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3229 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3230 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3231 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3232 std::string getName() const throw(INTERP_KERNEL::Exception);
3233 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3234 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3235 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3236 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3237 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3238 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3239 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3240 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3241 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3242 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3243 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3244 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3245 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3246 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3247 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3248 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3250 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3252 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3255 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3258 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3260 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3263 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3266 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3268 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3269 return convertIntArrToPyList3(ret);
3272 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3275 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3276 PyObject *ret=PyTuple_New(2);
3277 PyObject *ret0Py=ret0?Py_True:Py_False;
3279 PyTuple_SetItem(ret,0,ret0Py);
3280 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3284 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3286 DataArrayInt *ret1=0;
3287 MEDCouplingMesh *ret0=0;
3289 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3290 if (!SWIG_IsOK(res1))
3293 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3294 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3298 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3300 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3301 da2->checkAllocated();
3302 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3304 PyObject *res = PyList_New(2);
3305 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3306 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3310 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3312 DataArrayInt *ret1=0;
3314 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3315 PyObject *res=PyTuple_New(2);
3316 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3318 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3321 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3322 PyTuple_SetItem(res,1,res1);
3327 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3330 int v0; std::vector<int> v1;
3331 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3332 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3335 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3336 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3339 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3340 if (!SWIG_IsOK(res1))
3343 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3344 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3348 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3350 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3351 da2->checkAllocated();
3352 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3356 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3358 std::vector<int> tmp;
3359 self->getCellIdsHavingGaussLocalization(locId,tmp);
3360 DataArrayInt *ret=DataArrayInt::New();
3361 ret->alloc((int)tmp.size(),1);
3362 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3363 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3366 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3368 std::vector<int> inp0;
3369 convertPyToNewIntArr4(code,1,3,inp0);
3370 std::vector<const DataArrayInt *> inp1;
3371 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3372 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3377 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3380 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3381 static MEDCouplingFieldTemplate *New(TypeOfField type);
3382 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3383 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3386 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3388 return MEDCouplingFieldTemplate::New(f);
3391 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3393 return MEDCouplingFieldTemplate::New(type);
3396 std::string __str__() const throw(INTERP_KERNEL::Exception)
3398 return self->simpleRepr();
3401 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3403 std::ostringstream oss;
3404 self->reprQuickOverview(oss);
3410 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3413 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3414 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3415 void setTimeUnit(const std::string& unit);
3416 std::string getTimeUnit() const;
3417 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3418 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3419 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3420 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3421 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3422 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3423 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3424 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3425 MEDCouplingFieldDouble *deepCpy() const;
3426 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3427 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3428 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3429 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3430 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3431 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3432 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3433 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3434 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3435 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3436 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3437 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3438 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3439 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3440 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3441 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3442 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3443 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3444 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3445 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3446 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3447 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3448 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3449 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3450 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3451 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3452 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3453 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3454 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3455 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3456 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3457 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3458 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3459 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3460 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3461 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3462 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3463 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3464 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3465 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3466 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3467 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3468 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3469 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3470 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3471 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3472 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3473 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3474 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3475 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3476 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3477 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3478 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3479 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3480 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3481 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3482 double getMinValue() const throw(INTERP_KERNEL::Exception);
3483 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3484 double norm2() const throw(INTERP_KERNEL::Exception);
3485 double normMax() const throw(INTERP_KERNEL::Exception);
3486 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3487 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3488 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3489 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3490 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3491 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3492 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3493 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3494 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3495 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3496 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3497 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3498 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3499 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3500 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3501 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3502 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3503 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3504 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3505 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3506 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3507 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3509 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3511 return MEDCouplingFieldDouble::New(type,td);
3514 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3516 return MEDCouplingFieldDouble::New(ft,td);
3519 std::string __str__() const throw(INTERP_KERNEL::Exception)
3521 return self->simpleRepr();
3524 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3526 std::ostringstream oss;
3527 self->reprQuickOverview(oss);
3531 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3533 DataArrayDouble *ret=self->getArray();
3539 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3541 std::vector<DataArrayDouble *> arrs=self->getArrays();
3542 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3546 PyObject *ret=PyTuple_New(sz);
3547 for(int i=0;i<sz;i++)
3550 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3552 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3557 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3559 std::vector<const DataArrayDouble *> tmp;
3560 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3562 std::vector<DataArrayDouble *> arrs(sz);
3563 for(int i=0;i<sz;i++)
3564 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3565 self->setArrays(arrs);
3568 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3570 DataArrayDouble *ret=self->getEndArray();
3576 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3580 DataArrayDoubleTuple *aa;
3581 std::vector<double> bb;
3583 const MEDCouplingMesh *mesh=self->getMesh();
3585 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3586 int spaceDim=mesh->getSpaceDimension();
3587 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3588 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3590 int sz=self->getNumberOfComponents();
3591 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3592 self->getValueOn(spaceLoc,res);
3593 return convertDblArrToPyList(res,sz);
3596 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3598 int sz=self->getNumberOfComponents();
3599 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3600 self->getValueOnPos(i,j,k,res);
3601 return convertDblArrToPyList(res,sz);
3604 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3606 const MEDCouplingMesh *mesh(self->getMesh());
3608 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3611 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3612 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3613 mesh->getSpaceDimension(),true,nbPts);
3614 return self->getValueOnMulti(inp,nbPts);
3617 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3621 DataArrayDoubleTuple *aa;
3622 std::vector<double> bb;
3624 const MEDCouplingMesh *mesh=self->getMesh();
3626 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3627 int spaceDim=mesh->getSpaceDimension();
3628 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3629 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3632 int sz=self->getNumberOfComponents();
3633 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3634 self->getValueOn(spaceLoc,time,res);
3635 return convertDblArrToPyList(res,sz);
3638 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3640 if(self->getArray()!=0)
3641 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3645 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3646 self->setArray(arr);
3650 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3653 double tmp0=self->getTime(tmp1,tmp2);
3654 PyObject *res = PyList_New(3);
3655 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3656 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3657 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3661 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3664 double tmp0=self->getStartTime(tmp1,tmp2);
3665 PyObject *res = PyList_New(3);
3666 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3667 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3668 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3672 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3675 double tmp0=self->getEndTime(tmp1,tmp2);
3676 PyObject *res = PyList_New(3);
3677 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3678 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3679 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3682 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3684 int sz=self->getNumberOfComponents();
3685 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3686 self->accumulate(tmp);
3687 return convertDblArrToPyList(tmp,sz);
3689 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3691 int sz=self->getNumberOfComponents();
3692 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3693 self->integral(isWAbs,tmp);
3694 return convertDblArrToPyList(tmp,sz);
3696 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3698 int sz=self->getNumberOfComponents();
3699 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3700 self->getWeightedAverageValue(tmp,isWAbs);
3701 return convertDblArrToPyList(tmp,sz);
3703 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3705 int sz=self->getNumberOfComponents();
3706 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3708 return convertDblArrToPyList(tmp,sz);
3710 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3712 int sz=self->getNumberOfComponents();
3713 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3715 return convertDblArrToPyList(tmp,sz);
3717 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3719 int szArr,sw,iTypppArr;
3720 std::vector<int> stdvecTyyppArr;
3721 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3722 self->renumberCells(tmp,check);
3725 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3727 int szArr,sw,iTypppArr;
3728 std::vector<int> stdvecTyyppArr;
3729 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3730 self->renumberCellsWithoutMesh(tmp,check);
3733 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3735 int szArr,sw,iTypppArr;
3736 std::vector<int> stdvecTyyppArr;
3737 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3738 self->renumberNodes(tmp,eps);
3741 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3743 int szArr,sw,iTypppArr;
3744 std::vector<int> stdvecTyyppArr;
3745 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3746 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3749 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3753 std::vector<int> multiVal;
3754 std::pair<int, std::pair<int,int> > slic;
3755 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3756 const MEDCouplingMesh *mesh=self->getMesh();
3758 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3759 int nbc=mesh->getNumberOfCells();
3760 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3767 std::ostringstream oss;
3768 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3769 throw INTERP_KERNEL::Exception(oss.str().c_str());
3772 return self->buildSubPart(&singleVal,&singleVal+1);
3777 int tmp=nbc+singleVal;
3778 return self->buildSubPart(&tmp,&tmp+1);
3782 std::ostringstream oss;
3783 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3784 throw INTERP_KERNEL::Exception(oss.str().c_str());
3790 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3794 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3799 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3800 daIntTyypp->checkAllocated();
3801 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3804 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3808 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3810 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";
3811 if(PyTuple_Check(li))
3813 Py_ssize_t sz=PyTuple_Size(li);
3815 throw INTERP_KERNEL::Exception(msg);
3816 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3819 std::vector<int> multiVal;
3820 std::pair<int, std::pair<int,int> > slic;
3821 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3822 if(!self->getArray())
3823 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3825 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3826 catch(INTERP_KERNEL::Exception& e)
3827 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3828 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3829 DataArrayDouble *ret0Arr=ret0->getArray();
3831 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3836 std::vector<int> v2(1,singleVal);
3837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3838 ret0->setArray(aarr);
3843 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3844 ret0->setArray(aarr);
3849 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3850 std::vector<int> v2(nbOfComp);
3851 for(int i=0;i<nbOfComp;i++)
3852 v2[i]=slic.first+i*slic.second.second;
3853 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3854 ret0->setArray(aarr);
3858 throw INTERP_KERNEL::Exception(msg);
3863 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3866 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3869 double r1=self->getMaxValue2(tmp);
3870 PyObject *ret=PyTuple_New(2);
3871 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3872 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3876 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3879 double r1=self->getMinValue2(tmp);
3880 PyObject *ret=PyTuple_New(2);
3881 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3882 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3886 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3888 std::vector<int> tmp;
3889 convertPyToNewIntArr3(li,tmp);
3890 return self->keepSelectedComponents(tmp);
3893 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3895 std::vector<int> tmp;
3896 convertPyToNewIntArr3(li,tmp);
3897 self->setSelectedComponents(f,tmp);
3900 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3903 DataArrayDouble *a,*a2;
3904 DataArrayDoubleTuple *aa,*aa2;
3905 std::vector<double> bb,bb2;
3908 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3909 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3910 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3911 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3913 return self->extractSlice3D(orig,vect,eps);
3916 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3921 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3923 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3926 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3928 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.";
3929 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3932 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3934 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3936 return (*self)-(*other);
3938 throw INTERP_KERNEL::Exception(msg);
3943 DataArrayDoubleTuple *aa;
3944 std::vector<double> bb;
3946 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3951 if(!self->getArray())
3952 throw INTERP_KERNEL::Exception(msg2);
3953 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3954 ret->applyLin(1.,-val);
3955 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3956 ret2->setArray(ret);
3961 if(!self->getArray())
3962 throw INTERP_KERNEL::Exception(msg2);
3963 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3964 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3965 ret2->setArray(ret);
3970 if(!self->getArray())
3971 throw INTERP_KERNEL::Exception(msg2);
3972 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3973 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3974 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3975 ret2->setArray(ret);
3980 if(!self->getArray())
3981 throw INTERP_KERNEL::Exception(msg2);
3982 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3983 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3984 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3985 ret2->setArray(ret);
3989 { throw INTERP_KERNEL::Exception(msg); }
3993 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3995 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3998 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4000 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
4003 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4005 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
4008 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 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.";
4011 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
4014 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4016 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4018 return (*self)/(*other);
4020 throw INTERP_KERNEL::Exception(msg);
4025 DataArrayDoubleTuple *aa;
4026 std::vector<double> bb;
4028 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4034 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
4035 if(!self->getArray())
4036 throw INTERP_KERNEL::Exception(msg2);
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4038 ret->applyLin(1./val,0);
4039 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4040 ret2->setArray(ret);
4045 if(!self->getArray())
4046 throw INTERP_KERNEL::Exception(msg2);
4047 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
4048 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4049 ret2->setArray(ret);
4054 if(!self->getArray())
4055 throw INTERP_KERNEL::Exception(msg2);
4056 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4058 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4059 ret2->setArray(ret);
4064 if(!self->getArray())
4065 throw INTERP_KERNEL::Exception(msg2);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4067 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4068 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4069 ret2->setArray(ret);
4073 { throw INTERP_KERNEL::Exception(msg); }
4077 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4079 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4082 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4084 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.";
4085 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4088 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4090 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4092 return (*self)^(*other);
4094 throw INTERP_KERNEL::Exception(msg);
4099 DataArrayDoubleTuple *aa;
4100 std::vector<double> bb;
4102 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4107 if(!self->getArray())
4108 throw INTERP_KERNEL::Exception(msg2);
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4111 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4112 ret2->setArray(ret);
4117 if(!self->getArray())
4118 throw INTERP_KERNEL::Exception(msg2);
4119 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4120 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4121 ret2->setArray(ret);
4126 if(!self->getArray())
4127 throw INTERP_KERNEL::Exception(msg2);
4128 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4129 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4130 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4131 ret2->setArray(ret);
4136 if(!self->getArray())
4137 throw INTERP_KERNEL::Exception(msg2);
4138 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4139 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4140 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4141 ret2->setArray(ret);
4145 { throw INTERP_KERNEL::Exception(msg); }
4149 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4151 return self->negate();
4154 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4156 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.";
4157 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4160 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4162 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4166 Py_XINCREF(trueSelf);
4170 throw INTERP_KERNEL::Exception(msg);
4175 DataArrayDoubleTuple *aa;
4176 std::vector<double> bb;
4178 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4183 if(!self->getArray())
4184 throw INTERP_KERNEL::Exception(msg2);
4185 self->getArray()->applyLin(1.,val);
4186 Py_XINCREF(trueSelf);
4191 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4194 Py_XINCREF(trueSelf);
4199 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4200 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4201 ret2->setArray(aaa);
4203 Py_XINCREF(trueSelf);
4208 if(!self->getArray())
4209 throw INTERP_KERNEL::Exception(msg2);
4210 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4211 self->getArray()->addEqual(aaa);
4212 Py_XINCREF(trueSelf);
4216 { throw INTERP_KERNEL::Exception(msg); }
4220 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4222 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.";
4223 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4226 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4228 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4232 Py_XINCREF(trueSelf);
4236 throw INTERP_KERNEL::Exception(msg);
4241 DataArrayDoubleTuple *aa;
4242 std::vector<double> bb;
4244 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4249 if(!self->getArray())
4250 throw INTERP_KERNEL::Exception(msg2);
4251 self->getArray()->applyLin(1.,-val);
4252 Py_XINCREF(trueSelf);
4257 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4260 Py_XINCREF(trueSelf);
4265 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4266 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4267 ret2->setArray(aaa);
4269 Py_XINCREF(trueSelf);
4274 if(!self->getArray())
4275 throw INTERP_KERNEL::Exception(msg2);
4276 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4277 self->getArray()->substractEqual(aaa);
4278 Py_XINCREF(trueSelf);
4282 { throw INTERP_KERNEL::Exception(msg); }
4286 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4288 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.";
4289 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4292 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4294 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4298 Py_XINCREF(trueSelf);
4302 throw INTERP_KERNEL::Exception(msg);
4307 DataArrayDoubleTuple *aa;
4308 std::vector<double> bb;
4310 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4315 if(!self->getArray())
4316 throw INTERP_KERNEL::Exception(msg2);
4317 self->getArray()->applyLin(val,0);
4318 Py_XINCREF(trueSelf);
4323 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4326 Py_XINCREF(trueSelf);
4331 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4332 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4333 ret2->setArray(aaa);
4335 Py_XINCREF(trueSelf);
4340 if(!self->getArray())
4341 throw INTERP_KERNEL::Exception(msg2);
4342 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4343 self->getArray()->multiplyEqual(aaa);
4344 Py_XINCREF(trueSelf);
4348 { throw INTERP_KERNEL::Exception(msg); }
4352 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4354 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.";
4355 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4358 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4360 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4364 Py_XINCREF(trueSelf);
4368 throw INTERP_KERNEL::Exception(msg);
4373 DataArrayDoubleTuple *aa;
4374 std::vector<double> bb;
4376 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4382 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4383 if(!self->getArray())
4384 throw INTERP_KERNEL::Exception(msg2);
4385 self->getArray()->applyLin(1./val,0);
4386 Py_XINCREF(trueSelf);
4391 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4394 Py_XINCREF(trueSelf);
4399 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4400 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4401 ret2->setArray(aaa);
4403 Py_XINCREF(trueSelf);
4408 if(!self->getArray())
4409 throw INTERP_KERNEL::Exception(msg2);
4410 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4411 self->getArray()->divideEqual(aaa);
4412 Py_XINCREF(trueSelf);
4416 { throw INTERP_KERNEL::Exception(msg); }
4420 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4422 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.";
4423 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4426 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4428 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4432 Py_XINCREF(trueSelf);
4436 throw INTERP_KERNEL::Exception(msg);
4441 DataArrayDoubleTuple *aa;
4442 std::vector<double> bb;
4444 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4449 if(!self->getArray())
4450 throw INTERP_KERNEL::Exception(msg2);
4451 self->getArray()->applyPow(val);
4452 Py_XINCREF(trueSelf);
4457 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4460 Py_XINCREF(trueSelf);
4465 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4466 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4467 ret2->setArray(aaa);
4469 Py_XINCREF(trueSelf);
4474 if(!self->getArray())
4475 throw INTERP_KERNEL::Exception(msg2);
4476 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4477 self->getArray()->powEqual(aaa);
4478 Py_XINCREF(trueSelf);
4482 { throw INTERP_KERNEL::Exception(msg); }
4486 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4488 std::vector<const MEDCouplingFieldDouble *> tmp;
4489 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4490 return MEDCouplingFieldDouble::MergeFields(tmp);
4493 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4495 std::vector<const MEDCouplingFieldDouble *> tmp;
4496 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4497 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4502 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4505 int getNumberOfFields() const;
4506 MEDCouplingMultiFields *deepCpy() const;
4507 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4508 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4509 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4510 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4511 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4514 std::string __str__() const throw(INTERP_KERNEL::Exception)
4516 return self->simpleRepr();
4518 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4520 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4521 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4523 std::vector<MEDCouplingFieldDouble *> fs(sz);
4524 for(int i=0;i<sz;i++)
4525 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4526 return MEDCouplingMultiFields::New(fs);
4528 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4530 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4531 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4533 std::vector<MEDCouplingFieldDouble *> fs(sz);
4534 for(int i=0;i<sz;i++)
4535 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4536 return MEDCouplingMultiFields::New(fs);
4538 PyObject *getFields() const
4540 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4541 int sz=fields.size();
4542 PyObject *res = PyList_New(sz);
4543 for(int i=0;i<sz;i++)
4547 fields[i]->incrRef();
4548 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4552 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4557 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4559 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4563 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4566 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4568 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4570 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4572 PyObject *res = PyList_New(sz);
4573 for(int i=0;i<sz;i++)
4578 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4582 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4587 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4589 std::vector<int> refs;
4590 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4592 PyObject *res = PyList_New(sz);
4593 for(int i=0;i<sz;i++)
4598 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4602 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4606 PyObject *ret=PyTuple_New(2);
4607 PyTuple_SetItem(ret,0,res);
4608 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4611 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4613 std::vector<DataArrayDouble *> ms=self->getArrays();
4615 PyObject *res = PyList_New(sz);
4616 for(int i=0;i<sz;i++)
4621 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4625 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4630 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4632 std::vector< std::vector<int> > refs;
4633 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4635 PyObject *res = PyList_New(sz);
4636 PyObject *res2 = PyList_New(sz);
4637 for(int i=0;i<sz;i++)
4642 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4646 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4648 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4651 PyObject *ret=PyTuple_New(2);
4652 PyTuple_SetItem(ret,0,res);
4653 PyTuple_SetItem(ret,1,res2);
4659 class MEDCouplingDefinitionTime
4662 MEDCouplingDefinitionTime();
4663 void assign(const MEDCouplingDefinitionTime& other);
4664 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4665 double getTimeResolution() const;
4666 std::vector<double> getHotSpotsTime() const;
4669 std::string __str__() const throw(INTERP_KERNEL::Exception)
4671 std::ostringstream oss;
4672 self->appendRepr(oss);
4676 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4678 int meshId,arrId,arrIdInField,fieldId;
4679 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4680 PyObject *res=PyList_New(4);
4681 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4682 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4683 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4684 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4688 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4690 int meshId,arrId,arrIdInField,fieldId;
4691 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4692 PyObject *res=PyList_New(4);
4693 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4694 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4695 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4696 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4702 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4705 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4706 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4710 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4712 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4713 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4715 std::vector<MEDCouplingFieldDouble *> fs(sz);
4716 for(int i=0;i<sz;i++)
4717 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4718 return MEDCouplingFieldOverTime::New(fs);
4720 std::string __str__() const throw(INTERP_KERNEL::Exception)
4722 return self->simpleRepr();
4724 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4726 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4727 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4729 std::vector<MEDCouplingFieldDouble *> fs(sz);
4730 for(int i=0;i<sz;i++)
4731 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4732 return MEDCouplingFieldOverTime::New(fs);
4737 class MEDCouplingCartesianAMRMesh;
4739 class MEDCouplingCartesianAMRPatch : public RefCountObject
4742 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4743 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4744 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4745 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4746 bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const throw(INTERP_KERNEL::Exception);
4749 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4751 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4752 return convertFromVectorPairInt(ret);
4755 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4757 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4763 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4765 std::vector< std::pair<int,int> > inp;
4766 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4767 self->addPatch(inp,factors);
4770 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4772 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4774 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4775 if(patchId==mesh->getNumberOfPatches())
4777 std::ostringstream oss;
4778 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4779 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4782 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4788 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4790 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4792 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4793 mesh->removePatch(patchId);
4796 int __len__() const throw(INTERP_KERNEL::Exception)
4798 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4800 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4801 return mesh->getNumberOfPatches();
4806 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4810 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4811 const std::vector<int>& getFactors() const throw(INTERP_KERNEL::Exception);
4812 void setFactors(const std::vector<int>& newFactors) throw(INTERP_KERNEL::Exception);
4813 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4814 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4815 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4816 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4817 bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const throw(INTERP_KERNEL::Exception);
4819 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4820 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4821 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4822 void removeAllPatches() throw(INTERP_KERNEL::Exception);
4823 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4824 void detachFromFather() throw(INTERP_KERNEL::Exception);
4825 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4826 DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4827 void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch) const throw(INTERP_KERNEL::Exception);
4828 void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const throw(INTERP_KERNEL::Exception);
4829 void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis) const throw(INTERP_KERNEL::Exception);
4830 void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev) const throw(INTERP_KERNEL::Exception);
4831 DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const throw(INTERP_KERNEL::Exception);
4834 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4836 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4837 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4838 const int *nodeStrctPtr(0);
4839 const double *originPtr(0),*dxyzPtr(0);
4841 std::vector<int> bb0;
4842 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4845 std::vector<double> bb,bb2;
4847 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4848 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4850 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4853 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4855 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4858 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4860 std::vector< std::pair<int,int> > inp;
4861 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4862 self->addPatch(inp,factors);
4865 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4867 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4873 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4875 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4881 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4883 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4889 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
4891 const MEDCouplingIMesh *ret(self->getImageMesh());
4894 return const_cast<MEDCouplingIMesh *>(ret);
4897 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4899 if(patchId==self->getNumberOfPatches())
4901 std::ostringstream oss;
4902 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4903 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4906 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4912 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4914 self->removePatch(patchId);
4917 int __len__() const throw(INTERP_KERNEL::Exception)
4919 return self->getNumberOfPatches();
4924 class DenseMatrix : public RefCountObject, public TimeLabel
4927 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4928 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4929 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
4930 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
4932 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
4933 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
4934 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
4935 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
4936 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4937 void transpose() throw(INTERP_KERNEL::Exception);
4939 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
4940 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
4941 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
4944 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4946 return DenseMatrix::New(nbRows,nbCols);
4949 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4951 return DenseMatrix::New(array,nbRows,nbCols);
4954 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
4957 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
4958 PyObject *ret=PyTuple_New(2);
4959 PyObject *ret0Py=ret0?Py_True:Py_False;
4961 PyTuple_SetItem(ret,0,ret0Py);
4962 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4966 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
4968 DataArrayDouble *ret(self->getData());
4974 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4976 return ParaMEDMEM::DenseMatrix::Add(self,other);
4979 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4981 return ParaMEDMEM::DenseMatrix::Substract(self,other);
4984 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4986 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4989 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
4991 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4994 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4996 self->addEqual(other);
4997 Py_XINCREF(trueSelf);
5001 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
5003 self->substractEqual(other);
5004 Py_XINCREF(trueSelf);
5008 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5010 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
5020 __filename=os.environ.get('PYTHONSTARTUP')
5021 if __filename and os.path.isfile(__filename):
5022 execfile(__filename)