Salome HOME
test h019 simplified
[modules/hydro.git] / src / HYDROPy / HYDROData_CompleteCalcCase.sip
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 %ExportedHeaderCode
20 #include <HYDROData_CompleteCalcCase.h>
21 #include <HYDROData_Document.h>
22 %End
23
24 class HYDROData_CompleteCalcCase
25 {
26
27 %TypeHeaderCode
28 //#define _DEVDEBUG_
29 #include "HYDRO_trace.hxx"
30 #include <HYDROData_CompleteCalcCase.h>
31 #include <HYDROData_Document.h>
32 %End
33
34 public:
35
36   /**
37    * Add new geometry object for calculation case.
38    */
39   static SIP_PYTUPLE AddObjects( HYDROData_Document doc,
40                                  HYDROData_CalculationCase theCalcCase,
41                                  std::vector<HYDROData_Entity*> theNewObjects, 
42                                  bool IsUseOrigNamingOfNewRegions)
43                         [ bool ( const opencascade::handle<HYDROData_Document>&,
44                                  opencascade::handle<HYDROData_CalculationCase>&,
45                                  NCollection_Sequence<opencascade::handle<HYDROData_Entity> >,
46                                  bool,
47                                  bool&,
48                                  NCollection_Sequence< opencascade::handle<HYDROData_Region> >& )];
49   %MethodCode
50     Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
51     Handle(HYDROData_CalculationCase) aCase = Handle(HYDROData_CalculationCase)::DownCast( createHandle( a1 ) );
52     NCollection_Sequence<Handle(HYDROData_Entity)> objs;
53     for (size_t i = 0; i != a2->size(); i++)
54     {
55         DEBTRACE("item " <<  i);
56         Handle(HYDROData_Entity) anEnt = createHandle( (*a2)[i] );
57         objs.Append(anEnt); 
58     }
59     bool res = false;
60     bool isIntersectionOfNewObj = false;
61     NCollection_Sequence<Handle(HYDROData_Region)> theNewRegions;
62     DEBTRACE(" --- 0");
63     if ( !aDoc.IsNull() && !aCase.IsNull() )
64     {
65         DEBTRACE("before HYDROData_CompleteCalcCase::AddObjects");
66         Py_BEGIN_ALLOW_THREADS
67         res = HYDROData_CompleteCalcCase::AddObjects( aDoc,  aCase, objs, a3, isIntersectionOfNewObj, theNewRegions );
68         Py_END_ALLOW_THREADS
69         DEBTRACE("after");
70         DEBTRACE("res " <<  res);
71         DEBTRACE("isIntersectionOfNewObj " << isIntersectionOfNewObj);
72         DEBTRACE("theNewRegions size " <<  theNewRegions.Size());
73     }
74     PyObject* t;
75     if (res && isIntersectionOfNewObj)
76     {
77         DEBTRACE(" --- 1a");
78         t = Py_BuildValue("(iiO)", res, isIntersectionOfNewObj, theNewRegions);
79         DEBTRACE(" --- 2a");
80     }
81     else
82     {
83         DEBTRACE(" --- 1b");
84         t = Py_BuildValue("(ii)", res, isIntersectionOfNewObj);
85         DEBTRACE(" --- 2b");
86     }
87         
88     sipRes = t;
89   %End
90
91 protected:
92
93   /**
94    * Creates new object in the internal data structure. Use higher level objects 
95    * to create objects with real content.
96    */
97   HYDROData_CompleteCalcCase();
98
99   /**
100    * Destructs properties of the object and object itself, removes it from the document.
101    */
102   ~HYDROData_CompleteCalcCase();
103 };