NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
ep16Post.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_EP16POST_H_
30 #define NEMOSYS_EP16POST_H_
31 
32 #ifdef HAVE_EPIC
33 
34 #include "nemosys_export.h"
35 
36 #include <memory>
37 #include <iostream>
38 
39 #include <jsoncons/json.hpp>
40 
41 namespace NEM {
42 
43 namespace EPC {
44 
45 /**
46  @brief Implements methods for post-processing EPIC outputs.
47 **/
48 class NEMOSYS_EXPORT ep16Post
49 {
50  public:
51  /**
52  @breif Contructs using input JSON object containing
53  parameters
54  @param inputjson is the input JSON objec
55  **/
56  explicit ep16Post(const jsoncons::json &inputjson):
57  _jstrm(std::move(inputjson))
58  {};
59 
60  /**
61  @brief Static factory methods used to construct the object with given
62  JSON object.
63  @param jsonFName is the full path to the JSON input file
64  @param inputjson is the JSON input object
65  @param ret is the return value if successful it will be 0
66  **/
67  static ep16Post *readJSON(const std::string &jsonFName);
68  static ep16Post *readJSON(const jsoncons::json &inputjson, int& ret);
69 
70  public:
71  /**
72  @breif Default JSON processing method.
73  @return a non-zero value incase issues happen
74  **/
75  int readJSON();
76 
77  /**
78  @brief Implements a combined KMeans-Quickhull method to identify convex
79  objects from a point cloud
80  @param jtsk is the JSON object describing the task parameters.
81  **/
82  int procErode(const jsoncons::json &jtsk);
83 
84  private:
85  static constexpr int _kmeans_max_itr = 100;
86  jsoncons::json _jstrm;
87 };
88 
89 } // namespace EPC
90 
91 } // namespace NEM
92 
93 #endif // HAVE_EPIC
94 
95 #endif // NEMOSYS_EP16POST_H_
STL namespace.