Lattice.hpp
1 /*---------------------------------------------------------------------------*\
2 *
3 * mimmo
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of mimmo.
10 *
11 * mimmo is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * mimmo is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22 *
23 \*---------------------------------------------------------------------------*/
24 #ifndef __LATTICE_HPP__
25 #define __LATTICE_HPP__
26 
27 #include "BasicMeshes.hpp"
28 #include "BaseManipulation.hpp"
29 
30 namespace mimmo{
31 
103 class Lattice: public BaseManipulation, public UStructMesh {
104 
105 protected:
106  int m_np;
109 public:
110  Lattice();
111  Lattice(const bitpit::Config::Section & rootXML);
112  virtual ~Lattice();
113 
114  //copy operators/constructors
115  Lattice(const Lattice & other);
116 
117  void buildPorts();
118  void clearLattice();
119  int getNNodes();
122 
123  int accessDOFFromGrid(int index);
124  int accessGridFromDOF(int index);
127 
128  void plotGrid(std::string directory, std::string filename, int counter, bool binary);
129  void plotCloud(std::string directory, std::string filename, int counter, bool binary);
130 
131  virtual bool build();
132  void execute();
133 
134  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name = "");
135  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name= "");
136 
137 protected:
138  void swap(Lattice & ) noexcept;
139  void resizeMapDof();
140  virtual void plotOptionalResults();
141 
142 private:
143  int reduceDimToDOF(int,int,int, bvector1D &info);
144 
145 };
146 
147 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__LATTICE_HPP__)
148 REGISTER_PORT(M_DIMENSION, MC_ARRAY3, MD_INT, __LATTICE_HPP__)
149 REGISTER_PORT(M_INFLIMITS, MC_ARRAY3, MD_FLOAT, __LATTICE_HPP__)
150 REGISTER_PORT(M_AXES, MC_ARR3ARR3, MD_FLOAT, __LATTICE_HPP__)
151 REGISTER_PORT(M_SPAN, MC_ARRAY3, MD_FLOAT, __LATTICE_HPP__)
152 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT, __LATTICE_HPP__)
153 REGISTER_PORT(M_SHAPE, MC_SCALAR, MD_SHAPET, __LATTICE_HPP__)
154 REGISTER_PORT(M_COPYSHAPE, MC_SCALAR, MD_SHAPE_, __LATTICE_HPP__)
155 REGISTER_PORT(M_SHAPEI, MC_SCALAR, MD_INT, __LATTICE_HPP__)
156 REGISTER_PORT(M_GLOBAL, MC_VECARR3, MD_FLOAT, __LATTICE_HPP__)
157 REGISTER_PORT(M_LOCAL, MC_VECARR3, MD_FLOAT, __LATTICE_HPP__)
158 
159 REGISTER(BaseManipulation, Lattice, "mimmo.Lattice")
160 
161 }
162 
163 #endif /* __LATTICE_HPP__ */
void execute()
Definition: Lattice.cpp:280
void resizeMapDof()
Definition: Lattice.cpp:524
#define M_GEOM
void plotGrid(std::string directory, std::string filename, int counter, bool binary)
Definition: Lattice.cpp:230
void buildPorts()
Definition: Lattice.cpp:86
#define MC_ARRAY3
dvecarr3E getGlobalCoords()
Definition: Lattice.cpp:135
#define MD_FLOAT
std::vector< bool > bvector1D
std::vector< darray3E > dvecarr3E
virtual bool build()
Definition: Lattice.cpp:270
ivector1D m_intMapDOF
Definition: Lattice.hpp:107
#define MC_ARR3ARR3
#define M_POINT
#define M_DIMENSION
BaseManipulation is the base class of any manipulation object of the library.
#define M_SHAPE
#define M_LOCAL
int getNNodes()
Definition: Lattice.cpp:125
#define M_SHAPEI
#define M_INFLIMITS
int accessDOFFromGrid(int index)
Definition: Lattice.cpp:172
#define MC_SCALAR
std::vector< int > ivector1D
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
#define MD_SHAPE_
#define MD_SHAPET
#define M_SPAN
#define M_AXES
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: Lattice.cpp:383
int accessGridFromDOF(int index)
Definition: Lattice.cpp:183
void swap(Lattice &) noexcept
Definition: Lattice.cpp:74
virtual ~Lattice()
Definition: Lattice.cpp:60
void plotCloud(std::string directory, std::string filename, int counter, bool binary)
Definition: Lattice.cpp:251
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: Lattice.cpp:292
#define MD_MIMMO_
dvecarr3E getLocalCoords()
Definition: Lattice.cpp:153
Class for 3D uniform structured mesh.
Definition: BasicMeshes.hpp:44
#define M_COPYSHAPE
void clearLattice()
Definition: Lattice.cpp:115
#define M_GLOBAL
virtual void plotOptionalResults()
Definition: Lattice.cpp:446
#define MD_INT
#define MC_VECARR3
Structured 3D Cartesian Mesh.
Definition: Lattice.hpp:103
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206