"Fossies" - the Fresh Open Source Software Archive

Member "mathmod-branches-r508-trunk/pariso/isosurface/Iso3D.h" (8 Mar 2021, 5393 Bytes) of package /linux/misc/mathmod-11.0-source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Iso3D.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 10.1_vs_11.0.

    1 
    2 /***************************************************************************
    3  *   Copyright (C) 2021 by Abderrahman Taha                                *
    4  *                                                                         *
    5  *                                                                         *
    6  *   This program is free software; you can redistribute it and/or modify  *
    7  *   it under the terms of the GNU General Public License as published by  *
    8  *   the Free Software Foundation; either version 2 of the License, or     *
    9  *   (at your option) any later version.                                   *
   10  *                                                                         *
   11  *   This program is distributed in the hope that it will be useful,       *
   12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
   13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
   14  *   GNU General Public License for more details.                          *
   15  *                                                                         *
   16  *   You should have received a copy of the GNU General Public License     *
   17  *   along with this program; if not, write to the                         *
   18  *   Free Software Foundation, Inc.,                                       *
   19  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
   20  ***************************************************************************/
   21 
   22 #include <iostream>
   23 #include <string.h>
   24 #include <deque>
   25 #include <cmath>
   26 #include "../parisoobject.h"
   27 
   28 /*
   29 
   30 
   31                      4.-----------4----------------.5
   32                      /|                                     /|
   33                     7 |                                 5 |
   34                    /  |                                  /  |
   35                  7.---|-----------6------------.6  |
   36                   |   |                                 |   |
   37                   |   8                               |   9
   38                   |   |                                 |   |
   39                   |   ^ j                               |   |
   40                11   |                               10   |
   41                   |   |     i                           |   |
   42                   |  0.----->-----0------------|---.1
   43                   |  /                                  |  /
   44                   | 3 k                               | 1
   45                   |/                                    |/
   46                  3.---------------2------------.2
   47 */
   48 
   49 
   50 class IsoWorkerThread : public WorkerThread
   51 {
   52     Q_OBJECT
   53 public :
   54     FunctionParser *implicitFunctionParser, *Fct;
   55     uint XYZgrid;
   56     bool AllComponentTraited;
   57     uint GridVal;
   58     std::vector<double> xLocal2, yLocal2, zLocal2;
   59 public :
   60     void IsoCompute(uint);
   61     void VoxelEvaluation(uint);
   62     void AllocateParsersForWorkerThread(uint,uint);
   63     void DeleteWorkerParsers();
   64     void run() Q_DECL_OVERRIDE;
   65     IsoWorkerThread();
   66     ~IsoWorkerThread() override;
   67     void emitMySignal();
   68 signals:
   69     void mySignal(int);
   70 };
   71 
   72 class IsoMasterThread : public MasterThread, public IsoWorkerThread
   73 {
   74 public :
   75     FunctionParser *xSupParser, *xInfParser,
   76                    *ySupParser, *yInfParser,
   77                    *zSupParser, *zInfParser;
   78     std::string ImplicitFunction, Condition,
   79         XlimitSup, XlimitInf,
   80         YlimitSup, YlimitInf,
   81         ZlimitSup, ZlimitInf;
   82     uint componentsNumber;
   83     std::vector<double> x_Step, y_Step, z_Step, x_Sup, y_Sup, z_Sup,x_Inf, y_Inf, z_Inf;
   84     std::vector<ImplicitStructure> ImplicitStructs;
   85 public :
   86     void DeleteMasterParsers();
   87     void AllocateMasterParsers();
   88     void InitMasterParsers();
   89     inline ErrorMessage ParseExpression();
   90     uint HowManyIsosurface(std::string,uint);
   91     uint HowManyVariables(std::string, uint);
   92     ErrorMessage ParserIso();
   93     void IsoMasterTable();
   94     void initparser();
   95     void initgrid();
   96     IsoMasterThread();
   97     ~IsoMasterThread();
   98 };
   99 
  100 class Iso3D  : public ParisoObject
  101 {
  102     Q_OBJECT
  103 public :
  104     IsoWorkerThread *workerthreads;
  105     IsoMasterThread *masterthread;
  106 public :
  107     Iso3D(uint nbThreads=8,
  108           uint nbGrid=40,
  109           uint factX=4,
  110           uint factY=4,
  111           uint factZ=4);
  112     ~Iso3D() override;
  113     inline void SignatureComputation();
  114     inline uint ConstructIsoSurface();
  115     inline void ConstructIsoNormale(uint);
  116     inline uint PointEdgeComputation(uint);
  117     inline uint CNDCalculation(uint &, struct ComponentInfos *);
  118     void Setgrid(uint);
  119     void IsoBuild(float **, uint **, uint *,unsigned  int *, uint **,unsigned  int *, unsigned  int *, struct ComponentInfos *);
  120     void InitShowComponent(struct ComponentInfos *);
  121     void SaveIsoGLMap(uint);
  122     uint SetMiniMmeshStruct();
  123     void CalculateColorsPoints(struct ComponentInfos*, uint index);
  124     void BuildIso();
  125     void UpdateNbMaxGrid(int);
  126     void UpdateThredsNumber(uint);
  127     void stopcalculations(bool);
  128     void WorkerThreadCopy(IsoWorkerThread *);
  129     ErrorMessage IsoMorph();
  130     ErrorMessage parse_expression2();
  131     ErrorMessage ThreadParsersCopy();
  132     void ReinitVarTablesWhenMorphActiv(uint);
  133     void copycomponent(struct ComponentInfos*, struct ComponentInfos*);
  134     void run() Q_DECL_OVERRIDE;
  135 public :
  136     void emitErrorSignal();
  137     void emitUpdateMessageSignal();
  138 signals:
  139     void ErrorSignal(int);
  140     void UpdateMessageSignal(QString);
  141 };