Create3DCurve.hpp
1 /*----------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Optimad Engineering S.r.l. ("COMPANY") CONFIDENTIAL
6  * Copyright (c) 2015-2021 Optimad Engineering S.r.l., All Rights Reserved.
7  *
8  * --------------------------------------------------------------------------
9  *
10  * NOTICE: All information contained herein is, and remains the property
11  * of COMPANY. The intellectual and technical concepts contained herein are
12  * proprietary to COMPANY and may be covered by Italian and Foreign Patents,
13  * patents in process, and are protected by trade secret or copyright law.
14  * Dissemination of this information or reproduction of this material is
15  * strictly forbidden unless prior written permission is obtained from
16  * COMPANY. Access to the source code contained herein is hereby forbidden
17  * to anyone except current COMPANY employees, managers or contractors who
18  * have executed Confidentiality and Non-disclosure agreements explicitly
19  * covering such access.
20  *
21  * The copyright notice above does not evidence any actual or intended
22  * publication or disclosure of this source code, which includes information
23  * that is confidential and/or proprietary, and is a trade secret, of
24  * COMPANY. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
25  * OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE
26  * EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED, AND IN
27  * VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR
28  * POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY
29  * OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR
30  * TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR
31  * IN PART.
32  *
33 \*----------------------------------------------------------------------------*/
34 #ifndef __CREATE3DCURVE_HPP__
35 #define __CREATE3DCURVE_HPP__
36 
37 #include "BaseManipulation.hpp"
38 
39 namespace mimmo{
40 
106 
107 protected:
108  //members
116  bool m_closed;
117  int m_nCells;
119 public:
120  Create3DCurve();
121  Create3DCurve(const bitpit::Config::Section & rootXML);
122  virtual ~Create3DCurve();
123 
124  Create3DCurve(const Create3DCurve & other);
126 
129 
130  void setRawPoints(dvecarr3E rawPoints);
131  void setRawScalarField(dvector1D rawScalarField);
132  void setRawVectorField(dvecarr3E rawVectorField);
133 
134  void setRawPoints(dmpvecarr3E *rawPoints);
135  void setRawScalarField(dmpvector1D *rawScalarField);
136  void setRawVectorField(dmpvecarr3E *rawVectorField);
137 
138  bool isClosedLoop();
139  void setClosedLoop(bool flag);
140 
141  void setNCells(int nCells);
142 
143  void clear();
144 
145  void execute();
146 
147  void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
148  void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
149 
150 
151 protected:
152  void swap(Create3DCurve & x) noexcept;
153  void buildPorts();
154  void plotOptionalResults();
155 
156 private:
157  int fillPreliminaryStructure(dmpvecarr3E & points, std::unordered_map<long, std::array<long,2> > &connectivity);
158  void refineObject(dmpvecarr3E & points, dmpvector1D & scalarf, dmpvecarr3E & vectorf, std::unordered_map<long, std::array<long,2> > &connectivity, int fCells);
159  //disabling interface method
160  void setGeometry(MimmoSharedPointer<MimmoObject> geometry){BaseManipulation::setGeometry(geometry);};
161 
165  struct greatDist{
169  bool operator()(const std::pair<double,long> & n1, const std::pair<double,long> & n2) const{
170  return n1.first < n2.first;
171  };
172  };
173 };
174 
175 REGISTER_PORT(M_COORDS, MC_VECARR3, MD_FLOAT,__CREATE3DCURVE_HPP__)
176 REGISTER_PORT(M_DISPLS, MC_VECARR3, MD_FLOAT,__CREATE3DCURVE_HPP__)
177 REGISTER_PORT(M_DATAFIELD, MC_VECTOR, MD_FLOAT,__CREATE3DCURVE_HPP__)
178 REGISTER_PORT(M_SCALARFIELD, MC_SCALAR, MD_MPVECFLOAT_,__CREATE3DCURVE_HPP__)
181 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_ ,__CREATE3DCURVE_HPP__)
182 
183 
184 REGISTER(BaseManipulation, Create3DCurve, "mimmo.Create3DCurve")
185 
186 };
187 
188 #endif /* __CREATE3DCURVE_HPP__ */
dmpvector1D * getScalarField()
void swap(Create3DCurve &x) noexcept
#define M_DATAFIELD
#define M_DISPLS
#define M_GEOM
#define MD_FLOAT
void setClosedLoop(bool flag)
std::vector< darray3E > dvecarr3E
Create a 3DCurve from a point cloud.
BaseManipulation is the base class of any manipulation object of the library.
#define M_VECTORFIELD
void setRawVectorField(dvecarr3E rawVectorField)
#define MC_SCALAR
void setNCells(int nCells)
#define MD_MPVECARR3FLOAT_
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
void setRawPoints(dvecarr3E rawPoints)
std::vector< double > dvector1D
void setRawScalarField(dvector1D rawScalarField)
#define MC_VECTOR
#define MD_MIMMO_
void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
#define MD_MPVECFLOAT_
#define M_SCALARFIELD
void setGeometry(MimmoSharedPointer< MimmoObject > geometry)
#define M_VECTORFIELD2
Create3DCurve & operator=(Create3DCurve other)
MimmoSharedPointer is a custom implementation of shared pointer.
dmpvecarr3E * getVectorField()
#define M_COORDS
void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define MC_VECARR3
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206