1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingIMesh.hxx"
32 #include "MEDCouplingCurveLinearMesh.hxx"
33 #include "MEDCoupling1GTUMesh.hxx"
34 #include "MEDCouplingField.hxx"
35 #include "MEDCouplingFieldDouble.hxx"
36 #include "MEDCouplingFieldTemplate.hxx"
37 #include "MEDCouplingGaussLocalization.hxx"
38 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
39 #include "MEDCouplingMultiFields.hxx"
40 #include "MEDCouplingFieldOverTime.hxx"
41 #include "MEDCouplingDefinitionTime.hxx"
42 #include "MEDCouplingFieldDiscretization.hxx"
43 #include "MEDCouplingCartesianAMRMesh.hxx"
44 #include "MEDCouplingMatrix.hxx"
45 #include "MEDCouplingTypemaps.i"
47 #include "InterpKernelAutoPtr.hxx"
48 #include "BoxSplittingOptions.hxx"
50 using namespace ParaMEDMEM;
51 using namespace INTERP_KERNEL;
55 %template(ivec) std::vector<int>;
56 %template(dvec) std::vector<double>;
57 %template(svec) std::vector<std::string>;
60 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
62 $result=convertMesh($1,$owner);
65 %typemap(out) MEDCouplingMesh*
67 $result=convertMesh($1,$owner);
72 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
74 $result=convertMesh($1,$owner);
77 %typemap(out) MEDCouplingPointSet*
79 $result=convertMesh($1,$owner);
85 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
87 $result=convertMesh($1,$owner);
90 %typemap(out) MEDCoupling1GTUMesh*
92 $result=convertMesh($1,$owner);
97 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
99 $result=convertMesh($1,$owner);
102 %typemap(out) MEDCouplingStructuredMesh*
104 $result=convertMesh($1,$owner);
109 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
111 $result=convertFieldDiscretization($1,$owner);
114 %typemap(out) MEDCouplingFieldDiscretization*
116 $result=convertFieldDiscretization($1,$owner);
121 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
123 $result=convertMultiFields($1,$owner);
126 %typemap(out) MEDCouplingMultiFields*
128 $result=convertMultiFields($1,$owner);
133 %init %{ import_array(); %}
136 %feature("autodoc", "1");
137 %feature("docstring");
139 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
140 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
141 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
187 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
188 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
189 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
190 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
191 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
192 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
193 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
194 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
195 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
196 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
197 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
200 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
201 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
202 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
203 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
204 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
206 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
207 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
208 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
209 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
210 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
211 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
212 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
213 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
224 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
225 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
226 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
227 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
228 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::conformize2D;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::colinearize2D;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
268 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
269 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
270 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
271 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
272 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
273 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
274 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
275 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf2DMesh;
276 %newobject ParaMEDMEM::MEDCouplingUMesh::buildUnionOf3DMesh;
277 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTreeFast;
278 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic;
279 %newobject ParaMEDMEM::MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic;
280 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
281 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
282 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
283 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
284 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
285 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
286 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
287 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
288 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4;
289 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::sortHexa8EachOther;
290 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
291 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
292 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
293 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
294 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
295 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
296 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
297 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
298 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
299 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
300 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
301 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTSubLevelMesh;
302 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
303 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
304 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh;
305 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
306 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
307 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
308 %newobject ParaMEDMEM::MEDCouplingIMesh::New;
309 %newobject ParaMEDMEM::MEDCouplingIMesh::asSingleCell;
310 %newobject ParaMEDMEM::MEDCouplingIMesh::convertToCartesian;
311 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
312 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
313 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
314 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
315 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
316 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
317 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::getMesh;
318 %newobject ParaMEDMEM::MEDCouplingCartesianAMRPatch::__getitem__;
319 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::New;
320 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildUnstructured;
321 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::buildMeshFromPatchEnvelop;
322 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getImageMesh;
323 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getGodFather;
324 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getFather;
325 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::getPatch;
326 %newobject ParaMEDMEM::MEDCouplingCartesianAMRMesh::__getitem__;
327 %newobject ParaMEDMEM::DenseMatrix::New;
328 %newobject ParaMEDMEM::DenseMatrix::deepCpy;
329 %newobject ParaMEDMEM::DenseMatrix::shallowCpy;
330 %newobject ParaMEDMEM::DenseMatrix::getData;
331 %newobject ParaMEDMEM::DenseMatrix::matVecMult;
332 %newobject ParaMEDMEM::DenseMatrix::MatVecMult;
333 %newobject ParaMEDMEM::DenseMatrix::__add__;
334 %newobject ParaMEDMEM::DenseMatrix::__sub__;
335 %newobject ParaMEDMEM::DenseMatrix::__mul__;
337 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
338 %feature("unref") MEDCouplingMesh "$this->decrRef();"
339 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
340 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
341 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
342 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
343 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
344 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
345 %feature("unref") MEDCouplingIMesh "$this->decrRef();"
346 %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();"
347 %feature("unref") MEDCouplingField "$this->decrRef();"
348 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
349 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
350 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
351 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
352 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
353 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
354 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
355 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
356 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
357 %feature("unref") MEDCouplingCartesianAMRMesh "$this->decrRef();"
358 %feature("unref") MEDCouplingCartesianAMRPatch "$this->decrRef();"
359 %feature("unref") DenseMatrix "$this->decrRef();"
361 %rename(assign) *::operator=;
362 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
363 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
364 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
365 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
369 %rename (InterpKernelException) INTERP_KERNEL::Exception;
371 %include "MEDCouplingRefCountObject.i"
372 %include "MEDCouplingMemArray.i"
374 namespace INTERP_KERNEL
377 * \class BoxSplittingOptions
378 * Class defining the options for box splitting used for AMR algorithm like creation of patches following a criterion.
380 class BoxSplittingOptions
383 BoxSplittingOptions();
384 void init() throw(INTERP_KERNEL::Exception);
385 double getEffeciency() const throw(INTERP_KERNEL::Exception);
386 void setEffeciency(double effeciency) throw(INTERP_KERNEL::Exception);
387 double getEffeciencySnd() const throw(INTERP_KERNEL::Exception);
388 void setEffeciencySnd(double effeciencySnd) throw(INTERP_KERNEL::Exception);
389 int getMinCellDirection() const throw(INTERP_KERNEL::Exception);
390 void setMinCellDirection(int minCellDirection) throw(INTERP_KERNEL::Exception);
391 int getMaxCells() const throw(INTERP_KERNEL::Exception);
392 void setMaxCells(int maxCells) throw(INTERP_KERNEL::Exception);
393 void copyOptions(const BoxSplittingOptions & other) throw(INTERP_KERNEL::Exception);
394 std::string printOptions() const throw(INTERP_KERNEL::Exception);
397 std::string __str__() const throw(INTERP_KERNEL::Exception)
399 return self->printOptions();
421 CONST_ON_TIME_INTERVAL = 7
422 } TypeOfTimeDiscretization;
430 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
431 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11,
433 } MEDCouplingMeshType;
436 class DataArrayDouble;
437 class MEDCouplingUMesh;
438 class MEDCouplingFieldDouble;
440 %extend RefCountObject
442 std::string getHiddenCppPointer() const
444 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
449 %extend MEDCouplingGaussLocalization
451 std::string __str__() const throw(INTERP_KERNEL::Exception)
453 return self->getStringRepr();
456 std::string __repr__() const throw(INTERP_KERNEL::Exception)
458 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
459 oss << self->getStringRepr();
466 class MEDCouplingMesh : public RefCountObject, public TimeLabel
469 void setName(const std::string& name);
470 std::string getName() const;
471 void setDescription(const std::string& descr);
472 std::string getDescription() const;
473 void setTime(double val, int iteration, int order);
474 void setTimeUnit(const std::string& unit);
475 std::string getTimeUnit() const;
476 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
477 bool isStructured() const throw(INTERP_KERNEL::Exception);
478 virtual MEDCouplingMesh *deepCpy() const;
479 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
480 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
481 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
482 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
483 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
484 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
485 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
486 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
487 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
488 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
489 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
490 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
491 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
492 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
493 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
494 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
495 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
496 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
497 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
498 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
499 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
500 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
501 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
502 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
503 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
505 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
506 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
507 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
508 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
509 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
510 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
511 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
512 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
513 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
514 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
515 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
516 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
517 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
518 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
519 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
520 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
521 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
524 std::string __str__() const throw(INTERP_KERNEL::Exception)
526 return self->simpleRepr();
529 PyObject *getTime() throw(INTERP_KERNEL::Exception)
532 double tmp0=self->getTime(tmp1,tmp2);
533 PyObject *res = PyList_New(3);
534 PyList_SetItem(res,0,SWIG_From_double(tmp0));
535 PyList_SetItem(res,1,SWIG_From_int(tmp1));
536 PyList_SetItem(res,2,SWIG_From_int(tmp2));
540 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
544 DataArrayDoubleTuple *aa;
545 std::vector<double> bb;
547 int spaceDim=self->getSpaceDimension();
548 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
549 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
550 return self->getCellContainingPoint(pos,eps);
553 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
557 DataArrayDoubleTuple *aa;
558 std::vector<double> bb;
560 int spaceDim=self->getSpaceDimension();
561 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
562 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
563 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
564 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
565 PyObject *ret=PyTuple_New(2);
566 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
567 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
571 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
573 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
574 int spaceDim=self->getSpaceDimension();
576 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
577 if (!SWIG_IsOK(res1))
580 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
581 int nbOfPoints=size/spaceDim;
584 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
586 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
590 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
592 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
593 da2->checkAllocated();
594 int size=da2->getNumberOfTuples();
595 int nbOfCompo=da2->getNumberOfComponents();
596 if(nbOfCompo!=spaceDim)
598 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
600 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
602 PyObject *ret=PyTuple_New(2);
603 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
604 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
608 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
612 DataArrayDoubleTuple *aa;
613 std::vector<double> bb;
615 int spaceDim=self->getSpaceDimension();
616 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
617 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
618 std::vector<int> elts;
619 self->getCellsContainingPoint(pos,eps,elts);
620 DataArrayInt *ret=DataArrayInt::New();
621 ret->alloc((int)elts.size(),1);
622 std::copy(elts.begin(),elts.end(),ret->getPointer());
623 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
626 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
628 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
629 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
630 self->getReverseNodalConnectivity(d0,d1);
631 PyObject *ret=PyTuple_New(2);
632 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
633 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
637 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
640 int v0; std::vector<int> v1;
641 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
642 self->renumberCells(ids,check);
645 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
647 DataArrayInt *cellCor, *nodeCor;
648 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
649 PyObject *res = PyList_New(2);
650 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
651 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
655 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
657 DataArrayInt *cellCor=0,*nodeCor=0;
658 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
659 PyObject *res = PyList_New(2);
660 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
661 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
665 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
667 DataArrayInt *cellCor=0;
668 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
672 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
675 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
676 if (!SWIG_IsOK(res1))
679 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
680 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
684 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
686 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
687 da2->checkAllocated();
688 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
691 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
693 std::vector<int> conn;
694 self->getNodeIdsOfCell(cellId,conn);
695 return convertIntArrToPyList2(conn);
698 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
700 std::vector<double> coo;
701 self->getCoordinatesOfNode(nodeId,coo);
702 return convertDblArrToPyList2(coo);
705 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
709 DataArrayDoubleTuple *aa;
710 std::vector<double> bb;
712 int spaceDim=self->getSpaceDimension();
713 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
714 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
715 self->scale(pointPtr,factor);
718 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
720 int spaceDim=self->getSpaceDimension();
721 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
722 self->getBoundingBox(tmp);
723 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
727 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
730 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
731 PyObject *ret=PyTuple_New(2);
732 PyObject *ret0Py=ret0?Py_True:Py_False;
734 PyTuple_SetItem(ret,0,ret0Py);
735 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
739 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
741 int szArr,sw,iTypppArr;
742 std::vector<int> stdvecTyyppArr;
743 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
744 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
745 if(sw==3)//DataArrayInt
747 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
748 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
749 std::string name=argpt->getName();
751 ret->setName(name.c_str());
753 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
756 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
758 int szArr,sw,iTypppArr;
759 std::vector<int> stdvecTyyppArr;
761 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
762 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
763 if(sw==3)//DataArrayInt
765 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
766 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
767 std::string name=argpt->getName();
769 ret->setName(name.c_str());
772 PyObject *res = PyList_New(2);
773 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
774 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
775 PyList_SetItem(res,0,obj0);
776 PyList_SetItem(res,1,obj1);
780 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
784 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
785 PyObject *res = PyTuple_New(2);
786 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
789 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
791 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
792 PyTuple_SetItem(res,0,obj0);
793 PyTuple_SetItem(res,1,obj1);
797 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
799 std::vector<int> vals=self->getDistributionOfTypes();
801 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
802 PyObject *ret=PyList_New((int)vals.size()/3);
803 for(int j=0;j<(int)vals.size()/3;j++)
805 PyObject *ret1=PyList_New(3);
806 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
807 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
808 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
809 PyList_SetItem(ret,j,ret1);
814 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
816 std::vector<int> code;
817 std::vector<const DataArrayInt *> idsPerType;
818 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
819 convertPyToNewIntArr4(li,1,3,code);
820 return self->checkTypeConsistencyAndContig(code,idsPerType);
823 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
825 std::vector<int> code;
826 std::vector<DataArrayInt *> idsInPflPerType;
827 std::vector<DataArrayInt *> idsPerType;
828 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
829 PyObject *ret=PyTuple_New(3);
832 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
833 PyObject *ret0=PyList_New((int)code.size()/3);
834 for(int j=0;j<(int)code.size()/3;j++)
836 PyObject *ret00=PyList_New(3);
837 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
838 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
839 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
840 PyList_SetItem(ret0,j,ret00);
842 PyTuple_SetItem(ret,0,ret0);
844 PyObject *ret1=PyList_New(idsInPflPerType.size());
845 for(std::size_t j=0;j<idsInPflPerType.size();j++)
846 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
847 PyTuple_SetItem(ret,1,ret1);
848 int n=idsPerType.size();
849 PyObject *ret2=PyList_New(n);
851 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
852 PyTuple_SetItem(ret,2,ret2);
856 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
860 DataArrayDoubleTuple *aa;
861 std::vector<double> bb;
863 int spaceDim=self->getSpaceDimension();
864 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
865 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
866 self->translate(vectorPtr);
869 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
871 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
874 DataArrayDoubleTuple *aa;
875 std::vector<double> bb;
877 int spaceDim=self->getSpaceDimension();
878 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
879 self->rotate(centerPtr,0,alpha);
882 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
884 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
886 DataArrayDouble *a,*a2;
887 DataArrayDoubleTuple *aa,*aa2;
888 std::vector<double> bb,bb2;
890 int spaceDim=self->getSpaceDimension();
891 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
892 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
893 self->rotate(centerPtr,vectorPtr,alpha);
896 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
898 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
899 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
900 PyObject *res=PyList_New(result.size());
901 for(int i=0;iL!=result.end(); i++, iL++)
902 PyList_SetItem(res,i,PyInt_FromLong(*iL));
906 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
908 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
909 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
910 return MEDCouplingMesh::MergeMeshes(tmp);
916 //== MEDCouplingMesh End
918 %include "NormalizedGeometricTypes"
919 %include "MEDCouplingNatureOfFieldEnum"
923 class MEDCouplingNatureOfField
926 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
927 static std::string GetReprNoThrow(NatureOfField nat);
928 static std::string GetAllPossibilitiesStr();
932 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
933 // include "MEDCouplingTimeDiscretization.i"
937 class MEDCouplingGaussLocalization
940 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
941 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
942 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
943 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
944 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
945 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
946 int getDimension() const throw(INTERP_KERNEL::Exception);
947 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
948 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
949 void checkCoherency() const throw(INTERP_KERNEL::Exception);
950 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
952 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
953 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
954 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
955 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
956 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
957 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
958 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
959 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
960 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
961 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
962 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
963 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
965 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
969 %include "MEDCouplingFieldDiscretization.i"
971 //== MEDCouplingPointSet
975 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
978 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
979 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
980 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
981 void zipCoords() throw(INTERP_KERNEL::Exception);
982 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
983 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
984 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
985 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
986 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
987 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
988 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
989 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
990 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
991 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
992 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
993 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
994 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
995 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
996 virtual DataArrayInt *findBoundaryNodes() const;
997 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
998 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
999 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
1000 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
1001 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
1002 virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1005 std::string __str__() const throw(INTERP_KERNEL::Exception)
1007 return self->simpleRepr();
1010 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
1013 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
1014 PyObject *res = PyList_New(2);
1015 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1016 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
1020 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
1022 DataArrayInt *comm, *commIndex;
1023 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
1024 PyObject *res = PyList_New(2);
1025 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1026 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1030 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
1032 DataArrayDouble *ret1=self->getCoords();
1035 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
1038 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
1040 int szArr,sw,iTypppArr;
1041 std::vector<int> stdvecTyyppArr;
1042 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1043 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
1044 if(sw==3)//DataArrayInt
1046 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1047 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1048 std::string name=argpt->getName();
1050 ret->setName(name.c_str());
1052 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1055 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1057 int szArr,sw,iTypppArr;
1058 std::vector<int> stdvecTyyppArr;
1059 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1060 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1061 if(sw==3)//DataArrayInt
1063 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1064 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1065 std::string name=argpt->getName();
1067 ret->setName(name.c_str());
1069 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1072 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
1074 int szArr,sw,iTypppArr;
1075 std::vector<int> stdvecTyyppArr;
1076 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1077 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
1078 if(sw==3)//DataArrayInt
1080 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1081 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1082 std::string name=argpt->getName();
1084 ret->setName(name.c_str());
1086 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1089 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1091 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1092 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1095 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1097 int szArr,sw,iTypppArr;
1098 std::vector<int> stdvecTyyppArr;
1099 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1100 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1101 if(sw==3)//DataArrayInt
1103 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1104 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1105 std::string name=argpt->getName();
1107 ret->setName(name.c_str());
1109 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1112 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1114 int szArr,sw,iTypppArr;
1115 std::vector<int> stdvecTyyppArr;
1116 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1117 self->renumberNodes(tmp,newNbOfNodes);
1120 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1122 int szArr,sw,iTypppArr;
1123 std::vector<int> stdvecTyyppArr;
1124 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1125 self->renumberNodes2(tmp,newNbOfNodes);
1128 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1130 int spaceDim=self->getSpaceDimension();
1132 DataArrayDouble *a,*a2;
1133 DataArrayDoubleTuple *aa,*aa2;
1134 std::vector<double> bb,bb2;
1136 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1137 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1138 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1139 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1140 std::vector<int> nodes;
1141 self->findNodesOnLine(p,v,eps,nodes);
1142 DataArrayInt *ret=DataArrayInt::New();
1143 ret->alloc((int)nodes.size(),1);
1144 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1147 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1149 int spaceDim=self->getSpaceDimension();
1151 DataArrayDouble *a,*a2;
1152 DataArrayDoubleTuple *aa,*aa2;
1153 std::vector<double> bb,bb2;
1155 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1156 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1157 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1158 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1159 std::vector<int> nodes;
1160 self->findNodesOnPlane(p,v,eps,nodes);
1161 DataArrayInt *ret=DataArrayInt::New();
1162 ret->alloc((int)nodes.size(),1);
1163 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1167 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1171 DataArrayDoubleTuple *aa;
1172 std::vector<double> bb;
1174 int spaceDim=self->getSpaceDimension();
1175 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1176 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1177 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1178 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1181 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1183 DataArrayInt *c=0,*cI=0;
1187 DataArrayDoubleTuple *aa;
1188 std::vector<double> bb;
1190 int spaceDim=self->getSpaceDimension();
1191 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1192 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1193 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1194 PyObject *ret=PyTuple_New(2);
1195 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1196 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1200 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1202 DataArrayInt *c=0,*cI=0;
1203 int spaceDim=self->getSpaceDimension();
1206 DataArrayDoubleTuple *aa;
1207 std::vector<double> bb;
1210 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1211 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1213 PyObject *ret=PyTuple_New(2);
1214 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1215 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1219 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1223 DataArrayDoubleTuple *aa;
1224 std::vector<double> bb;
1226 int spaceDim=self->getSpaceDimension();
1227 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1228 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1230 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1231 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1234 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1238 std::vector<int> multiVal;
1239 std::pair<int, std::pair<int,int> > slic;
1240 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1241 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1245 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1247 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1249 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1251 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1255 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1257 DataArrayInt *v0=0,*v1=0;
1258 self->findCommonCells(compType,startCellId,v0,v1);
1259 PyObject *res = PyList_New(2);
1260 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1261 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1266 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1269 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1270 if (!SWIG_IsOK(res1))
1273 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1274 self->renumberNodesInConn(tmp);
1278 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1280 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1281 da2->checkAllocated();
1282 self->renumberNodesInConn(da2->getConstPointer());
1286 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1289 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1290 PyObject *ret=PyTuple_New(2);
1291 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1292 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1296 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1298 DataArrayInt *ret=0;
1300 int szArr,sw,iTypppArr;
1301 std::vector<int> stdvecTyyppArr;
1302 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1303 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1307 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1311 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1312 PyObject *res = PyList_New(3);
1313 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1314 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1315 PyList_SetItem(res,2,SWIG_From_int(ret2));
1319 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1323 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1324 PyObject *res = PyList_New(3);
1325 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1326 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1327 PyList_SetItem(res,2,SWIG_From_int(ret2));
1331 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1334 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1335 if (!SWIG_IsOK(res1))
1338 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1339 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1343 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1345 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1346 da2->checkAllocated();
1347 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1351 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1355 std::vector<int> multiVal;
1356 std::pair<int, std::pair<int,int> > slic;
1357 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1358 int nbc=self->getNumberOfCells();
1359 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1366 std::ostringstream oss;
1367 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1368 throw INTERP_KERNEL::Exception(oss.str().c_str());
1371 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1376 int tmp=nbc+singleVal;
1377 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1381 std::ostringstream oss;
1382 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1383 throw INTERP_KERNEL::Exception(oss.str().c_str());
1389 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1393 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1398 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1399 daIntTyypp->checkAllocated();
1400 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1403 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1407 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1410 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1411 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1412 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1413 for(int i=0;i<sz;i++)
1414 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1417 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1420 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1422 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1423 std::vector<double> val3;
1424 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1425 "Rotate2DAlg",2,true,nbNodes);
1427 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1428 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1431 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1434 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1435 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1436 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1437 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1438 for(int i=0;i<sz;i++)
1439 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1442 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1445 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1447 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1448 std::vector<double> val3;
1449 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1450 "Rotate3DAlg",3,true,nbNodes);
1452 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1453 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1454 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1459 //== MEDCouplingPointSet End
1461 class MEDCouplingUMeshCell
1464 INTERP_KERNEL::NormalizedCellType getType() const;
1467 std::string __str__() const throw(INTERP_KERNEL::Exception)
1469 return self->repr();
1472 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1475 const int *r=self->getAllConn(ret2);
1476 PyObject *ret=PyTuple_New(ret2);
1477 for(int i=0;i<ret2;i++)
1478 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1484 class MEDCouplingUMeshCellIterator
1491 MEDCouplingUMeshCell *ret=self->nextt();
1493 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1496 PyErr_SetString(PyExc_StopIteration,"No more data.");
1503 class MEDCouplingUMeshCellByTypeIterator
1506 ~MEDCouplingUMeshCellByTypeIterator();
1511 MEDCouplingUMeshCellEntry *ret=self->nextt();
1513 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1516 PyErr_SetString(PyExc_StopIteration,"No more data.");
1523 class MEDCouplingUMeshCellByTypeEntry
1526 ~MEDCouplingUMeshCellByTypeEntry();
1529 MEDCouplingUMeshCellByTypeIterator *__iter__()
1531 return self->iterator();
1536 class MEDCouplingUMeshCellEntry
1539 INTERP_KERNEL::NormalizedCellType getType() const;
1540 int getNumberOfElems() const;
1543 MEDCouplingUMeshCellIterator *__iter__()
1545 return self->iterator();
1550 //== MEDCouplingUMesh
1552 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1555 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1556 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1557 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1558 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1559 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1560 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1561 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1562 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1563 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1564 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1565 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1566 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1567 void computeTypes() throw(INTERP_KERNEL::Exception);
1568 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1569 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1571 DataArrayInt *conformize2D(double eps) throw(INTERP_KERNEL::Exception);
1572 DataArrayInt *colinearize2D(double eps) throw(INTERP_KERNEL::Exception);
1573 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1574 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1575 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1576 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1577 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1578 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1579 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1580 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1581 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1582 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1583 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1584 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1585 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1586 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1587 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1588 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1589 bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
1590 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1591 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1592 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1593 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1594 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1595 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1596 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1597 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1598 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1599 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1600 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1601 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1602 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1603 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1604 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1605 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1606 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1607 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1608 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1609 DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
1610 DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
1611 DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception);
1612 DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1613 DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception);
1614 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);
1615 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1616 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1617 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1618 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1619 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1621 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1623 return MEDCouplingUMesh::New();
1626 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1628 return MEDCouplingUMesh::New(meshName,meshDim);
1631 std::string __str__() const throw(INTERP_KERNEL::Exception)
1633 return self->simpleRepr();
1636 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1638 std::ostringstream oss;
1639 self->reprQuickOverview(oss);
1643 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1645 return self->cellIterator();
1648 PyObject *getAllGeoTypesSorted() const throw(INTERP_KERNEL::Exception)
1650 std::vector<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypesSorted();
1651 std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1652 PyObject *res=PyList_New(result.size());
1653 for(int i=0;iL!=result.end(); i++, iL++)
1654 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1658 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1662 std::vector<int> multiVal;
1663 std::pair<int, std::pair<int,int> > slic;
1664 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1665 int nbc=self->getNumberOfCells();
1666 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1673 std::ostringstream oss;
1674 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1675 throw INTERP_KERNEL::Exception(oss.str().c_str());
1679 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1686 int tmp=nbc+singleVal;
1687 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1692 std::ostringstream oss;
1693 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1694 throw INTERP_KERNEL::Exception(oss.str().c_str());
1700 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1706 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1707 daIntTyypp->checkAllocated();
1708 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1712 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1716 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1720 std::vector<int> multiVal;
1721 std::pair<int, std::pair<int,int> > slic;
1722 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1723 int nbc=self->getNumberOfCells();
1724 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1731 std::ostringstream oss;
1732 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1733 throw INTERP_KERNEL::Exception(oss.str().c_str());
1737 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1744 int tmp=nbc+singleVal;
1745 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1750 std::ostringstream oss;
1751 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1752 throw INTERP_KERNEL::Exception(oss.str().c_str());
1758 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1763 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1769 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1770 daIntTyypp->checkAllocated();
1771 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1775 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1779 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1781 int szArr,sw,iTypppArr;
1782 std::vector<int> stdvecTyyppArr;
1783 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1786 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1787 throw INTERP_KERNEL::Exception(oss.str().c_str());
1789 self->insertNextCell(type,size,tmp);
1792 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1794 int szArr,sw,iTypppArr;
1795 std::vector<int> stdvecTyyppArr;
1796 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1797 self->insertNextCell(type,szArr,tmp);
1800 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1802 DataArrayInt *ret=self->getNodalConnectivity();
1807 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1809 DataArrayInt *ret=self->getNodalConnectivityIndex();
1815 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1817 int szArr,sw,iTypppArr;
1818 std::vector<int> stdvecTyyppArr;
1819 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1820 int nbOfDepthPeelingPerformed=0;
1821 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1822 PyObject *res=PyTuple_New(2);
1823 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1824 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1828 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1830 DataArrayInt *v0=0,*v1=0;
1831 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1832 PyObject *res = PyList_New(2);
1833 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1834 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1838 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1842 DataArrayDoubleTuple *aa;
1843 std::vector<double> bb;
1845 int nbOfCompo=self->getSpaceDimension();
1846 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1849 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1850 PyObject *ret=PyTuple_New(2);
1851 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1852 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1856 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1858 DataArrayInt *ret1=0;
1859 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1860 PyObject *ret=PyTuple_New(2);
1861 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1862 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1866 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1869 DataArrayInt *ret1(0);
1870 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1871 PyObject *ret=PyTuple_New(3);
1872 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1873 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1874 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1878 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1880 std::vector<int> cells;
1881 self->checkButterflyCells(cells,eps);
1882 DataArrayInt *ret=DataArrayInt::New();
1883 ret->alloc((int)cells.size(),1);
1884 std::copy(cells.begin(),cells.end(),ret->getPointer());
1885 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1888 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1890 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1892 PyObject *ret = PyList_New(sz);
1893 for(int i=0;i<sz;i++)
1894 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1898 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1900 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1901 int sz=retCpp.size();
1902 PyObject *ret=PyList_New(sz);
1903 for(int i=0;i<sz;i++)
1904 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1908 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1911 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1912 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1913 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1916 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1919 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1920 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1924 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1927 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1928 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1932 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1934 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1935 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1936 PyObject *ret=PyTuple_New(3);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1945 DataArrayInt *tmp0=0,*tmp1=0;
1946 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1947 PyObject *ret=PyTuple_New(2);
1948 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1949 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1953 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1957 std::vector<int> multiVal;
1958 std::pair<int, std::pair<int,int> > slic;
1959 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1960 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1964 return self->duplicateNodes(&singleVal,&singleVal+1);
1966 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1968 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1970 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1974 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1978 std::vector<int> multiVal;
1979 std::pair<int, std::pair<int,int> > slic;
1980 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1981 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1985 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1987 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1989 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1991 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1995 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1998 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1999 DataArrayInt *tmp0,*tmp1=0;
2000 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
2001 PyObject *ret=PyTuple_New(2);
2002 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2003 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2007 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
2009 DataArrayInt *ret0=0,*ret1=0;
2010 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
2011 PyObject *ret=PyTuple_New(2);
2012 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2013 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2017 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2019 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2020 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2021 DataArrayInt *ret1=0,*ret2=0;
2022 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
2023 PyObject *ret=PyTuple_New(3);
2024 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2025 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2026 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2030 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2032 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
2033 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2034 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
2035 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2038 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
2041 std::vector<const MEDCouplingUMesh *> meshes;
2042 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2043 std::vector<DataArrayInt *> corr;
2044 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
2046 PyObject *ret1=PyList_New(sz);
2047 for(int i=0;i<sz;i++)
2048 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2049 PyObject *ret=PyList_New(2);
2050 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2051 PyList_SetItem(ret,1,ret1);
2055 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
2057 std::vector<MEDCouplingUMesh *> meshes;
2058 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2059 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
2062 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
2064 std::vector<MEDCouplingUMesh *> meshes;
2065 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
2066 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
2069 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2073 std::vector<int> multiVal;
2074 std::pair<int, std::pair<int,int> > slic;
2075 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2077 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2078 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2082 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2084 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2086 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2088 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2092 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2094 DataArrayInt *arrOut=0,*arrIndexOut=0;
2097 std::vector<int> multiVal;
2098 std::pair<int, std::pair<int,int> > slic;
2099 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2101 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2102 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2107 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2112 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2117 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2121 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2123 PyObject *ret=PyTuple_New(2);
2124 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2125 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2129 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2131 DataArrayInt *arrOut=0,*arrIndexOut=0;
2132 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2133 PyObject *ret=PyTuple_New(2);
2134 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2135 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2139 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2141 if(!PySlice_Check(slic))
2142 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2143 Py_ssize_t strt=2,stp=2,step=2;
2144 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2146 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2147 arrIndxIn->checkAllocated();
2148 if(arrIndxIn->getNumberOfComponents()!=1)
2149 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2150 GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2151 DataArrayInt *arrOut=0,*arrIndexOut=0;
2152 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2153 PyObject *ret=PyTuple_New(2);
2154 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2155 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2160 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2161 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2163 DataArrayInt *arrOut=0,*arrIndexOut=0;
2166 std::vector<int> multiVal;
2167 std::pair<int, std::pair<int,int> > slic;
2168 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2170 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2171 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2176 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2181 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2186 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2190 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2192 PyObject *ret=PyTuple_New(2);
2193 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2194 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2198 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2199 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2203 std::vector<int> multiVal;
2204 std::pair<int, std::pair<int,int> > slic;
2205 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2207 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2208 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2213 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2218 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2223 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2227 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2231 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2235 DataArrayDoubleTuple *aa;
2236 std::vector<double> bb;
2238 int spaceDim=self->getSpaceDimension();
2239 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2240 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2242 std::vector<int> cells;
2243 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2244 DataArrayInt *ret=DataArrayInt::New();
2245 ret->alloc((int)cells.size(),1);
2246 std::copy(cells.begin(),cells.end(),ret->getPointer());
2247 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2250 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2254 DataArrayDoubleTuple *aa;
2255 std::vector<double> bb;
2257 int spaceDim=self->getSpaceDimension();
2258 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2259 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2260 self->orientCorrectly2DCells(v,polyOnly);
2263 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2265 std::vector<int> cells;
2266 self->arePolyhedronsNotCorrectlyOriented(cells);
2267 DataArrayInt *ret=DataArrayInt::New();
2268 ret->alloc((int)cells.size(),1);
2269 std::copy(cells.begin(),cells.end(),ret->getPointer());
2270 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2273 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2277 self->getFastAveragePlaneOfThis(vec,pos);
2279 std::copy(vec,vec+3,vals);
2280 std::copy(pos,pos+3,vals+3);
2281 return convertDblArrToPyListOfTuple(vals,3,2);
2284 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2286 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2287 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2288 return MEDCouplingUMesh::MergeUMeshes(tmp);
2291 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2294 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2295 PyObject *ret=PyTuple_New(2);
2296 PyObject *ret0Py=ret0?Py_True:Py_False;
2298 PyTuple_SetItem(ret,0,ret0Py);
2299 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2303 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2306 bool ret0=self->areCellsIncludedIn2(other,ret1);
2307 PyObject *ret=PyTuple_New(2);
2308 PyObject *ret0Py=ret0?Py_True:Py_False;
2310 PyTuple_SetItem(ret,0,ret0Py);
2311 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2315 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2318 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2319 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2321 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2322 PyObject *ret=PyTuple_New(5);
2323 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2324 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2325 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2326 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2327 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2331 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2333 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2336 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2337 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2338 PyObject *ret=PyTuple_New(5);
2339 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2340 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2341 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2342 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2343 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2347 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2349 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2350 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2351 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2353 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2354 PyObject *ret=PyTuple_New(5);
2355 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2356 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2357 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2358 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2359 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2363 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2365 DataArrayInt *neighbors=0,*neighborsIdx=0;
2366 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2367 PyObject *ret=PyTuple_New(2);
2368 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2373 PyObject *computeNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
2375 DataArrayInt *neighbors=0,*neighborsIdx=0;
2376 self->computeNeighborsOfNodes(neighbors,neighborsIdx);
2377 PyObject *ret=PyTuple_New(2);
2378 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2379 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2383 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2385 DataArrayInt *neighbors=0,*neighborsIdx=0;
2386 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2387 PyObject *ret=PyTuple_New(2);
2388 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2389 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2393 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2395 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2396 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2397 DataArrayInt *d2,*d3,*d4,*dd5;
2398 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2399 PyObject *ret=PyTuple_New(7);
2400 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2401 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2402 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2403 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2404 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2405 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2406 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2410 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2413 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2414 da->checkAllocated();
2415 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2418 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2421 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2422 da->checkAllocated();
2423 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2426 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2429 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2430 da->checkAllocated();
2431 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2434 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2437 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2438 da->checkAllocated();
2439 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2440 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2441 PyObject *res = PyList_New(result.size());
2442 for (int i=0;iL!=result.end(); i++, iL++)
2443 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2447 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2450 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2451 da->checkAllocated();
2452 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2453 ret->setName(da->getName().c_str());
2457 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2459 DataArrayInt *cellNb1=0,*cellNb2=0;
2460 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2461 PyObject *ret=PyTuple_New(3);
2462 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2463 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2464 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2468 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2470 int spaceDim=self->getSpaceDimension();
2472 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2474 DataArrayDouble *a,*a2;
2475 DataArrayDoubleTuple *aa,*aa2;
2476 std::vector<double> bb,bb2;
2478 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2479 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2480 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2481 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2483 DataArrayInt *cellIds=0;
2484 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2485 PyObject *ret=PyTuple_New(2);
2486 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2487 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2491 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2493 int spaceDim=self->getSpaceDimension();
2495 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2497 DataArrayDouble *a,*a2;
2498 DataArrayDoubleTuple *aa,*aa2;
2499 std::vector<double> bb,bb2;
2501 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2502 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2503 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2504 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2506 DataArrayInt *cellIds=0;
2507 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2508 PyObject *ret=PyTuple_New(2);
2509 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2510 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2514 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2516 int spaceDim=self->getSpaceDimension();
2518 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2520 DataArrayDouble *a,*a2;
2521 DataArrayDoubleTuple *aa,*aa2;
2522 std::vector<double> bb,bb2;
2524 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2525 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2526 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2527 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2528 return self->getCellIdsCrossingPlane(orig,vect,eps);
2531 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2535 std::vector<int> pos2;
2536 DataArrayInt *pos3=0;
2537 DataArrayIntTuple *pos4=0;
2538 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2543 self->convertToPolyTypes(&pos1,&pos1+1);
2550 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2555 self->convertToPolyTypes(pos3->begin(),pos3->end());
2559 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2563 void convertAllToPoly();
2564 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2565 bool unPolyze() throw(INTERP_KERNEL::Exception);
2566 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2567 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2568 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2571 //== MEDCouplingUMesh End
2573 //== MEDCouplingExtrudedMesh
2575 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2578 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2579 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2581 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2583 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2586 std::string __str__() const throw(INTERP_KERNEL::Exception)
2588 return self->simpleRepr();
2591 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2593 std::ostringstream oss;
2594 self->reprQuickOverview(oss);
2598 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2600 MEDCouplingUMesh *ret=self->getMesh2D();
2603 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2605 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2607 MEDCouplingUMesh *ret=self->getMesh1D();
2610 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2612 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2614 DataArrayInt *ret=self->getMesh3DIds();
2617 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2622 //== MEDCouplingExtrudedMesh End
2624 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2627 static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2628 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2629 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2630 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2631 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2632 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2635 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2637 int szArr,sw,iTypppArr;
2638 std::vector<int> stdvecTyyppArr;
2639 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2640 self->insertNextCell(tmp,tmp+szArr);
2643 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2645 DataArrayInt *ret=self->getNodalConnectivity();
2646 if(ret) ret->incrRef();
2650 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2652 std::vector< const MEDCoupling1GTUMesh *> parts;
2653 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2654 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2659 //== MEDCoupling1SGTUMesh
2661 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2664 static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2665 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2666 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2667 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2668 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2669 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2670 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2671 MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const throw(INTERP_KERNEL::Exception);
2672 DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
2675 MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2677 return MEDCoupling1SGTUMesh::New(name,type);
2680 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2682 return MEDCoupling1SGTUMesh::New(m);
2685 std::string __str__() const throw(INTERP_KERNEL::Exception)
2687 return self->simpleRepr();
2690 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2692 std::ostringstream oss;
2693 self->reprQuickOverview(oss);
2697 PyObject *structurizeMe(double eps=1e-12) const throw(INTERP_KERNEL::Exception)
2699 DataArrayInt *cellPerm(0),*nodePerm(0);
2700 MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps));
2701 PyObject *ret(PyTuple_New(3));
2702 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 ));
2703 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2704 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2708 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2710 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2711 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2712 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2715 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2717 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2718 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2719 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2724 //== MEDCoupling1SGTUMesh End
2726 //== MEDCoupling1DGTUMesh
2728 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2731 static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2732 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2733 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2734 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2735 bool isPacked() const throw(INTERP_KERNEL::Exception);
2738 MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2740 return MEDCoupling1DGTUMesh::New(name,type);
2743 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2745 return MEDCoupling1DGTUMesh::New(m);
2748 std::string __str__() const throw(INTERP_KERNEL::Exception)
2750 return self->simpleRepr();
2753 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2755 std::ostringstream oss;
2756 self->reprQuickOverview(oss);
2760 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2762 DataArrayInt *ret=self->getNodalConnectivityIndex();
2763 if(ret) ret->incrRef();
2767 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2769 DataArrayInt *ret1=0,*ret2=0;
2770 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2771 PyObject *ret0Py=ret0?Py_True:Py_False;
2773 PyObject *ret=PyTuple_New(3);
2774 PyTuple_SetItem(ret,0,ret0Py);
2775 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2776 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2780 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2783 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2784 PyObject *ret=PyTuple_New(2);
2785 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2786 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2787 PyTuple_SetItem(ret,1,ret1Py);
2791 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2793 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2794 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2795 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2798 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2800 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2801 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2802 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2805 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2807 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2808 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2809 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2814 //== MEDCoupling1DGTUMeshEnd
2816 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2819 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2820 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2821 int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2822 int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
2823 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2824 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2825 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2826 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2827 MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const throw(INTERP_KERNEL::Exception);
2828 static int DeduceNumberOfGivenStructure(const std::vector<int>& st) throw(INTERP_KERNEL::Exception);
2829 static std::vector<int> GetSplitVectFromStruct(const std::vector<int>& strct) throw(INTERP_KERNEL::Exception);
2832 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2834 int tmpp1=-1,tmpp2=-1;
2835 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2836 std::vector< std::pair<int,int> > inp;
2840 for(int i=0;i<tmpp1;i++)
2841 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2846 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2847 inp.resize(tmpp1/2);
2848 for(int i=0;i<tmpp1/2;i++)
2849 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2852 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2853 return self->buildStructuredSubPart(inp);
2856 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2858 std::vector< std::pair<int,int> > inp;
2859 convertPyToVectorPairInt(part,inp);
2861 int szArr,sw,iTypppArr;
2862 std::vector<int> stdvecTyyppArr;
2863 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2864 std::vector<int> tmp5(tmp4,tmp4+szArr);
2866 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2869 static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) throw(INTERP_KERNEL::Exception)
2871 std::vector< std::pair<int,int> > inp;
2872 convertPyToVectorPairInt(part,inp);
2873 return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp);
2876 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2878 int szArr,sw,iTypppArr;
2879 std::vector<int> stdvecTyyppArr;
2880 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2881 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2884 static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2886 int szArr,sw,iTypppArr;
2887 std::vector<int> stdvecTyyppArr;
2888 const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
2889 return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
2892 static std::vector<int> GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) throw(INTERP_KERNEL::Exception)
2894 std::vector< std::pair<int,int> > inp;
2895 convertPyToVectorPairInt(partCompactFormat,inp);
2896 return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp);
2899 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2901 int szArr,sw,iTypppArr;
2902 std::vector<int> stdvecTyyppArr;
2903 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2904 int szArr2,sw2,iTypppArr2;
2905 std::vector<int> stdvecTyyppArr2;
2906 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2907 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2908 std::vector< std::pair<int,int> > partCompactFormat;
2909 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2910 PyObject *ret=PyTuple_New(2);
2911 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2912 PyTuple_SetItem(ret,0,ret0Py);
2913 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2914 for(std::size_t i=0;i<partCompactFormat.size();i++)
2916 PyObject *tmp4=PyTuple_New(2);
2917 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2918 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2919 PyList_SetItem(ret1Py,i,tmp4);
2921 PyTuple_SetItem(ret,1,ret1Py);
2925 static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs) throw(INTERP_KERNEL::Exception)
2927 std::vector< std::pair<int,int> > param0,param1,ret;
2928 convertPyToVectorPairInt(bigInAbs,param0);
2929 convertPyToVectorPairInt(partOfBigInAbs,param1);
2930 MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret);
2931 PyObject *retPy(PyList_New(ret.size()));
2932 for(std::size_t i=0;i<ret.size();i++)
2934 PyObject *tmp(PyTuple_New(2));
2935 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2936 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2937 PyList_SetItem(retPy,i,tmp);
2942 static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig) throw(INTERP_KERNEL::Exception)
2944 std::vector< std::pair<int,int> > param0,param1,ret;
2945 convertPyToVectorPairInt(bigInAbs,param0);
2946 convertPyToVectorPairInt(partOfBigRelativeToBig,param1);
2947 MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret);
2948 PyObject *retPy(PyList_New(ret.size()));
2949 for(std::size_t i=0;i<ret.size();i++)
2951 PyObject *tmp(PyTuple_New(2));
2952 PyTuple_SetItem(tmp,0,PyInt_FromLong(ret[i].first));
2953 PyTuple_SetItem(tmp,1,PyInt_FromLong(ret[i].second));
2954 PyList_SetItem(retPy,i,tmp);
2961 //== MEDCouplingCMesh
2963 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2966 static MEDCouplingCMesh *New() throw(INTERP_KERNEL::Exception);
2967 static MEDCouplingCMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
2968 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2969 void setCoords(const DataArrayDouble *coordsX,
2970 const DataArrayDouble *coordsY=0,
2971 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2972 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2974 MEDCouplingCMesh() throw(INTERP_KERNEL::Exception)
2976 return MEDCouplingCMesh::New();
2978 MEDCouplingCMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
2980 return MEDCouplingCMesh::New(meshName);
2982 std::string __str__() const throw(INTERP_KERNEL::Exception)
2984 return self->simpleRepr();
2986 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2988 std::ostringstream oss;
2989 self->reprQuickOverview(oss);
2992 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2994 DataArrayDouble *ret=self->getCoordsAt(i);
3002 //== MEDCouplingCMesh End
3004 //== MEDCouplingCurveLinearMesh
3006 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3009 static MEDCouplingCurveLinearMesh *New() throw(INTERP_KERNEL::Exception);
3010 static MEDCouplingCurveLinearMesh *New(const std::string& meshName) throw(INTERP_KERNEL::Exception);
3011 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
3012 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
3014 MEDCouplingCurveLinearMesh() throw(INTERP_KERNEL::Exception)
3016 return MEDCouplingCurveLinearMesh::New();
3018 MEDCouplingCurveLinearMesh(const std::string& meshName) throw(INTERP_KERNEL::Exception)
3020 return MEDCouplingCurveLinearMesh::New(meshName);
3022 std::string __str__() const throw(INTERP_KERNEL::Exception)
3024 return self->simpleRepr();
3026 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3028 std::ostringstream oss;
3029 self->reprQuickOverview(oss);
3032 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
3034 DataArrayDouble *ret=self->getCoords();
3039 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
3041 int szArr,sw,iTypppArr;
3042 std::vector<int> stdvecTyyppArr;
3043 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
3044 self->setNodeGridStructure(tmp,tmp+szArr);
3049 //== MEDCouplingCurveLinearMesh End
3051 //== MEDCouplingIMesh
3053 class MEDCouplingIMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
3056 static MEDCouplingIMesh *New() throw(INTERP_KERNEL::Exception);
3058 void setSpaceDimension(int spaceDim) throw(INTERP_KERNEL::Exception);
3059 std::vector<int> getNodeStruct() const throw(INTERP_KERNEL::Exception);
3060 std::vector<double> getOrigin() const throw(INTERP_KERNEL::Exception);
3061 std::vector<double> getDXYZ() const throw(INTERP_KERNEL::Exception);
3062 void setAxisUnit(const std::string& unitName) throw(INTERP_KERNEL::Exception);
3063 std::string getAxisUnit() const throw(INTERP_KERNEL::Exception);
3064 double getMeasureOfAnyCell() const throw(INTERP_KERNEL::Exception);
3065 MEDCouplingCMesh *convertToCartesian() const throw(INTERP_KERNEL::Exception);
3066 void refineWithFactor(const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
3067 MEDCouplingIMesh *asSingleCell() const throw(INTERP_KERNEL::Exception);
3072 return MEDCouplingIMesh::New();
3074 static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3076 static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !";
3077 static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !";
3078 const int *nodeStrctPtr(0);
3079 const double *originPtr(0),*dxyzPtr(0);
3081 std::vector<int> bb0;
3082 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
3085 std::vector<double> bb,bb2;
3087 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
3088 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
3090 return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
3093 MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3095 return ParaMEDMEM_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
3098 void setNodeStruct(PyObject *nodeStrct) throw(INTERP_KERNEL::Exception)
3101 std::vector<int> bb0;
3102 const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
3103 self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
3106 void setOrigin(PyObject *origin) throw(INTERP_KERNEL::Exception)
3108 static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3111 DataArrayDoubleTuple *aa;
3112 std::vector<double> bb;
3114 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples));
3115 self->setOrigin(originPtr,originPtr+nbTuples);
3118 void setDXYZ(PyObject *dxyz) throw(INTERP_KERNEL::Exception)
3120 static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !";
3123 DataArrayDoubleTuple *aa;
3124 std::vector<double> bb;
3126 const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples));
3127 self->setDXYZ(originPtr,originPtr+nbTuples);
3130 static void CondenseFineToCoarse(DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3132 std::vector< std::pair<int,int> > inp;
3133 convertPyToVectorPairInt(fineLocInCoarse,inp);
3134 MEDCouplingIMesh::CondenseFineToCoarse(coarseDA,coarseSt,fineDA,inp,facts);
3137 static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector<int>& facts) throw(INTERP_KERNEL::Exception)
3139 std::vector< std::pair<int,int> > inp;
3140 convertPyToVectorPairInt(fineLocInCoarse,inp);
3141 MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts);
3144 std::string __str__() const throw(INTERP_KERNEL::Exception)
3146 return self->simpleRepr();
3148 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3150 std::ostringstream oss;
3151 self->reprQuickOverview(oss);
3157 //== MEDCouplingIMesh End
3161 namespace ParaMEDMEM
3163 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
3166 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
3167 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
3168 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3169 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
3170 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
3171 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
3172 void setName(const char *name) throw(INTERP_KERNEL::Exception);
3173 std::string getDescription() const throw(INTERP_KERNEL::Exception);
3174 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
3175 std::string getName() const throw(INTERP_KERNEL::Exception);
3176 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
3177 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
3178 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
3179 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
3180 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
3181 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
3182 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
3183 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
3184 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
3185 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
3186 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
3187 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
3188 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
3189 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
3190 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
3191 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
3193 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
3195 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
3198 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
3201 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
3203 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
3206 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
3209 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
3211 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
3212 return convertIntArrToPyList3(ret);
3215 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
3218 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
3219 PyObject *ret=PyTuple_New(2);
3220 PyObject *ret0Py=ret0?Py_True:Py_False;
3222 PyTuple_SetItem(ret,0,ret0Py);
3223 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3227 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
3229 DataArrayInt *ret1=0;
3230 MEDCouplingMesh *ret0=0;
3232 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3233 if (!SWIG_IsOK(res1))
3236 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3237 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
3241 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3243 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3244 da2->checkAllocated();
3245 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
3247 PyObject *res = PyList_New(2);
3248 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3249 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3253 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
3255 DataArrayInt *ret1=0;
3257 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
3258 PyObject *res=PyTuple_New(2);
3259 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3261 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3264 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3265 PyTuple_SetItem(res,1,res1);
3270 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3273 int v0; std::vector<int> v1;
3274 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3275 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3278 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3279 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3282 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3283 if (!SWIG_IsOK(res1))
3286 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3287 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3291 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3293 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3294 da2->checkAllocated();
3295 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3299 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3301 std::vector<int> tmp;
3302 self->getCellIdsHavingGaussLocalization(locId,tmp);
3303 DataArrayInt *ret=DataArrayInt::New();
3304 ret->alloc((int)tmp.size(),1);
3305 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3306 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3309 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3311 std::vector<int> inp0;
3312 convertPyToNewIntArr4(code,1,3,inp0);
3313 std::vector<const DataArrayInt *> inp1;
3314 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3315 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3320 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3323 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3324 static MEDCouplingFieldTemplate *New(TypeOfField type);
3325 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3326 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3329 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3331 return MEDCouplingFieldTemplate::New(f);
3334 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3336 return MEDCouplingFieldTemplate::New(type);
3339 std::string __str__() const throw(INTERP_KERNEL::Exception)
3341 return self->simpleRepr();
3344 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3346 std::ostringstream oss;
3347 self->reprQuickOverview(oss);
3353 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3356 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3357 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3358 void setTimeUnit(const std::string& unit);
3359 std::string getTimeUnit() const;
3360 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3361 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3362 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3363 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3364 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3365 void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3366 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3367 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3368 MEDCouplingFieldDouble *deepCpy() const;
3369 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3370 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3371 MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
3372 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3373 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3374 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3375 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3376 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3377 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3378 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3379 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3380 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3381 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3382 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
3383 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3384 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3385 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3386 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3387 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3388 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3389 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3390 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3391 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3392 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3393 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3394 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3395 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3396 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3397 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3398 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3399 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3400 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3401 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3402 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3403 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3404 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3405 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3406 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3407 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3408 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3409 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3410 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3411 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3412 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3413 void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3414 void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3415 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3416 void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3417 void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
3418 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
3419 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3420 void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
3421 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
3422 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
3423 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3424 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3425 double getMinValue() const throw(INTERP_KERNEL::Exception);
3426 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3427 double norm2() const throw(INTERP_KERNEL::Exception);
3428 double normMax() const throw(INTERP_KERNEL::Exception);
3429 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3430 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3431 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3432 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3433 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3434 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3435 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3436 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3437 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3438 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3439 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3440 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3441 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3442 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3443 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3444 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3445 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3446 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3447 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3448 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3449 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3450 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3452 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3454 return MEDCouplingFieldDouble::New(type,td);
3457 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3459 return MEDCouplingFieldDouble::New(ft,td);
3462 std::string __str__() const throw(INTERP_KERNEL::Exception)
3464 return self->simpleRepr();
3467 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3469 std::ostringstream oss;
3470 self->reprQuickOverview(oss);
3474 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3476 DataArrayDouble *ret=self->getArray();
3482 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3484 std::vector<DataArrayDouble *> arrs=self->getArrays();
3485 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3489 PyObject *ret=PyTuple_New(sz);
3490 for(int i=0;i<sz;i++)
3493 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3495 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3500 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3502 std::vector<const DataArrayDouble *> tmp;
3503 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3505 std::vector<DataArrayDouble *> arrs(sz);
3506 for(int i=0;i<sz;i++)
3507 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3508 self->setArrays(arrs);
3511 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3513 DataArrayDouble *ret=self->getEndArray();
3519 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3523 DataArrayDoubleTuple *aa;
3524 std::vector<double> bb;
3526 const MEDCouplingMesh *mesh=self->getMesh();
3528 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3529 int spaceDim=mesh->getSpaceDimension();
3530 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3531 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3533 int sz=self->getNumberOfComponents();
3534 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3535 self->getValueOn(spaceLoc,res);
3536 return convertDblArrToPyList(res,sz);
3539 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3541 int sz=self->getNumberOfComponents();
3542 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3543 self->getValueOnPos(i,j,k,res);
3544 return convertDblArrToPyList(res,sz);
3547 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3549 const MEDCouplingMesh *mesh(self->getMesh());
3551 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3554 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3555 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3556 mesh->getSpaceDimension(),true,nbPts);
3557 return self->getValueOnMulti(inp,nbPts);
3560 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3564 DataArrayDoubleTuple *aa;
3565 std::vector<double> bb;
3567 const MEDCouplingMesh *mesh=self->getMesh();
3569 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3570 int spaceDim=mesh->getSpaceDimension();
3571 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3572 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3575 int sz=self->getNumberOfComponents();
3576 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3577 self->getValueOn(spaceLoc,time,res);
3578 return convertDblArrToPyList(res,sz);
3581 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3583 if(self->getArray()!=0)
3584 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3587 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3588 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3589 self->setArray(arr);
3593 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3596 double tmp0=self->getTime(tmp1,tmp2);
3597 PyObject *res = PyList_New(3);
3598 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3599 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3600 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3604 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3607 double tmp0=self->getStartTime(tmp1,tmp2);
3608 PyObject *res = PyList_New(3);
3609 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3610 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3611 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3615 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3618 double tmp0=self->getEndTime(tmp1,tmp2);
3619 PyObject *res = PyList_New(3);
3620 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3621 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3622 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3625 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3627 int sz=self->getNumberOfComponents();
3628 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3629 self->accumulate(tmp);
3630 return convertDblArrToPyList(tmp,sz);
3632 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3634 int sz=self->getNumberOfComponents();
3635 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3636 self->integral(isWAbs,tmp);
3637 return convertDblArrToPyList(tmp,sz);
3639 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3641 int sz=self->getNumberOfComponents();
3642 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3643 self->getWeightedAverageValue(tmp,isWAbs);
3644 return convertDblArrToPyList(tmp,sz);
3646 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3648 int sz=self->getNumberOfComponents();
3649 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3651 return convertDblArrToPyList(tmp,sz);
3653 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3655 int sz=self->getNumberOfComponents();
3656 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3658 return convertDblArrToPyList(tmp,sz);
3660 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3662 int szArr,sw,iTypppArr;
3663 std::vector<int> stdvecTyyppArr;
3664 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3665 self->renumberCells(tmp,check);
3668 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3670 int szArr,sw,iTypppArr;
3671 std::vector<int> stdvecTyyppArr;
3672 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3673 self->renumberCellsWithoutMesh(tmp,check);
3676 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3678 int szArr,sw,iTypppArr;
3679 std::vector<int> stdvecTyyppArr;
3680 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3681 self->renumberNodes(tmp,eps);
3684 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3686 int szArr,sw,iTypppArr;
3687 std::vector<int> stdvecTyyppArr;
3688 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3689 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3692 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3696 std::vector<int> multiVal;
3697 std::pair<int, std::pair<int,int> > slic;
3698 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3699 const MEDCouplingMesh *mesh=self->getMesh();
3701 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3702 int nbc=mesh->getNumberOfCells();
3703 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3710 std::ostringstream oss;
3711 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3712 throw INTERP_KERNEL::Exception(oss.str().c_str());
3715 return self->buildSubPart(&singleVal,&singleVal+1);
3720 int tmp=nbc+singleVal;
3721 return self->buildSubPart(&tmp,&tmp+1);
3725 std::ostringstream oss;
3726 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3727 throw INTERP_KERNEL::Exception(oss.str().c_str());
3733 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3737 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3742 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3743 daIntTyypp->checkAllocated();
3744 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3747 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3751 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3753 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";
3754 if(PyTuple_Check(li))
3756 Py_ssize_t sz=PyTuple_Size(li);
3758 throw INTERP_KERNEL::Exception(msg);
3759 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3762 std::vector<int> multiVal;
3763 std::pair<int, std::pair<int,int> > slic;
3764 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3765 if(!self->getArray())
3766 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3768 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3769 catch(INTERP_KERNEL::Exception& e)
3770 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3771 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3772 DataArrayDouble *ret0Arr=ret0->getArray();
3774 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3779 std::vector<int> v2(1,singleVal);
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3781 ret0->setArray(aarr);
3786 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3787 ret0->setArray(aarr);
3792 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3793 std::vector<int> v2(nbOfComp);
3794 for(int i=0;i<nbOfComp;i++)
3795 v2[i]=slic.first+i*slic.second.second;
3796 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3797 ret0->setArray(aarr);
3801 throw INTERP_KERNEL::Exception(msg);
3806 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3809 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3812 double r1=self->getMaxValue2(tmp);
3813 PyObject *ret=PyTuple_New(2);
3814 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3815 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3819 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3822 double r1=self->getMinValue2(tmp);
3823 PyObject *ret=PyTuple_New(2);
3824 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3825 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3829 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3831 std::vector<int> tmp;
3832 convertPyToNewIntArr3(li,tmp);
3833 return self->keepSelectedComponents(tmp);
3836 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3838 std::vector<int> tmp;
3839 convertPyToNewIntArr3(li,tmp);
3840 self->setSelectedComponents(f,tmp);
3843 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3846 DataArrayDouble *a,*a2;
3847 DataArrayDoubleTuple *aa,*aa2;
3848 std::vector<double> bb,bb2;
3851 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3852 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3853 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3854 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3856 return self->extractSlice3D(orig,vect,eps);
3859 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3861 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3864 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3866 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3869 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3871 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.";
3872 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3875 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3877 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3879 return (*self)-(*other);
3881 throw INTERP_KERNEL::Exception(msg);
3886 DataArrayDoubleTuple *aa;
3887 std::vector<double> bb;
3889 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3894 if(!self->getArray())
3895 throw INTERP_KERNEL::Exception(msg2);
3896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3897 ret->applyLin(1.,-val);
3898 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3899 ret2->setArray(ret);
3904 if(!self->getArray())
3905 throw INTERP_KERNEL::Exception(msg2);
3906 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3907 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3908 ret2->setArray(ret);
3913 if(!self->getArray())
3914 throw INTERP_KERNEL::Exception(msg2);
3915 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3916 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3917 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3918 ret2->setArray(ret);
3923 if(!self->getArray())
3924 throw INTERP_KERNEL::Exception(msg2);
3925 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3926 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3927 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3928 ret2->setArray(ret);
3932 { throw INTERP_KERNEL::Exception(msg); }
3936 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3938 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3941 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3943 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3946 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3948 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3951 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3953 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.";
3954 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3957 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3959 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3961 return (*self)/(*other);
3963 throw INTERP_KERNEL::Exception(msg);
3968 DataArrayDoubleTuple *aa;
3969 std::vector<double> bb;
3971 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3977 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3978 if(!self->getArray())
3979 throw INTERP_KERNEL::Exception(msg2);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3981 ret->applyLin(1./val,0);
3982 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3983 ret2->setArray(ret);
3988 if(!self->getArray())
3989 throw INTERP_KERNEL::Exception(msg2);
3990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3991 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3992 ret2->setArray(ret);
3997 if(!self->getArray())
3998 throw INTERP_KERNEL::Exception(msg2);
3999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4000 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4001 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4002 ret2->setArray(ret);
4007 if(!self->getArray())
4008 throw INTERP_KERNEL::Exception(msg2);
4009 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4010 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
4011 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4012 ret2->setArray(ret);
4016 { throw INTERP_KERNEL::Exception(msg); }
4020 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4022 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
4025 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4027 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.";
4028 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
4031 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4033 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4035 return (*self)^(*other);
4037 throw INTERP_KERNEL::Exception(msg);
4042 DataArrayDoubleTuple *aa;
4043 std::vector<double> bb;
4045 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4050 if(!self->getArray())
4051 throw INTERP_KERNEL::Exception(msg2);
4052 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
4054 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4055 ret2->setArray(ret);
4060 if(!self->getArray())
4061 throw INTERP_KERNEL::Exception(msg2);
4062 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
4063 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4064 ret2->setArray(ret);
4069 if(!self->getArray())
4070 throw INTERP_KERNEL::Exception(msg2);
4071 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4072 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4073 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4074 ret2->setArray(ret);
4079 if(!self->getArray())
4080 throw INTERP_KERNEL::Exception(msg2);
4081 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4082 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
4083 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4084 ret2->setArray(ret);
4088 { throw INTERP_KERNEL::Exception(msg); }
4092 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
4094 return self->negate();
4097 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 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.";
4100 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
4103 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4105 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4109 Py_XINCREF(trueSelf);
4113 throw INTERP_KERNEL::Exception(msg);
4118 DataArrayDoubleTuple *aa;
4119 std::vector<double> bb;
4121 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4126 if(!self->getArray())
4127 throw INTERP_KERNEL::Exception(msg2);
4128 self->getArray()->applyLin(1.,val);
4129 Py_XINCREF(trueSelf);
4134 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4137 Py_XINCREF(trueSelf);
4142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4143 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4144 ret2->setArray(aaa);
4146 Py_XINCREF(trueSelf);
4151 if(!self->getArray())
4152 throw INTERP_KERNEL::Exception(msg2);
4153 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4154 self->getArray()->addEqual(aaa);
4155 Py_XINCREF(trueSelf);
4159 { throw INTERP_KERNEL::Exception(msg); }
4163 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4165 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.";
4166 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
4169 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4171 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4175 Py_XINCREF(trueSelf);
4179 throw INTERP_KERNEL::Exception(msg);
4184 DataArrayDoubleTuple *aa;
4185 std::vector<double> bb;
4187 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4192 if(!self->getArray())
4193 throw INTERP_KERNEL::Exception(msg2);
4194 self->getArray()->applyLin(1.,-val);
4195 Py_XINCREF(trueSelf);
4200 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4203 Py_XINCREF(trueSelf);
4208 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4209 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4210 ret2->setArray(aaa);
4212 Py_XINCREF(trueSelf);
4217 if(!self->getArray())
4218 throw INTERP_KERNEL::Exception(msg2);
4219 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4220 self->getArray()->substractEqual(aaa);
4221 Py_XINCREF(trueSelf);
4225 { throw INTERP_KERNEL::Exception(msg); }
4229 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4231 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.";
4232 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
4235 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4237 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4241 Py_XINCREF(trueSelf);
4245 throw INTERP_KERNEL::Exception(msg);
4250 DataArrayDoubleTuple *aa;
4251 std::vector<double> bb;
4253 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4258 if(!self->getArray())
4259 throw INTERP_KERNEL::Exception(msg2);
4260 self->getArray()->applyLin(val,0);
4261 Py_XINCREF(trueSelf);
4266 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4269 Py_XINCREF(trueSelf);
4274 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4275 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4276 ret2->setArray(aaa);
4278 Py_XINCREF(trueSelf);
4283 if(!self->getArray())
4284 throw INTERP_KERNEL::Exception(msg2);
4285 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4286 self->getArray()->multiplyEqual(aaa);
4287 Py_XINCREF(trueSelf);
4291 { throw INTERP_KERNEL::Exception(msg); }
4295 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4297 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.";
4298 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4301 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4303 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4307 Py_XINCREF(trueSelf);
4311 throw INTERP_KERNEL::Exception(msg);
4316 DataArrayDoubleTuple *aa;
4317 std::vector<double> bb;
4319 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4325 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4326 if(!self->getArray())
4327 throw INTERP_KERNEL::Exception(msg2);
4328 self->getArray()->applyLin(1./val,0);
4329 Py_XINCREF(trueSelf);
4334 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4337 Py_XINCREF(trueSelf);
4342 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4343 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4344 ret2->setArray(aaa);
4346 Py_XINCREF(trueSelf);
4351 if(!self->getArray())
4352 throw INTERP_KERNEL::Exception(msg2);
4353 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4354 self->getArray()->divideEqual(aaa);
4355 Py_XINCREF(trueSelf);
4359 { throw INTERP_KERNEL::Exception(msg); }
4363 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4365 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.";
4366 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4369 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4371 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4375 Py_XINCREF(trueSelf);
4379 throw INTERP_KERNEL::Exception(msg);
4384 DataArrayDoubleTuple *aa;
4385 std::vector<double> bb;
4387 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4392 if(!self->getArray())
4393 throw INTERP_KERNEL::Exception(msg2);
4394 self->getArray()->applyPow(val);
4395 Py_XINCREF(trueSelf);
4400 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4403 Py_XINCREF(trueSelf);
4408 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4409 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4410 ret2->setArray(aaa);
4412 Py_XINCREF(trueSelf);
4417 if(!self->getArray())
4418 throw INTERP_KERNEL::Exception(msg2);
4419 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4420 self->getArray()->powEqual(aaa);
4421 Py_XINCREF(trueSelf);
4425 { throw INTERP_KERNEL::Exception(msg); }
4429 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4431 std::vector<const MEDCouplingFieldDouble *> tmp;
4432 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4433 return MEDCouplingFieldDouble::MergeFields(tmp);
4436 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4438 std::vector<const MEDCouplingFieldDouble *> tmp;
4439 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4440 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4445 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4448 int getNumberOfFields() const;
4449 MEDCouplingMultiFields *deepCpy() const;
4450 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4451 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4452 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4453 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4454 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4457 std::string __str__() const throw(INTERP_KERNEL::Exception)
4459 return self->simpleRepr();
4461 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4463 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4464 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4466 std::vector<MEDCouplingFieldDouble *> fs(sz);
4467 for(int i=0;i<sz;i++)
4468 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4469 return MEDCouplingMultiFields::New(fs);
4471 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4473 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4474 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4476 std::vector<MEDCouplingFieldDouble *> fs(sz);
4477 for(int i=0;i<sz;i++)
4478 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4479 return MEDCouplingMultiFields::New(fs);
4481 PyObject *getFields() const
4483 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4484 int sz=fields.size();
4485 PyObject *res = PyList_New(sz);
4486 for(int i=0;i<sz;i++)
4490 fields[i]->incrRef();
4491 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4495 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4500 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4502 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4506 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4509 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4511 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4513 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4515 PyObject *res = PyList_New(sz);
4516 for(int i=0;i<sz;i++)
4521 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4525 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4530 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4532 std::vector<int> refs;
4533 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4535 PyObject *res = PyList_New(sz);
4536 for(int i=0;i<sz;i++)
4541 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4545 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4549 PyObject *ret=PyTuple_New(2);
4550 PyTuple_SetItem(ret,0,res);
4551 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4554 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4556 std::vector<DataArrayDouble *> ms=self->getArrays();
4558 PyObject *res = PyList_New(sz);
4559 for(int i=0;i<sz;i++)
4564 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4568 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4573 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4575 std::vector< std::vector<int> > refs;
4576 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4578 PyObject *res = PyList_New(sz);
4579 PyObject *res2 = PyList_New(sz);
4580 for(int i=0;i<sz;i++)
4585 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4589 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4591 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4594 PyObject *ret=PyTuple_New(2);
4595 PyTuple_SetItem(ret,0,res);
4596 PyTuple_SetItem(ret,1,res2);
4602 class MEDCouplingDefinitionTime
4605 MEDCouplingDefinitionTime();
4606 void assign(const MEDCouplingDefinitionTime& other);
4607 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4608 double getTimeResolution() const;
4609 std::vector<double> getHotSpotsTime() const;
4612 std::string __str__() const throw(INTERP_KERNEL::Exception)
4614 std::ostringstream oss;
4615 self->appendRepr(oss);
4619 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4621 int meshId,arrId,arrIdInField,fieldId;
4622 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4623 PyObject *res=PyList_New(4);
4624 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4625 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4626 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4627 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4631 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4633 int meshId,arrId,arrIdInField,fieldId;
4634 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4635 PyObject *res=PyList_New(4);
4636 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4637 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4638 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4639 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4645 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4648 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4649 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4653 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4655 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4656 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4658 std::vector<MEDCouplingFieldDouble *> fs(sz);
4659 for(int i=0;i<sz;i++)
4660 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4661 return MEDCouplingFieldOverTime::New(fs);
4663 std::string __str__() const throw(INTERP_KERNEL::Exception)
4665 return self->simpleRepr();
4667 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4669 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4670 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4672 std::vector<MEDCouplingFieldDouble *> fs(sz);
4673 for(int i=0;i<sz;i++)
4674 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4675 return MEDCouplingFieldOverTime::New(fs);
4680 class MEDCouplingCartesianAMRMesh;
4682 class MEDCouplingCartesianAMRPatch : public RefCountObject
4685 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4686 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4687 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4688 int getNumberOfOverlapedCellsForFather() const throw(INTERP_KERNEL::Exception);
4691 PyObject *getBLTRRange() const throw(INTERP_KERNEL::Exception)
4693 const std::vector< std::pair<int,int> >& ret(self->getBLTRRange());
4694 return convertFromVectorPairInt(ret);
4697 MEDCouplingCartesianAMRMesh *getMesh() const throw(INTERP_KERNEL::Exception)
4699 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4705 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4707 std::vector< std::pair<int,int> > inp;
4708 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4709 self->addPatch(inp,factors);
4712 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4714 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4716 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__getitem__ : no underlying mesh !");
4717 if(patchId==mesh->getNumberOfPatches())
4719 std::ostringstream oss;
4720 oss << "Requesting for patchId " << patchId << " having only " << mesh->getNumberOfPatches() << " patches !";
4721 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4724 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(mesh->getPatch(patchId)));
4730 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4732 MEDCouplingCartesianAMRMesh *mesh(const_cast<MEDCouplingCartesianAMRMesh *>(self->getMesh()));
4734 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__delitem__ : no underlying mesh !");
4735 mesh->removePatch(patchId);
4738 int __len__() const throw(INTERP_KERNEL::Exception)
4740 const MEDCouplingCartesianAMRMesh *mesh(self->getMesh());
4742 throw INTERP_KERNEL::Exception("wrap MEDCouplingCartesianAMRPatch.__len__ : no underlying mesh !");
4743 return mesh->getNumberOfPatches();
4748 class MEDCouplingCartesianAMRMesh : public RefCountObject, public TimeLabel
4752 int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
4753 int getMaxNumberOfLevelsRelativeToThis() const throw(INTERP_KERNEL::Exception);
4754 int getNumberOfCellsAtCurrentLevel() const throw(INTERP_KERNEL::Exception);
4755 int getNumberOfCellsRecursiveWithOverlap() const throw(INTERP_KERNEL::Exception);
4756 int getNumberOfCellsRecursiveWithoutOverlap() const throw(INTERP_KERNEL::Exception);
4758 int getNumberOfPatches() const throw(INTERP_KERNEL::Exception);
4759 MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
4760 MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const throw(INTERP_KERNEL::Exception);
4761 void removePatch(int patchId) throw(INTERP_KERNEL::Exception);
4762 void detachFromFather() throw(INTERP_KERNEL::Exception);
4763 void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception);
4766 static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4768 static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !";
4769 static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !";
4770 const int *nodeStrctPtr(0);
4771 const double *originPtr(0),*dxyzPtr(0);
4773 std::vector<int> bb0;
4774 nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
4777 std::vector<double> bb,bb2;
4779 originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1);
4780 dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2);
4782 return MEDCouplingCartesianAMRMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
4785 MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) throw(INTERP_KERNEL::Exception)
4787 return ParaMEDMEM_MEDCouplingCartesianAMRMesh_New(meshName,spaceDim,nodeStrct,origin,dxyz);
4790 void addPatch(PyObject *bottomLeftTopRight, const std::vector<int>& factors) throw(INTERP_KERNEL::Exception)
4792 std::vector< std::pair<int,int> > inp;
4793 convertPyToVectorPairInt(bottomLeftTopRight,inp);
4794 self->addPatch(inp,factors);
4797 MEDCouplingCartesianAMRMesh *getFather() const throw(INTERP_KERNEL::Exception)
4799 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getFather()));
4805 MEDCouplingCartesianAMRMesh *getGodFather() const throw(INTERP_KERNEL::Exception)
4807 MEDCouplingCartesianAMRMesh *ret(const_cast<MEDCouplingCartesianAMRMesh *>(self->getGodFather()));
4813 MEDCouplingCartesianAMRPatch *getPatch(int patchId) const throw(INTERP_KERNEL::Exception)
4815 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4821 MEDCouplingIMesh *getImageMesh() const throw(INTERP_KERNEL::Exception)
4823 const MEDCouplingIMesh *ret(self->getImageMesh());
4826 return const_cast<MEDCouplingIMesh *>(ret);
4829 MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const throw(INTERP_KERNEL::Exception)
4831 if(patchId==self->getNumberOfPatches())
4833 std::ostringstream oss;
4834 oss << "Requesting for patchId " << patchId << " having only " << self->getNumberOfPatches() << " patches !";
4835 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4838 MEDCouplingCartesianAMRPatch *ret(const_cast<MEDCouplingCartesianAMRPatch *>(self->getPatch(patchId)));
4844 void __delitem__(int patchId) throw(INTERP_KERNEL::Exception)
4846 self->removePatch(patchId);
4849 int __len__() const throw(INTERP_KERNEL::Exception)
4851 return self->getNumberOfPatches();
4856 class DenseMatrix : public RefCountObject, public TimeLabel
4859 static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4860 static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4861 DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception);
4862 DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception);
4864 int getNumberOfRows() const throw(INTERP_KERNEL::Exception);
4865 int getNumberOfCols() const throw(INTERP_KERNEL::Exception);
4866 int getNbOfElems() const throw(INTERP_KERNEL::Exception);
4867 void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1) throw(INTERP_KERNEL::Exception);
4868 void reShape(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception);
4869 void transpose() throw(INTERP_KERNEL::Exception);
4871 bool isEqual(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception);
4872 DataArrayDouble *matVecMult(const DataArrayDouble *vec) const throw(INTERP_KERNEL::Exception);
4873 static DataArrayDouble *MatVecMult(const DenseMatrix *mat, const DataArrayDouble *vec) throw(INTERP_KERNEL::Exception);
4876 DenseMatrix(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4878 return DenseMatrix::New(nbRows,nbCols);
4881 DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception)
4883 return DenseMatrix::New(array,nbRows,nbCols);
4886 PyObject *isEqualIfNotWhy(const DenseMatrix& other, double eps) const throw(INTERP_KERNEL::Exception)
4889 bool ret0=self->isEqualIfNotWhy(other,eps,ret1);
4890 PyObject *ret=PyTuple_New(2);
4891 PyObject *ret0Py=ret0?Py_True:Py_False;
4893 PyTuple_SetItem(ret,0,ret0Py);
4894 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4898 DataArrayDouble *getData() throw(INTERP_KERNEL::Exception)
4900 DataArrayDouble *ret(self->getData());
4906 DenseMatrix *__add__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4908 return ParaMEDMEM::DenseMatrix::Add(self,other);
4911 DenseMatrix *__sub__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4913 return ParaMEDMEM::DenseMatrix::Substract(self,other);
4916 DenseMatrix *__mul__(const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4918 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4921 DenseMatrix *__mul__(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
4923 return ParaMEDMEM::DenseMatrix::Multiply(self,other);
4926 PyObject *___iadd___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4928 self->addEqual(other);
4929 Py_XINCREF(trueSelf);
4933 PyObject *___isub___(PyObject *trueSelf, const DenseMatrix *other) throw(INTERP_KERNEL::Exception)
4935 self->substractEqual(other);
4936 Py_XINCREF(trueSelf);
4940 PyObject *toNumPyMatrix() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
4942 PyObject *obj(ToNumPyArrayUnderground<DataArrayDouble,double>(self->getData(),NPY_DOUBLE,"DataArrayDouble",self->getNumberOfRows(),self->getNumberOfCols()));
4952 __filename=os.environ.get('PYTHONSTARTUP')
4953 if __filename and os.path.isfile(__filename):
4954 execfile(__filename)