ProjPrimitivesOnSurfaces.cpp
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 
35 #include "ProjPrimitivesOnSurfaces.hpp"
36 
37 namespace mimmo{
38 
43  m_name = "";
44  m_nC = 1000;
45  m_topo = 0;
46  m_buildSkdTree = false;
47  m_buildKdTree = false;
48 
49 }
50 
55 
60  m_topo = other.m_topo;
61  m_nC = other.m_nC;
64 };
65 
70  m_topo = other.m_topo;
71  m_nC = other.m_nC;
74  *(static_cast<BaseManipulation *>(this)) = *(static_cast<const BaseManipulation *>(&other));
75  return *this;
76 };
77 
83 {
84  std::swap(m_topo, x.m_topo);
85  std::swap(m_nC, x.m_nC);
86  std::swap(m_buildSkdTree, x.m_buildSkdTree);
87  std::swap(m_buildKdTree, x.m_buildKdTree);
88  std::swap(m_patch, x.m_patch);
90 }
91 
95 void
97  bool built = true;
98  built = (built && createPortIn<MimmoSharedPointer<MimmoObject>, ProjPrimitivesOnSurfaces>(this, &mimmo::ProjPrimitivesOnSurfaces::setGeometry,M_GEOM, true));
99 
100  built = (built && createPortOut<MimmoSharedPointer<MimmoObject>, ProjPrimitivesOnSurfaces>(this, &mimmo::ProjPrimitivesOnSurfaces::getProjectedElement, M_GEOM));
101  m_arePortsBuilt = built;
102 }
103 
104 
109 int
111  return m_topo;
112 }
113 
118 int
120  return m_nC;
121 }
122 
123 
130  return m_patch;
131 }
132 
133 
134 
141 void
143  if(geo == nullptr) return;
144  if(geo->getType() != 1) return;
145  m_geometry = geo;
146 };
147 
148 
153 void
155  m_buildSkdTree = build;
156 }
157 
162 void
164  m_buildKdTree = build;
165 }
166 
170 void
172  m_nC = nC;
173 }
174 
180 bool
182  if(m_patch == nullptr) return true;
183  return m_patch->isEmpty();
184 }
185 
189 void
191  m_patch.reset(nullptr);
192  m_nC = 1000;
194 };
195 
200 void
202 
203  if (m_geometry == nullptr){
204  (*m_log)<<"Error in "<<m_name << " : nullptr pointer to linked geometry"<<std::endl;
205  throw std::runtime_error (m_name + " : nullptr pointer to linked geometry");
206  }
207 
208  projection();
209 
210  if(m_patch){
211  if(m_buildSkdTree) m_patch->buildSkdTree();
212  if(m_buildKdTree) m_patch->buildKdTree();
213  }else{
214  (*m_log)<<m_name << " : failed projecting object on target surface"<<std::endl;
215  }
216 };
217 
221 void
223 
224  write(m_patch);
225 
226 };
227 
228 
229 }
#define M_GEOM
MimmoSharedPointer< MimmoObject > m_patch
void setGeometry(MimmoSharedPointer< MimmoObject > geo)
ProjPrimitivesOnSurfaces & operator=(const ProjPrimitivesOnSurfaces &other)
BaseManipulation is the base class of any manipulation object of the library.
void write(MimmoSharedPointer< MimmoObject > geometry)
MimmoSharedPointer< MimmoObject > m_geometry
Class for projecting 1D/2D primitives on a target 3D surface mesh.
void swap(ProjPrimitivesOnSurfaces &x) noexcept
MimmoSharedPointer< MimmoObject > getProjectedElement()
MimmoSharedPointer is a custom implementation of shared pointer.
void swap(BaseManipulation &x) noexcept