1 // Copyright (C) 2007-2013 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.
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 "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
187 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
188 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
189 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
191 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
195 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
196 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
200 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
201 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
202 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
206 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
207 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
208 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
209 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
224 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::computePlaneEquationOf3DFaces;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
267 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
268 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
269 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
270 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
271 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
272 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
273 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
274 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
275 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
276 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
277 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
278 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
279 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
280 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
281 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
282 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
283 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
284 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
285 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
286 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
287 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
288 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
289 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
290 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
291 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
292 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
293 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
294 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
295 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
296 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
297 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
299 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
300 %feature("unref") MEDCouplingMesh "$this->decrRef();"
301 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
302 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
303 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
304 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
305 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
306 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
307 %feature("unref") MEDCouplingField "$this->decrRef();"
308 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
309 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
310 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
311 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
312 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
313 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
314 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
315 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
316 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
318 %rename(assign) *::operator=;
319 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
320 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
321 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
322 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
326 %rename (InterpKernelException) INTERP_KERNEL::Exception;
328 %include "MEDCouplingRefCountObject.i"
329 %include "MEDCouplingMemArray.i"
347 CONST_ON_TIME_INTERVAL = 7
348 } TypeOfTimeDiscretization;
356 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
357 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
358 } MEDCouplingMeshType;
361 class DataArrayDouble;
362 class MEDCouplingUMesh;
363 class MEDCouplingFieldDouble;
365 %extend RefCountObject
367 std::string getHiddenCppPointer() const
369 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
374 %extend MEDCouplingGaussLocalization
376 std::string __str__() const throw(INTERP_KERNEL::Exception)
378 return self->getStringRepr();
381 std::string __repr__() const throw(INTERP_KERNEL::Exception)
383 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
384 oss << self->getStringRepr();
391 class MEDCouplingMesh : public RefCountObject, public TimeLabel
394 void setName(const char *name);
395 std::string getName() const;
396 void setDescription(const char *descr);
397 std::string getDescription() const;
398 void setTime(double val, int iteration, int order);
399 void setTimeUnit(const char *unit);
400 const char *getTimeUnit() const;
401 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
402 bool isStructured() const throw(INTERP_KERNEL::Exception);
403 virtual MEDCouplingMesh *deepCpy() const;
404 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
405 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
406 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
407 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
408 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
409 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
410 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
411 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
412 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
413 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
414 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
415 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
416 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
417 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
418 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
419 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
420 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
421 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
422 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
423 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
424 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
425 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
426 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
427 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
428 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
431 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
433 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
437 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
438 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
439 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
440 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
441 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
442 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
443 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
444 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
445 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
446 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
449 std::string __str__() const throw(INTERP_KERNEL::Exception)
451 return self->simpleRepr();
454 PyObject *getTime() throw(INTERP_KERNEL::Exception)
457 double tmp0=self->getTime(tmp1,tmp2);
458 PyObject *res = PyList_New(3);
459 PyList_SetItem(res,0,SWIG_From_double(tmp0));
460 PyList_SetItem(res,1,SWIG_From_int(tmp1));
461 PyList_SetItem(res,2,SWIG_From_int(tmp2));
465 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
469 DataArrayDoubleTuple *aa;
470 std::vector<double> bb;
472 int spaceDim=self->getSpaceDimension();
473 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
474 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
475 return self->getCellContainingPoint(pos,eps);
478 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
482 DataArrayDoubleTuple *aa;
483 std::vector<double> bb;
485 int spaceDim=self->getSpaceDimension();
486 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
487 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
488 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
489 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
490 PyObject *ret=PyTuple_New(2);
491 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
492 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
496 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
498 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
499 int spaceDim=self->getSpaceDimension();
501 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
502 if (!SWIG_IsOK(res1))
505 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
506 int nbOfPoints=size/spaceDim;
509 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
511 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
515 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
517 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
518 da2->checkAllocated();
519 int size=da2->getNumberOfTuples();
520 int nbOfCompo=da2->getNumberOfComponents();
521 if(nbOfCompo!=spaceDim)
523 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
525 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
527 PyObject *ret=PyTuple_New(2);
528 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
529 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
533 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
537 DataArrayDoubleTuple *aa;
538 std::vector<double> bb;
540 int spaceDim=self->getSpaceDimension();
541 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
542 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
543 std::vector<int> elts;
544 self->getCellsContainingPoint(pos,eps,elts);
545 DataArrayInt *ret=DataArrayInt::New();
546 ret->alloc((int)elts.size(),1);
547 std::copy(elts.begin(),elts.end(),ret->getPointer());
548 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
551 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
554 int v0; std::vector<int> v1;
555 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
556 self->renumberCells(ids,check);
559 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
561 DataArrayInt *cellCor, *nodeCor;
562 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
563 PyObject *res = PyList_New(2);
564 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
565 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
569 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
571 DataArrayInt *cellCor=0,*nodeCor=0;
572 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
573 PyObject *res = PyList_New(2);
574 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
575 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
579 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
581 DataArrayInt *cellCor=0;
582 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
586 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
589 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
590 if (!SWIG_IsOK(res1))
593 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
594 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
598 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
600 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
601 da2->checkAllocated();
602 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
605 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
607 std::vector<int> conn;
608 self->getNodeIdsOfCell(cellId,conn);
609 return convertIntArrToPyList2(conn);
612 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
614 std::vector<double> coo;
615 self->getCoordinatesOfNode(nodeId,coo);
616 return convertDblArrToPyList2(coo);
619 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
623 DataArrayDoubleTuple *aa;
624 std::vector<double> bb;
626 int spaceDim=self->getSpaceDimension();
627 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
628 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
629 self->scale(pointPtr,factor);
632 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
634 int spaceDim=self->getSpaceDimension();
635 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
636 self->getBoundingBox(tmp);
637 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
641 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
644 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
645 PyObject *ret=PyTuple_New(2);
646 PyObject *ret0Py=ret0?Py_True:Py_False;
648 PyTuple_SetItem(ret,0,ret0Py);
649 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
653 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
655 int szArr,sw,iTypppArr;
656 std::vector<int> stdvecTyyppArr;
657 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
658 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
659 if(sw==3)//DataArrayInt
661 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
662 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
663 std::string name=argpt->getName();
665 ret->setName(name.c_str());
667 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
670 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
672 int szArr,sw,iTypppArr;
673 std::vector<int> stdvecTyyppArr;
675 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
676 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
677 if(sw==3)//DataArrayInt
679 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
680 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
681 std::string name=argpt->getName();
683 ret->setName(name.c_str());
686 PyObject *res = PyList_New(2);
687 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
688 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
689 PyList_SetItem(res,0,obj0);
690 PyList_SetItem(res,1,obj1);
694 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
698 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
699 PyObject *res = PyTuple_New(2);
700 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
703 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
705 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
706 PyTuple_SetItem(res,0,obj0);
707 PyTuple_SetItem(res,1,obj1);
711 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
713 std::vector<int> vals=self->getDistributionOfTypes();
715 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
716 PyObject *ret=PyList_New((int)vals.size()/3);
717 for(int j=0;j<(int)vals.size()/3;j++)
719 PyObject *ret1=PyList_New(3);
720 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
721 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
722 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
723 PyList_SetItem(ret,j,ret1);
728 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
730 std::vector<int> code;
731 std::vector<const DataArrayInt *> idsPerType;
732 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
733 convertPyToNewIntArr4(li,1,3,code);
734 return self->checkTypeConsistencyAndContig(code,idsPerType);
737 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
739 std::vector<int> code;
740 std::vector<DataArrayInt *> idsInPflPerType;
741 std::vector<DataArrayInt *> idsPerType;
742 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
743 PyObject *ret=PyTuple_New(3);
746 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
747 PyObject *ret0=PyList_New((int)code.size()/3);
748 for(int j=0;j<(int)code.size()/3;j++)
750 PyObject *ret00=PyList_New(3);
751 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
752 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
753 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
754 PyList_SetItem(ret0,j,ret00);
756 PyTuple_SetItem(ret,0,ret0);
758 PyObject *ret1=PyList_New(idsInPflPerType.size());
759 for(std::size_t j=0;j<idsInPflPerType.size();j++)
760 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
761 PyTuple_SetItem(ret,1,ret1);
762 int n=idsPerType.size();
763 PyObject *ret2=PyList_New(n);
765 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
766 PyTuple_SetItem(ret,2,ret2);
770 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
774 DataArrayDoubleTuple *aa;
775 std::vector<double> bb;
777 int spaceDim=self->getSpaceDimension();
778 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
779 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
780 self->translate(vectorPtr);
783 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
785 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
788 DataArrayDoubleTuple *aa;
789 std::vector<double> bb;
791 int spaceDim=self->getSpaceDimension();
792 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
793 self->rotate(centerPtr,0,alpha);
796 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
798 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
800 DataArrayDouble *a,*a2;
801 DataArrayDoubleTuple *aa,*aa2;
802 std::vector<double> bb,bb2;
804 int spaceDim=self->getSpaceDimension();
805 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
806 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
807 self->rotate(centerPtr,vectorPtr,alpha);
810 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
812 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
813 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
814 PyObject *res=PyList_New(result.size());
815 for(int i=0;iL!=result.end(); i++, iL++)
816 PyList_SetItem(res,i,PyInt_FromLong(*iL));
820 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
822 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
823 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
824 return MEDCouplingMesh::MergeMeshes(tmp);
830 //== MEDCouplingMesh End
832 %include "NormalizedGeometricTypes"
833 %include "MEDCouplingNatureOfFieldEnum"
837 class MEDCouplingNatureOfField
840 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
841 static std::string GetReprNoThrow(NatureOfField nat);
842 static std::string GetAllPossibilitiesStr();
846 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
847 // include "MEDCouplingTimeDiscretization.i"
851 class MEDCouplingGaussLocalization
854 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
855 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
856 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
857 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
858 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
859 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
860 int getDimension() const throw(INTERP_KERNEL::Exception);
861 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
862 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
863 void checkCoherency() const throw(INTERP_KERNEL::Exception);
864 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
866 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
867 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
868 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
869 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
870 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
871 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
872 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
873 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
874 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
875 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
876 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
877 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
879 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
883 %include "MEDCouplingFieldDiscretization.i"
885 //== MEDCouplingPointSet
889 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
892 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
893 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
894 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
895 void zipCoords() throw(INTERP_KERNEL::Exception);
896 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
897 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
898 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
899 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
900 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
901 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
902 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
903 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
904 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
905 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
906 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
907 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
908 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
909 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
910 virtual DataArrayInt *findBoundaryNodes() const;
911 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
912 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
913 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
914 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
915 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
916 virtual DataArrayDouble *getBoundingBoxForBBTree() const throw(INTERP_KERNEL::Exception);
919 std::string __str__() const throw(INTERP_KERNEL::Exception)
921 return self->simpleRepr();
924 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
927 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
928 PyObject *res = PyList_New(2);
929 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
930 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
934 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
936 DataArrayInt *comm, *commIndex;
937 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
938 PyObject *res = PyList_New(2);
939 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
940 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
944 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
946 DataArrayDouble *ret1=self->getCoords();
949 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
952 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
954 int szArr,sw,iTypppArr;
955 std::vector<int> stdvecTyyppArr;
956 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
957 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
958 if(sw==3)//DataArrayInt
960 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
961 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
962 std::string name=argpt->getName();
964 ret->setName(name.c_str());
966 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
969 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
971 int szArr,sw,iTypppArr;
972 std::vector<int> stdvecTyyppArr;
973 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
974 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
975 if(sw==3)//DataArrayInt
977 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
978 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
979 std::string name=argpt->getName();
981 ret->setName(name.c_str());
983 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
986 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
988 int szArr,sw,iTypppArr;
989 std::vector<int> stdvecTyyppArr;
990 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
991 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
992 if(sw==3)//DataArrayInt
994 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
995 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
996 std::string name=argpt->getName();
998 ret->setName(name.c_str());
1000 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1003 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1005 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1006 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1009 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1011 int szArr,sw,iTypppArr;
1012 std::vector<int> stdvecTyyppArr;
1013 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1014 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1015 if(sw==3)//DataArrayInt
1017 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1018 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1019 std::string name=argpt->getName();
1021 ret->setName(name.c_str());
1023 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1026 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1028 int szArr,sw,iTypppArr;
1029 std::vector<int> stdvecTyyppArr;
1030 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1031 self->renumberNodes(tmp,newNbOfNodes);
1034 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1036 int szArr,sw,iTypppArr;
1037 std::vector<int> stdvecTyyppArr;
1038 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1039 self->renumberNodes2(tmp,newNbOfNodes);
1042 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1044 int spaceDim=self->getSpaceDimension();
1046 DataArrayDouble *a,*a2;
1047 DataArrayDoubleTuple *aa,*aa2;
1048 std::vector<double> bb,bb2;
1050 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1051 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1052 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1053 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1054 std::vector<int> nodes;
1055 self->findNodesOnLine(p,v,eps,nodes);
1056 DataArrayInt *ret=DataArrayInt::New();
1057 ret->alloc((int)nodes.size(),1);
1058 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1059 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1061 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1063 int spaceDim=self->getSpaceDimension();
1065 DataArrayDouble *a,*a2;
1066 DataArrayDoubleTuple *aa,*aa2;
1067 std::vector<double> bb,bb2;
1069 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1070 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1071 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1072 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1073 std::vector<int> nodes;
1074 self->findNodesOnPlane(p,v,eps,nodes);
1075 DataArrayInt *ret=DataArrayInt::New();
1076 ret->alloc((int)nodes.size(),1);
1077 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1081 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1085 DataArrayDoubleTuple *aa;
1086 std::vector<double> bb;
1088 int spaceDim=self->getSpaceDimension();
1089 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1090 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1091 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1092 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1095 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1097 DataArrayInt *c=0,*cI=0;
1101 DataArrayDoubleTuple *aa;
1102 std::vector<double> bb;
1104 int spaceDim=self->getSpaceDimension();
1105 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1106 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1107 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1108 PyObject *ret=PyTuple_New(2);
1109 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1110 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1114 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1116 DataArrayInt *c=0,*cI=0;
1117 int spaceDim=self->getSpaceDimension();
1120 DataArrayDoubleTuple *aa;
1121 std::vector<double> bb;
1124 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1125 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1127 PyObject *ret=PyTuple_New(2);
1128 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1129 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1133 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1137 DataArrayDoubleTuple *aa;
1138 std::vector<double> bb;
1140 int spaceDim=self->getSpaceDimension();
1141 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1142 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1144 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1148 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1152 std::vector<int> multiVal;
1153 std::pair<int, std::pair<int,int> > slic;
1154 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1155 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1159 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1161 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1163 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1165 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1169 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1171 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1172 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1173 self->getReverseNodalConnectivity(d0,d1);
1174 PyObject *ret=PyTuple_New(2);
1175 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1176 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1180 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1182 DataArrayInt *v0=0,*v1=0;
1183 self->findCommonCells(compType,startCellId,v0,v1);
1184 PyObject *res = PyList_New(2);
1185 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1186 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1191 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1194 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1195 if (!SWIG_IsOK(res1))
1198 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1199 self->renumberNodesInConn(tmp);
1203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1205 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1206 da2->checkAllocated();
1207 self->renumberNodesInConn(da2->getConstPointer());
1211 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1214 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1215 PyObject *ret=PyTuple_New(2);
1216 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1217 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1221 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1223 DataArrayInt *ret=0;
1225 int szArr,sw,iTypppArr;
1226 std::vector<int> stdvecTyyppArr;
1227 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1228 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1232 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1236 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1237 PyObject *res = PyList_New(3);
1238 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1239 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1240 PyList_SetItem(res,2,SWIG_From_int(ret2));
1244 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1248 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1249 PyObject *res = PyList_New(3);
1250 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1251 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1252 PyList_SetItem(res,2,SWIG_From_int(ret2));
1256 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1259 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1260 if (!SWIG_IsOK(res1))
1263 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1264 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1268 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1270 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1271 da2->checkAllocated();
1272 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1276 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1280 std::vector<int> multiVal;
1281 std::pair<int, std::pair<int,int> > slic;
1282 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1283 int nbc=self->getNumberOfCells();
1284 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1291 std::ostringstream oss;
1292 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1293 throw INTERP_KERNEL::Exception(oss.str().c_str());
1296 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1301 int tmp=nbc+singleVal;
1302 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1306 std::ostringstream oss;
1307 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1308 throw INTERP_KERNEL::Exception(oss.str().c_str());
1314 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1318 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1323 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1324 daIntTyypp->checkAllocated();
1325 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1328 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1332 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1335 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1336 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1337 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1338 for(int i=0;i<sz;i++)
1339 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1342 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1345 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1347 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1348 std::vector<double> val3;
1349 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1350 "Rotate2DAlg",2,true,nbNodes);
1352 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1353 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1356 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1359 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1360 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1361 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1362 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1363 for(int i=0;i<sz;i++)
1364 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1367 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1370 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1372 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1373 std::vector<double> val3;
1374 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1375 "Rotate3DAlg",3,true,nbNodes);
1377 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1378 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1379 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1384 //== MEDCouplingPointSet End
1386 class MEDCouplingUMeshCell
1389 INTERP_KERNEL::NormalizedCellType getType() const;
1392 std::string __str__() const throw(INTERP_KERNEL::Exception)
1394 return self->repr();
1397 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1400 const int *r=self->getAllConn(ret2);
1401 PyObject *ret=PyTuple_New(ret2);
1402 for(int i=0;i<ret2;i++)
1403 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1409 class MEDCouplingUMeshCellIterator
1416 MEDCouplingUMeshCell *ret=self->nextt();
1418 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1421 PyErr_SetString(PyExc_StopIteration,"No more data.");
1428 class MEDCouplingUMeshCellByTypeIterator
1431 ~MEDCouplingUMeshCellByTypeIterator();
1436 MEDCouplingUMeshCellEntry *ret=self->nextt();
1438 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1441 PyErr_SetString(PyExc_StopIteration,"No more data.");
1448 class MEDCouplingUMeshCellByTypeEntry
1451 ~MEDCouplingUMeshCellByTypeEntry();
1454 MEDCouplingUMeshCellByTypeIterator *__iter__()
1456 return self->iterator();
1461 class MEDCouplingUMeshCellEntry
1464 INTERP_KERNEL::NormalizedCellType getType() const;
1465 int getNumberOfElems() const;
1468 MEDCouplingUMeshCellIterator *__iter__()
1470 return self->iterator();
1475 //== MEDCouplingUMesh
1477 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1480 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1481 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1482 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1483 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1484 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1485 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1486 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1487 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1488 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1489 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1490 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1491 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1492 void computeTypes() throw(INTERP_KERNEL::Exception);
1493 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1494 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1496 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1497 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1498 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1499 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1500 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1501 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1502 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1503 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1504 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1505 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1506 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1507 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1508 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1509 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1510 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1511 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1512 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1513 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1514 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1515 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1516 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1517 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1518 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1519 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1520 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1521 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1522 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1523 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1524 DataArrayDouble *computePlaneEquationOf3DFaces() const throw(INTERP_KERNEL::Exception);
1525 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1526 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1527 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1528 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1529 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1530 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1531 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1532 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1533 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1534 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1535 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1537 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1539 return MEDCouplingUMesh::New();
1542 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1544 return MEDCouplingUMesh::New(meshName,meshDim);
1547 std::string __str__() const throw(INTERP_KERNEL::Exception)
1549 return self->simpleRepr();
1552 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1554 std::ostringstream oss;
1555 self->reprQuickOverview(oss);
1559 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1561 return self->cellIterator();
1564 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1568 std::vector<int> multiVal;
1569 std::pair<int, std::pair<int,int> > slic;
1570 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1571 int nbc=self->getNumberOfCells();
1572 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1579 std::ostringstream oss;
1580 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1581 throw INTERP_KERNEL::Exception(oss.str().c_str());
1585 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1592 int tmp=nbc+singleVal;
1593 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1598 std::ostringstream oss;
1599 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1600 throw INTERP_KERNEL::Exception(oss.str().c_str());
1606 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1612 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1613 daIntTyypp->checkAllocated();
1614 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1618 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1622 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1626 std::vector<int> multiVal;
1627 std::pair<int, std::pair<int,int> > slic;
1628 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1629 int nbc=self->getNumberOfCells();
1630 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1637 std::ostringstream oss;
1638 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1639 throw INTERP_KERNEL::Exception(oss.str().c_str());
1643 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1650 int tmp=nbc+singleVal;
1651 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1656 std::ostringstream oss;
1657 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1658 throw INTERP_KERNEL::Exception(oss.str().c_str());
1664 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1669 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1675 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1676 daIntTyypp->checkAllocated();
1677 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1681 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1685 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1687 int szArr,sw,iTypppArr;
1688 std::vector<int> stdvecTyyppArr;
1689 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1692 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1693 throw INTERP_KERNEL::Exception(oss.str().c_str());
1695 self->insertNextCell(type,size,tmp);
1698 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1700 int szArr,sw,iTypppArr;
1701 std::vector<int> stdvecTyyppArr;
1702 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1703 self->insertNextCell(type,szArr,tmp);
1706 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1708 DataArrayInt *ret=self->getNodalConnectivity();
1713 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1715 DataArrayInt *ret=self->getNodalConnectivityIndex();
1720 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1722 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1723 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1724 PyObject *res = PyList_New(result.size());
1725 for (int i=0;iL!=result.end(); i++, iL++)
1726 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1730 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1732 int szArr,sw,iTypppArr;
1733 std::vector<int> stdvecTyyppArr;
1734 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1735 int nbOfDepthPeelingPerformed=0;
1736 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1737 PyObject *res=PyTuple_New(2);
1738 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1739 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1743 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1745 DataArrayInt *v0=0,*v1=0;
1746 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1747 PyObject *res = PyList_New(2);
1748 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1749 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1753 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1757 DataArrayDoubleTuple *aa;
1758 std::vector<double> bb;
1760 int nbOfCompo=self->getSpaceDimension();
1761 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1764 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1765 PyObject *ret=PyTuple_New(2);
1766 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1767 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1771 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1773 DataArrayInt *ret1=0;
1774 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1775 PyObject *ret=PyTuple_New(2);
1776 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1777 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1781 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1784 DataArrayInt *ret1(0);
1785 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1786 PyObject *ret=PyTuple_New(3);
1787 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1788 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1789 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1793 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1795 std::vector<int> cells;
1796 self->checkButterflyCells(cells,eps);
1797 DataArrayInt *ret=DataArrayInt::New();
1798 ret->alloc((int)cells.size(),1);
1799 std::copy(cells.begin(),cells.end(),ret->getPointer());
1800 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1803 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1805 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1807 PyObject *ret = PyList_New(sz);
1808 for(int i=0;i<sz;i++)
1809 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1813 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1815 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1816 int sz=retCpp.size();
1817 PyObject *ret=PyList_New(sz);
1818 for(int i=0;i<sz;i++)
1819 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1823 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1826 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1827 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1828 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1831 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1834 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1835 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1839 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1842 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1843 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1847 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1849 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1850 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1851 PyObject *ret=PyTuple_New(3);
1852 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1853 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1854 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1858 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1860 DataArrayInt *tmp0=0,*tmp1=0;
1861 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1862 PyObject *ret=PyTuple_New(2);
1863 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1864 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1868 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1872 std::vector<int> multiVal;
1873 std::pair<int, std::pair<int,int> > slic;
1874 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1875 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1879 return self->duplicateNodes(&singleVal,&singleVal+1);
1881 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1883 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1885 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1889 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1893 std::vector<int> multiVal;
1894 std::pair<int, std::pair<int,int> > slic;
1895 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1896 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1900 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1902 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1904 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1906 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1910 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1913 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1914 DataArrayInt *tmp0,*tmp1=0;
1915 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1916 PyObject *ret=PyTuple_New(2);
1917 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1918 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1922 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1924 DataArrayInt *ret0=0,*ret1=0;
1925 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1926 PyObject *ret=PyTuple_New(2);
1927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1932 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1934 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1935 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1936 DataArrayInt *ret1=0,*ret2=0;
1937 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1938 PyObject *ret=PyTuple_New(3);
1939 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1940 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1941 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1947 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1948 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1949 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1950 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1953 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1956 std::vector<const MEDCouplingUMesh *> meshes;
1957 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1958 std::vector<DataArrayInt *> corr;
1959 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1961 PyObject *ret1=PyList_New(sz);
1962 for(int i=0;i<sz;i++)
1963 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1964 PyObject *ret=PyList_New(2);
1965 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1966 PyList_SetItem(ret,1,ret1);
1970 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1972 std::vector<MEDCouplingUMesh *> meshes;
1973 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1974 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1977 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1979 std::vector<MEDCouplingUMesh *> meshes;
1980 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1981 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1984 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1988 std::vector<int> multiVal;
1989 std::pair<int, std::pair<int,int> > slic;
1990 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1992 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1993 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1997 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
1999 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2001 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2003 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2007 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2009 DataArrayInt *arrOut=0,*arrIndexOut=0;
2012 std::vector<int> multiVal;
2013 std::pair<int, std::pair<int,int> > slic;
2014 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2016 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2017 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2022 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2027 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2032 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2036 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2038 PyObject *ret=PyTuple_New(2);
2039 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2040 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2044 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2046 DataArrayInt *arrOut=0,*arrIndexOut=0;
2047 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2048 PyObject *ret=PyTuple_New(2);
2049 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2050 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2054 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2056 if(!PySlice_Check(slic))
2057 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2058 Py_ssize_t strt=2,stp=2,step=2;
2059 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2061 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2062 arrIndxIn->checkAllocated();
2063 if(arrIndxIn->getNumberOfComponents()!=1)
2064 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2065 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2066 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2067 DataArrayInt *arrOut=0,*arrIndexOut=0;
2068 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2069 PyObject *ret=PyTuple_New(2);
2070 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2071 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2075 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2076 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2077 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2079 DataArrayInt *arrOut=0,*arrIndexOut=0;
2082 std::vector<int> multiVal;
2083 std::pair<int, std::pair<int,int> > slic;
2084 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2086 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2087 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2092 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2097 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2102 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2106 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2108 PyObject *ret=PyTuple_New(2);
2109 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2110 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2114 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2115 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2119 std::vector<int> multiVal;
2120 std::pair<int, std::pair<int,int> > slic;
2121 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2123 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2124 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2129 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2134 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2139 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2143 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2147 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2151 DataArrayDoubleTuple *aa;
2152 std::vector<double> bb;
2154 int spaceDim=self->getSpaceDimension();
2155 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2156 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2158 std::vector<int> cells;
2159 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2160 DataArrayInt *ret=DataArrayInt::New();
2161 ret->alloc((int)cells.size(),1);
2162 std::copy(cells.begin(),cells.end(),ret->getPointer());
2163 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2166 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2170 DataArrayDoubleTuple *aa;
2171 std::vector<double> bb;
2173 int spaceDim=self->getSpaceDimension();
2174 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2175 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2176 self->orientCorrectly2DCells(v,polyOnly);
2179 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2181 std::vector<int> cells;
2182 self->arePolyhedronsNotCorrectlyOriented(cells);
2183 DataArrayInt *ret=DataArrayInt::New();
2184 ret->alloc((int)cells.size(),1);
2185 std::copy(cells.begin(),cells.end(),ret->getPointer());
2186 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2189 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2193 self->getFastAveragePlaneOfThis(vec,pos);
2195 std::copy(vec,vec+3,vals);
2196 std::copy(pos,pos+3,vals+3);
2197 return convertDblArrToPyListOfTuple(vals,3,2);
2200 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2202 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2203 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2204 return MEDCouplingUMesh::MergeUMeshes(tmp);
2207 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2210 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2211 PyObject *ret=PyTuple_New(2);
2212 PyObject *ret0Py=ret0?Py_True:Py_False;
2214 PyTuple_SetItem(ret,0,ret0Py);
2215 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2219 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2222 bool ret0=self->areCellsIncludedIn2(other,ret1);
2223 PyObject *ret=PyTuple_New(2);
2224 PyObject *ret0Py=ret0?Py_True:Py_False;
2226 PyTuple_SetItem(ret,0,ret0Py);
2227 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2231 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2233 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2234 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2235 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2236 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2237 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2238 PyObject *ret=PyTuple_New(5);
2239 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2240 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2241 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2242 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2243 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2247 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2250 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2251 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2253 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2254 PyObject *ret=PyTuple_New(5);
2255 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2256 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2258 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2259 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2263 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2265 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2266 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2267 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2268 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2269 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2270 PyObject *ret=PyTuple_New(5);
2271 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2273 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2274 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2275 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2279 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2281 DataArrayInt *neighbors=0,*neighborsIdx=0;
2282 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2283 PyObject *ret=PyTuple_New(2);
2284 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2285 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2289 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2291 DataArrayInt *neighbors=0,*neighborsIdx=0;
2292 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2293 PyObject *ret=PyTuple_New(2);
2294 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2295 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2299 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2301 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2302 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2303 DataArrayInt *d2,*d3,*d4,*dd5;
2304 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2305 PyObject *ret=PyTuple_New(7);
2306 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2307 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2309 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2311 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2312 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2316 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2319 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2320 da->checkAllocated();
2321 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2324 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2327 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2328 da->checkAllocated();
2329 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2332 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2335 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2336 da->checkAllocated();
2337 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2340 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2343 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2344 da->checkAllocated();
2345 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2346 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2347 PyObject *res = PyList_New(result.size());
2348 for (int i=0;iL!=result.end(); i++, iL++)
2349 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2353 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2356 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2357 da->checkAllocated();
2358 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2359 ret->setName(da->getName().c_str());
2363 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2365 DataArrayInt *cellNb1=0,*cellNb2=0;
2366 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2367 PyObject *ret=PyTuple_New(3);
2368 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2369 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2370 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2374 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2376 int spaceDim=self->getSpaceDimension();
2378 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2380 DataArrayDouble *a,*a2;
2381 DataArrayDoubleTuple *aa,*aa2;
2382 std::vector<double> bb,bb2;
2384 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2385 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2386 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2387 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2389 DataArrayInt *cellIds=0;
2390 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2391 PyObject *ret=PyTuple_New(2);
2392 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2393 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2397 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2399 int spaceDim=self->getSpaceDimension();
2401 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2403 DataArrayDouble *a,*a2;
2404 DataArrayDoubleTuple *aa,*aa2;
2405 std::vector<double> bb,bb2;
2407 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2408 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2409 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2410 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2412 DataArrayInt *cellIds=0;
2413 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2414 PyObject *ret=PyTuple_New(2);
2415 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2416 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2420 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2422 int spaceDim=self->getSpaceDimension();
2424 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2426 DataArrayDouble *a,*a2;
2427 DataArrayDoubleTuple *aa,*aa2;
2428 std::vector<double> bb,bb2;
2430 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2431 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2432 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2433 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2434 return self->getCellIdsCrossingPlane(orig,vect,eps);
2437 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2441 std::vector<int> pos2;
2442 DataArrayInt *pos3=0;
2443 DataArrayIntTuple *pos4=0;
2444 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2449 self->convertToPolyTypes(&pos1,&pos1+1);
2456 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2461 self->convertToPolyTypes(pos3->begin(),pos3->end());
2465 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2469 void convertAllToPoly();
2470 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2471 bool unPolyze() throw(INTERP_KERNEL::Exception);
2472 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2473 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2474 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2477 //== MEDCouplingUMesh End
2479 //== MEDCouplingExtrudedMesh
2481 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2484 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2485 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2487 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2489 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2492 std::string __str__() const throw(INTERP_KERNEL::Exception)
2494 return self->simpleRepr();
2497 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2499 std::ostringstream oss;
2500 self->reprQuickOverview(oss);
2504 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2506 MEDCouplingUMesh *ret=self->getMesh2D();
2509 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2511 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2513 MEDCouplingUMesh *ret=self->getMesh1D();
2516 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2518 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2520 DataArrayInt *ret=self->getMesh3DIds();
2523 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2528 //== MEDCouplingExtrudedMesh End
2530 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2533 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2534 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2535 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2536 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2537 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2538 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2541 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2543 int szArr,sw,iTypppArr;
2544 std::vector<int> stdvecTyyppArr;
2545 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2546 self->insertNextCell(tmp,tmp+szArr);
2549 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2551 DataArrayInt *ret=self->getNodalConnectivity();
2552 if(ret) ret->incrRef();
2556 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2558 std::vector< const MEDCoupling1GTUMesh *> parts;
2559 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2560 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2565 //== MEDCoupling1SGTUMesh
2567 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2570 static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2571 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2572 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2573 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2574 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2575 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2576 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2579 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2581 return MEDCoupling1SGTUMesh::New(name,type);
2584 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2586 return MEDCoupling1SGTUMesh::New(m);
2589 std::string __str__() const throw(INTERP_KERNEL::Exception)
2591 return self->simpleRepr();
2594 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2596 std::ostringstream oss;
2597 self->reprQuickOverview(oss);
2601 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2603 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2604 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2605 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2608 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2610 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2611 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2612 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2617 //== MEDCoupling1SGTUMesh End
2619 //== MEDCoupling1DGTUMesh
2621 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2624 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2625 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2626 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2627 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2628 bool isPacked() const throw(INTERP_KERNEL::Exception);
2631 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2633 return MEDCoupling1DGTUMesh::New(name,type);
2636 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2638 return MEDCoupling1DGTUMesh::New(m);
2641 std::string __str__() const throw(INTERP_KERNEL::Exception)
2643 return self->simpleRepr();
2646 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2648 std::ostringstream oss;
2649 self->reprQuickOverview(oss);
2653 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2655 DataArrayInt *ret=self->getNodalConnectivityIndex();
2656 if(ret) ret->incrRef();
2660 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2662 DataArrayInt *ret1=0,*ret2=0;
2663 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2664 PyObject *ret0Py=ret0?Py_True:Py_False;
2666 PyObject *ret=PyTuple_New(3);
2667 PyTuple_SetItem(ret,0,ret0Py);
2668 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2669 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2673 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2676 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2677 PyObject *ret=PyTuple_New(2);
2678 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2679 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2680 PyTuple_SetItem(ret,1,ret1Py);
2684 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2686 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2687 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2688 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2691 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2693 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2694 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2695 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2698 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2700 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2701 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2702 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2707 //== MEDCoupling1DGTUMeshEnd
2709 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2712 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2713 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2714 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2715 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2716 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2717 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2720 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2722 int tmpp1=-1,tmpp2=-1;
2723 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2724 std::vector< std::pair<int,int> > inp;
2728 for(int i=0;i<tmpp1;i++)
2729 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2734 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2735 inp.resize(tmpp1/2);
2736 for(int i=0;i<tmpp1/2;i++)
2737 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2740 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2741 return self->buildStructuredSubPart(inp);
2744 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2746 int tmpp1=-1,tmpp2=-1;
2747 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2748 std::vector< std::pair<int,int> > inp;
2752 for(int i=0;i<tmpp1;i++)
2753 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2758 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2759 inp.resize(tmpp1/2);
2760 for(int i=0;i<tmpp1/2;i++)
2761 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2764 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2766 int szArr,sw,iTypppArr;
2767 std::vector<int> stdvecTyyppArr;
2768 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2769 std::vector<int> tmp5(tmp4,tmp4+szArr);
2771 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2774 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2776 int szArr,sw,iTypppArr;
2777 std::vector<int> stdvecTyyppArr;
2778 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2779 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2782 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2784 int szArr,sw,iTypppArr;
2785 std::vector<int> stdvecTyyppArr;
2786 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2787 int szArr2,sw2,iTypppArr2;
2788 std::vector<int> stdvecTyyppArr2;
2789 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2790 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2791 std::vector< std::pair<int,int> > partCompactFormat;
2792 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2793 PyObject *ret=PyTuple_New(2);
2794 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2795 PyTuple_SetItem(ret,0,ret0Py);
2796 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2797 for(std::size_t i=0;i<partCompactFormat.size();i++)
2799 PyObject *tmp4=PyTuple_New(2);
2800 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2801 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2802 PyList_SetItem(ret1Py,i,tmp4);
2804 PyTuple_SetItem(ret,1,ret1Py);
2810 //== MEDCouplingCMesh
2812 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2815 static MEDCouplingCMesh *New();
2816 static MEDCouplingCMesh *New(const char *meshName);
2817 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2818 void setCoords(const DataArrayDouble *coordsX,
2819 const DataArrayDouble *coordsY=0,
2820 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2821 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2825 return MEDCouplingCMesh::New();
2827 MEDCouplingCMesh(const char *meshName)
2829 return MEDCouplingCMesh::New(meshName);
2831 std::string __str__() const throw(INTERP_KERNEL::Exception)
2833 return self->simpleRepr();
2835 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2837 std::ostringstream oss;
2838 self->reprQuickOverview(oss);
2841 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2843 DataArrayDouble *ret=self->getCoordsAt(i);
2851 //== MEDCouplingCMesh End
2853 //== MEDCouplingCurveLinearMesh
2855 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2858 static MEDCouplingCurveLinearMesh *New();
2859 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2860 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2861 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2863 MEDCouplingCurveLinearMesh()
2865 return MEDCouplingCurveLinearMesh::New();
2867 MEDCouplingCurveLinearMesh(const char *meshName)
2869 return MEDCouplingCurveLinearMesh::New(meshName);
2871 std::string __str__() const throw(INTERP_KERNEL::Exception)
2873 return self->simpleRepr();
2875 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2877 std::ostringstream oss;
2878 self->reprQuickOverview(oss);
2881 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2883 DataArrayDouble *ret=self->getCoords();
2888 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2890 int szArr,sw,iTypppArr;
2891 std::vector<int> stdvecTyyppArr;
2892 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2893 self->setNodeGridStructure(tmp,tmp+szArr);
2898 //== MEDCouplingCurveLinearMesh End
2901 namespace ParaMEDMEM
2903 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2906 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2907 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2908 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2909 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2910 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2911 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2912 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2913 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2914 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2915 std::string getName() const throw(INTERP_KERNEL::Exception);
2916 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2917 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2918 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2919 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2920 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2921 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2922 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2923 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2924 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2925 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2926 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2927 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2928 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2929 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2930 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2931 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2933 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2935 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2938 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2941 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2943 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2946 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2949 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2951 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2952 return convertIntArrToPyList3(ret);
2955 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2958 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2959 PyObject *ret=PyTuple_New(2);
2960 PyObject *ret0Py=ret0?Py_True:Py_False;
2962 PyTuple_SetItem(ret,0,ret0Py);
2963 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2967 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2969 DataArrayInt *ret1=0;
2970 MEDCouplingMesh *ret0=0;
2972 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2973 if (!SWIG_IsOK(res1))
2976 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2977 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2981 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2983 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2984 da2->checkAllocated();
2985 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2987 PyObject *res = PyList_New(2);
2988 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2989 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2993 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
2995 DataArrayInt *ret1=0;
2997 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
2998 PyObject *res=PyTuple_New(2);
2999 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
3001 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3004 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3005 PyTuple_SetItem(res,1,res1);
3010 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3013 int v0; std::vector<int> v1;
3014 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3015 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3018 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3019 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3022 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3023 if (!SWIG_IsOK(res1))
3026 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3027 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3031 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3033 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3034 da2->checkAllocated();
3035 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3039 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3041 std::vector<int> tmp;
3042 self->getCellIdsHavingGaussLocalization(locId,tmp);
3043 DataArrayInt *ret=DataArrayInt::New();
3044 ret->alloc((int)tmp.size(),1);
3045 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3046 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3049 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3051 std::vector<int> inp0;
3052 convertPyToNewIntArr4(code,1,3,inp0);
3053 std::vector<const DataArrayInt *> inp1;
3054 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3055 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3060 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3063 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3064 static MEDCouplingFieldTemplate *New(TypeOfField type);
3065 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3066 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3069 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3071 return MEDCouplingFieldTemplate::New(f);
3074 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3076 return MEDCouplingFieldTemplate::New(type);
3079 std::string __str__() const throw(INTERP_KERNEL::Exception)
3081 return self->simpleRepr();
3084 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3086 std::ostringstream oss;
3087 self->reprQuickOverview(oss);
3093 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3096 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3097 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3098 void setTimeUnit(const char *unit);
3099 const char *getTimeUnit() const;
3100 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3101 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3102 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3103 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3104 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3105 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3106 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3107 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3108 MEDCouplingFieldDouble *deepCpy() const;
3109 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3110 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3111 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3112 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3113 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3114 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3115 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3116 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3117 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3118 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3119 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3120 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3121 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3122 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3123 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3124 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3125 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3126 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3127 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3128 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3129 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3130 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3131 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3132 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3133 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3134 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3135 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3136 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3137 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3138 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3139 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3140 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3141 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3142 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3143 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3144 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3145 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3146 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3147 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3148 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3149 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3150 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3151 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3152 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3153 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3154 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3155 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3156 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3157 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3158 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3159 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3160 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3161 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3162 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3163 double getMinValue() const throw(INTERP_KERNEL::Exception);
3164 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3165 double norm2() const throw(INTERP_KERNEL::Exception);
3166 double normMax() const throw(INTERP_KERNEL::Exception);
3167 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3168 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3169 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3170 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3171 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3172 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3173 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3174 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3175 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3176 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3177 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3178 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3179 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3180 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3181 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3182 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3183 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3184 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3185 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3186 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3187 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3188 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3190 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3192 return MEDCouplingFieldDouble::New(type,td);
3195 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3197 return MEDCouplingFieldDouble::New(ft,td);
3200 std::string __str__() const throw(INTERP_KERNEL::Exception)
3202 return self->simpleRepr();
3205 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3207 std::ostringstream oss;
3208 self->reprQuickOverview(oss);
3212 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3214 DataArrayDouble *ret=self->getArray();
3220 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3222 std::vector<DataArrayDouble *> arrs=self->getArrays();
3223 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3227 PyObject *ret=PyTuple_New(sz);
3228 for(int i=0;i<sz;i++)
3231 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3233 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3238 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3240 std::vector<const DataArrayDouble *> tmp;
3241 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3243 std::vector<DataArrayDouble *> arrs(sz);
3244 for(int i=0;i<sz;i++)
3245 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3246 self->setArrays(arrs);
3249 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3251 DataArrayDouble *ret=self->getEndArray();
3257 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3261 DataArrayDoubleTuple *aa;
3262 std::vector<double> bb;
3264 const MEDCouplingMesh *mesh=self->getMesh();
3266 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3267 int spaceDim=mesh->getSpaceDimension();
3268 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3269 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3271 int sz=self->getNumberOfComponents();
3272 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3273 self->getValueOn(spaceLoc,res);
3274 return convertDblArrToPyList(res,sz);
3277 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3279 int sz=self->getNumberOfComponents();
3280 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3281 self->getValueOnPos(i,j,k,res);
3282 return convertDblArrToPyList(res,sz);
3285 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3287 const MEDCouplingMesh *mesh(self->getMesh());
3289 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3292 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3293 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3294 mesh->getSpaceDimension(),true,nbPts);
3295 return self->getValueOnMulti(inp,nbPts);
3298 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3302 DataArrayDoubleTuple *aa;
3303 std::vector<double> bb;
3305 const MEDCouplingMesh *mesh=self->getMesh();
3307 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3308 int spaceDim=mesh->getSpaceDimension();
3309 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3310 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3313 int sz=self->getNumberOfComponents();
3314 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3315 self->getValueOn(spaceLoc,time,res);
3316 return convertDblArrToPyList(res,sz);
3319 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3321 if(self->getArray()!=0)
3322 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3325 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3326 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3327 self->setArray(arr);
3331 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3334 double tmp0=self->getTime(tmp1,tmp2);
3335 PyObject *res = PyList_New(3);
3336 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3337 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3338 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3342 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3345 double tmp0=self->getStartTime(tmp1,tmp2);
3346 PyObject *res = PyList_New(3);
3347 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3348 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3349 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3353 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3356 double tmp0=self->getEndTime(tmp1,tmp2);
3357 PyObject *res = PyList_New(3);
3358 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3359 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3360 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3363 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3365 int sz=self->getNumberOfComponents();
3366 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3367 self->accumulate(tmp);
3368 return convertDblArrToPyList(tmp,sz);
3370 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3372 int sz=self->getNumberOfComponents();
3373 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3374 self->integral(isWAbs,tmp);
3375 return convertDblArrToPyList(tmp,sz);
3377 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3379 int sz=self->getNumberOfComponents();
3380 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3381 self->getWeightedAverageValue(tmp,isWAbs);
3382 return convertDblArrToPyList(tmp,sz);
3384 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3386 int sz=self->getNumberOfComponents();
3387 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3389 return convertDblArrToPyList(tmp,sz);
3391 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3393 int sz=self->getNumberOfComponents();
3394 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3396 return convertDblArrToPyList(tmp,sz);
3398 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3400 int szArr,sw,iTypppArr;
3401 std::vector<int> stdvecTyyppArr;
3402 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3403 self->renumberCells(tmp,check);
3406 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3408 int szArr,sw,iTypppArr;
3409 std::vector<int> stdvecTyyppArr;
3410 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3411 self->renumberCellsWithoutMesh(tmp,check);
3414 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3416 int szArr,sw,iTypppArr;
3417 std::vector<int> stdvecTyyppArr;
3418 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3419 self->renumberNodes(tmp,eps);
3422 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3424 int szArr,sw,iTypppArr;
3425 std::vector<int> stdvecTyyppArr;
3426 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3427 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3430 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3434 std::vector<int> multiVal;
3435 std::pair<int, std::pair<int,int> > slic;
3436 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3437 const MEDCouplingMesh *mesh=self->getMesh();
3439 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3440 int nbc=mesh->getNumberOfCells();
3441 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3448 std::ostringstream oss;
3449 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3450 throw INTERP_KERNEL::Exception(oss.str().c_str());
3453 return self->buildSubPart(&singleVal,&singleVal+1);
3458 int tmp=nbc+singleVal;
3459 return self->buildSubPart(&tmp,&tmp+1);
3463 std::ostringstream oss;
3464 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3465 throw INTERP_KERNEL::Exception(oss.str().c_str());
3471 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3475 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3480 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3481 daIntTyypp->checkAllocated();
3482 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3485 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3489 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3491 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";
3492 if(PyTuple_Check(li))
3494 Py_ssize_t sz=PyTuple_Size(li);
3496 throw INTERP_KERNEL::Exception(msg);
3497 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3500 std::vector<int> multiVal;
3501 std::pair<int, std::pair<int,int> > slic;
3502 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3503 if(!self->getArray())
3504 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3506 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3507 catch(INTERP_KERNEL::Exception& e)
3508 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3509 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3510 DataArrayDouble *ret0Arr=ret0->getArray();
3512 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3517 std::vector<int> v2(1,singleVal);
3518 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3519 ret0->setArray(aarr);
3524 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3525 ret0->setArray(aarr);
3530 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3531 std::vector<int> v2(nbOfComp);
3532 for(int i=0;i<nbOfComp;i++)
3533 v2[i]=slic.first+i*slic.second.second;
3534 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3535 ret0->setArray(aarr);
3539 throw INTERP_KERNEL::Exception(msg);
3544 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3547 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3550 double r1=self->getMaxValue2(tmp);
3551 PyObject *ret=PyTuple_New(2);
3552 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3553 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3557 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3560 double r1=self->getMinValue2(tmp);
3561 PyObject *ret=PyTuple_New(2);
3562 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3563 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3567 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3569 std::vector<int> tmp;
3570 convertPyToNewIntArr3(li,tmp);
3571 return self->keepSelectedComponents(tmp);
3574 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3576 std::vector<int> tmp;
3577 convertPyToNewIntArr3(li,tmp);
3578 self->setSelectedComponents(f,tmp);
3581 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3584 DataArrayDouble *a,*a2;
3585 DataArrayDoubleTuple *aa,*aa2;
3586 std::vector<double> bb,bb2;
3589 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3590 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3591 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3592 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3594 return self->extractSlice3D(orig,vect,eps);
3597 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3599 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3602 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3604 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3607 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3609 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.";
3610 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3613 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3615 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3617 return (*self)-(*other);
3619 throw INTERP_KERNEL::Exception(msg);
3624 DataArrayDoubleTuple *aa;
3625 std::vector<double> bb;
3627 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3632 if(!self->getArray())
3633 throw INTERP_KERNEL::Exception(msg2);
3634 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3635 ret->applyLin(1.,-val);
3636 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3637 ret2->setArray(ret);
3642 if(!self->getArray())
3643 throw INTERP_KERNEL::Exception(msg2);
3644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3645 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3646 ret2->setArray(ret);
3651 if(!self->getArray())
3652 throw INTERP_KERNEL::Exception(msg2);
3653 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3654 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3655 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3656 ret2->setArray(ret);
3661 if(!self->getArray())
3662 throw INTERP_KERNEL::Exception(msg2);
3663 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3664 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3665 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3666 ret2->setArray(ret);
3670 { throw INTERP_KERNEL::Exception(msg); }
3674 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3676 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3679 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3681 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3684 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3686 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3689 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3691 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.";
3692 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3695 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3697 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3699 return (*self)/(*other);
3701 throw INTERP_KERNEL::Exception(msg);
3706 DataArrayDoubleTuple *aa;
3707 std::vector<double> bb;
3709 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3715 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3716 if(!self->getArray())
3717 throw INTERP_KERNEL::Exception(msg2);
3718 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3719 ret->applyLin(1./val,0);
3720 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3721 ret2->setArray(ret);
3726 if(!self->getArray())
3727 throw INTERP_KERNEL::Exception(msg2);
3728 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3729 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3730 ret2->setArray(ret);
3735 if(!self->getArray())
3736 throw INTERP_KERNEL::Exception(msg2);
3737 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3738 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3739 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3740 ret2->setArray(ret);
3745 if(!self->getArray())
3746 throw INTERP_KERNEL::Exception(msg2);
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3748 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3749 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3750 ret2->setArray(ret);
3754 { throw INTERP_KERNEL::Exception(msg); }
3758 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3760 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3763 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3765 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.";
3766 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3769 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3771 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3773 return (*self)^(*other);
3775 throw INTERP_KERNEL::Exception(msg);
3780 DataArrayDoubleTuple *aa;
3781 std::vector<double> bb;
3783 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3788 if(!self->getArray())
3789 throw INTERP_KERNEL::Exception(msg2);
3790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3792 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3793 ret2->setArray(ret);
3798 if(!self->getArray())
3799 throw INTERP_KERNEL::Exception(msg2);
3800 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3801 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3802 ret2->setArray(ret);
3807 if(!self->getArray())
3808 throw INTERP_KERNEL::Exception(msg2);
3809 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3810 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3811 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3812 ret2->setArray(ret);
3817 if(!self->getArray())
3818 throw INTERP_KERNEL::Exception(msg2);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3820 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3821 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3822 ret2->setArray(ret);
3826 { throw INTERP_KERNEL::Exception(msg); }
3830 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3832 return self->negate();
3835 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3837 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.";
3838 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3841 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3843 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3847 Py_XINCREF(trueSelf);
3851 throw INTERP_KERNEL::Exception(msg);
3856 DataArrayDoubleTuple *aa;
3857 std::vector<double> bb;
3859 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3864 if(!self->getArray())
3865 throw INTERP_KERNEL::Exception(msg2);
3866 self->getArray()->applyLin(1.,val);
3867 Py_XINCREF(trueSelf);
3872 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3875 Py_XINCREF(trueSelf);
3880 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3881 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3882 ret2->setArray(aaa);
3884 Py_XINCREF(trueSelf);
3889 if(!self->getArray())
3890 throw INTERP_KERNEL::Exception(msg2);
3891 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3892 self->getArray()->addEqual(aaa);
3893 Py_XINCREF(trueSelf);
3897 { throw INTERP_KERNEL::Exception(msg); }
3901 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3903 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.";
3904 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3907 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3909 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3913 Py_XINCREF(trueSelf);
3917 throw INTERP_KERNEL::Exception(msg);
3922 DataArrayDoubleTuple *aa;
3923 std::vector<double> bb;
3925 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3930 if(!self->getArray())
3931 throw INTERP_KERNEL::Exception(msg2);
3932 self->getArray()->applyLin(1.,-val);
3933 Py_XINCREF(trueSelf);
3938 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3941 Py_XINCREF(trueSelf);
3946 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3947 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3948 ret2->setArray(aaa);
3950 Py_XINCREF(trueSelf);
3955 if(!self->getArray())
3956 throw INTERP_KERNEL::Exception(msg2);
3957 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3958 self->getArray()->substractEqual(aaa);
3959 Py_XINCREF(trueSelf);
3963 { throw INTERP_KERNEL::Exception(msg); }
3967 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3969 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.";
3970 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3973 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3975 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3979 Py_XINCREF(trueSelf);
3983 throw INTERP_KERNEL::Exception(msg);
3988 DataArrayDoubleTuple *aa;
3989 std::vector<double> bb;
3991 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3996 if(!self->getArray())
3997 throw INTERP_KERNEL::Exception(msg2);
3998 self->getArray()->applyLin(val,0);
3999 Py_XINCREF(trueSelf);
4004 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4007 Py_XINCREF(trueSelf);
4012 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4013 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4014 ret2->setArray(aaa);
4016 Py_XINCREF(trueSelf);
4021 if(!self->getArray())
4022 throw INTERP_KERNEL::Exception(msg2);
4023 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4024 self->getArray()->multiplyEqual(aaa);
4025 Py_XINCREF(trueSelf);
4029 { throw INTERP_KERNEL::Exception(msg); }
4033 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4035 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.";
4036 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4039 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4041 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4045 Py_XINCREF(trueSelf);
4049 throw INTERP_KERNEL::Exception(msg);
4054 DataArrayDoubleTuple *aa;
4055 std::vector<double> bb;
4057 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4063 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4064 if(!self->getArray())
4065 throw INTERP_KERNEL::Exception(msg2);
4066 self->getArray()->applyLin(1./val,0);
4067 Py_XINCREF(trueSelf);
4072 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4075 Py_XINCREF(trueSelf);
4080 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4081 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4082 ret2->setArray(aaa);
4084 Py_XINCREF(trueSelf);
4089 if(!self->getArray())
4090 throw INTERP_KERNEL::Exception(msg2);
4091 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4092 self->getArray()->divideEqual(aaa);
4093 Py_XINCREF(trueSelf);
4097 { throw INTERP_KERNEL::Exception(msg); }
4101 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4103 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.";
4104 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4107 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4109 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4113 Py_XINCREF(trueSelf);
4117 throw INTERP_KERNEL::Exception(msg);
4122 DataArrayDoubleTuple *aa;
4123 std::vector<double> bb;
4125 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4130 if(!self->getArray())
4131 throw INTERP_KERNEL::Exception(msg2);
4132 self->getArray()->applyPow(val);
4133 Py_XINCREF(trueSelf);
4138 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4141 Py_XINCREF(trueSelf);
4146 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4147 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4148 ret2->setArray(aaa);
4150 Py_XINCREF(trueSelf);
4155 if(!self->getArray())
4156 throw INTERP_KERNEL::Exception(msg2);
4157 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4158 self->getArray()->powEqual(aaa);
4159 Py_XINCREF(trueSelf);
4163 { throw INTERP_KERNEL::Exception(msg); }
4167 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4169 std::vector<const MEDCouplingFieldDouble *> tmp;
4170 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4171 return MEDCouplingFieldDouble::MergeFields(tmp);
4174 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4176 std::vector<const MEDCouplingFieldDouble *> tmp;
4177 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4178 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4183 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4186 int getNumberOfFields() const;
4187 MEDCouplingMultiFields *deepCpy() const;
4188 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4189 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4190 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4191 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4192 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4195 std::string __str__() const throw(INTERP_KERNEL::Exception)
4197 return self->simpleRepr();
4199 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4201 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4202 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4204 std::vector<MEDCouplingFieldDouble *> fs(sz);
4205 for(int i=0;i<sz;i++)
4206 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4207 return MEDCouplingMultiFields::New(fs);
4209 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4211 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4212 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4214 std::vector<MEDCouplingFieldDouble *> fs(sz);
4215 for(int i=0;i<sz;i++)
4216 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4217 return MEDCouplingMultiFields::New(fs);
4219 PyObject *getFields() const
4221 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4222 int sz=fields.size();
4223 PyObject *res = PyList_New(sz);
4224 for(int i=0;i<sz;i++)
4228 fields[i]->incrRef();
4229 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4233 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4238 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4240 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4244 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4247 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4249 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4251 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4253 PyObject *res = PyList_New(sz);
4254 for(int i=0;i<sz;i++)
4259 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4263 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4268 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4270 std::vector<int> refs;
4271 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4273 PyObject *res = PyList_New(sz);
4274 for(int i=0;i<sz;i++)
4279 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4283 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4287 PyObject *ret=PyTuple_New(2);
4288 PyTuple_SetItem(ret,0,res);
4289 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4292 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4294 std::vector<DataArrayDouble *> ms=self->getArrays();
4296 PyObject *res = PyList_New(sz);
4297 for(int i=0;i<sz;i++)
4302 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4306 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4311 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4313 std::vector< std::vector<int> > refs;
4314 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4316 PyObject *res = PyList_New(sz);
4317 PyObject *res2 = PyList_New(sz);
4318 for(int i=0;i<sz;i++)
4323 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4327 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4329 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4332 PyObject *ret=PyTuple_New(2);
4333 PyTuple_SetItem(ret,0,res);
4334 PyTuple_SetItem(ret,1,res2);
4340 class MEDCouplingDefinitionTime
4343 MEDCouplingDefinitionTime();
4344 void assign(const MEDCouplingDefinitionTime& other);
4345 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4346 double getTimeResolution() const;
4347 std::vector<double> getHotSpotsTime() const;
4350 std::string __str__() const throw(INTERP_KERNEL::Exception)
4352 std::ostringstream oss;
4353 self->appendRepr(oss);
4357 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4359 int meshId,arrId,arrIdInField,fieldId;
4360 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4361 PyObject *res=PyList_New(4);
4362 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4363 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4364 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4365 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4369 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4371 int meshId,arrId,arrIdInField,fieldId;
4372 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4373 PyObject *res=PyList_New(4);
4374 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4375 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4376 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4377 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4383 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4386 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4387 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4391 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4393 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4394 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4396 std::vector<MEDCouplingFieldDouble *> fs(sz);
4397 for(int i=0;i<sz;i++)
4398 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4399 return MEDCouplingFieldOverTime::New(fs);
4401 std::string __str__() const throw(INTERP_KERNEL::Exception)
4403 return self->simpleRepr();
4405 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4407 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4408 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4410 std::vector<MEDCouplingFieldDouble *> fs(sz);
4411 for(int i=0;i<sz;i++)
4412 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4413 return MEDCouplingFieldOverTime::New(fs);
4421 __filename=os.environ.get('PYTHONSTARTUP')
4422 if __filename and os.path.isfile(__filename):
4423 execfile(__filename)