"Fossies" - the Fresh Open Source Software Archive

Member "mathmod-branches-r508-trunk/pariso/parametric/Model3D.h" (8 Mar 2021, 5304 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 "Model3D.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  *   Copyright (C) 2021 by Abderrahman Taha                                *
    3  *                                                                         *
    4  *                                                                         *
    5  *   This program is free software; you can redistribute it and/or modify  *
    6  *   it under the terms of the GNU General Public License as published by  *
    7  *   the Free Software Foundation; either version 2 of the License, or     *
    8  *   (at your option) any later version.                                   *
    9  *                                                                         *
   10  *   This program is distributed in the hope that it will be useful,       *
   11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
   12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
   13  *   GNU General Public License for more details.                          *
   14  *                                                                         *
   15  *   You should have received a copy of the GNU General Public License     *
   16  *   along with this program; if not, write to the                         *
   17  *   Free Software Foundation, Inc.,                                       *
   18  *   51 Franklin Street, Fifth Floor,Boston, MA 02110-1301 USA             *
   19  ***************************************************************************/
   20 
   21 #include <map>
   22 #include <vector>
   23 #include <iostream>
   24 #include <string.h>
   25 #include <cmath>
   26 #include "../parisoobject.h"
   27 #include "ND/Matrix4D.h"
   28 #include <qthread.h>
   29 using std::string;
   30 
   31 struct   ParStruct
   32 {
   33     std::string fx;
   34     std::string fy;
   35     std::string fz;
   36     std::string fw;
   37     std::string cnd;
   38     std::string umin;
   39     std::string umax;
   40     std::string vmin;
   41     std::string vmax;
   42     std::string grid;
   43     int  index;
   44 };
   45 
   46 class ParWorkerThread : public WorkerThread
   47 {
   48     Q_OBJECT
   49 public :
   50     uint Ugrid, Vgrid;
   51     FunctionParser * myParserX, * myParserY,* myParserZ, *myParserW, *Fct;
   52     std::vector<double>  v_inf, v_sup,u_inf,u_sup,dif_v,dif_u;
   53     int param4D;
   54     uint CurrentIndex;
   55 
   56 public :
   57     void ParCompute(uint, uint);
   58     void calcul_objet(uint component =0, uint idx=0);
   59     void AllocateParsersForWorkerThread(uint, uint);
   60     void DeleteWorkerParsers();
   61     void run() Q_DECL_OVERRIDE;
   62     ParWorkerThread();
   63     ~ParWorkerThread() override;
   64     void emitMySignal();
   65 signals:
   66     void mySignal(int);
   67 
   68 };
   69 
   70 class ParMasterThread : public MasterThread, public ParWorkerThread
   71 {
   72 public :
   73     FunctionParser *myParserUmin,*myParserUmax,
   74                    *myParserVmin,*myParserVmax;
   75     std::vector<ParStruct> ParamStructs;
   76     uint componentsNumber;
   77     std::string  expression_X, expression_Y, expression_Z, expression_W, expression_CND, inf_u, sup_u, inf_v, sup_v;
   78     int expression_YSize, expression_ZSize, expression_WSize,
   79         inf_uSize, sup_uSize, inf_vSize, sup_vSize;
   80 public :
   81     void InitMasterParsers();
   82     void  HowManyParamSurface(std::string, int);
   83     uint  HowManyVariables(std::string, int);
   84     ErrorMessage parse_expression();
   85     void AllocateParsersForMasterThread();
   86     void AllocateParsersForThread();
   87     void DeleteMasterParsers();
   88     ParMasterThread();
   89     ~ParMasterThread();
   90 };
   91 
   92 /** The representation of a 3D model */
   93 class Par3D : public ParisoObject
   94 {
   95     Q_OBJECT
   96 public:
   97     ParMasterThread *masterthread;
   98     ParWorkerThread *workerthreads;
   99     uint Ugrid, Vgrid;
  100     uint CutV, CutU;
  101     float MINX,MINY,MINZ,MINW,
  102           MAXX,MAXY,MAXZ,MAXW,
  103           DIFX,DIFY,DIFZ,DIFW,
  104           DIFMAXIMUM;
  105     Matrix4D mat4D, mat_rotation4D, mat_rotation_save4D,
  106              mat_homothetie4D, mat_translation4D, mat_inversetranslation4D;
  107     double tetaxy, tetaxz, tetayz, tetaxw, tetayw, tetazw;
  108     int tetaxy_ok, tetaxz_ok, tetayz_ok, tetaxw_ok, tetayw_ok, tetazw_ok, param4D;
  109 public:
  110     Par3D(uint nbThreads, uint nbGrid);
  111     ~Par3D()  override;
  112     void rotation4();
  113     void calcul_points4(uint idx=0);
  114     void Anim_Rot4D (uint idx=0);
  115     void project_4D_to_3D(uint idx=0);
  116     void Invert_boite_englobante4D(uint idx=0);
  117     void boite_englobante4D(uint index=0);
  118     void initialiser_parametres(uint, uint);
  119     void initialiser_LineColumn(uint, uint);
  120     void calcul_Norm(uint i=0);
  121     void make_PolyIndexTri(uint p=0);
  122     void make_PolyIndexMin(uint p=0);
  123     uint CNDCalculation(uint &, struct ComponentInfos *);
  124     void CalculateColorsPoints(struct ComponentInfos *, uint);
  125     void ParamBuild(float **, uint **, uint *,
  126                     uint *, ComponentInfos *,
  127                     uint **,
  128                     uint *,
  129                     uint *);
  130 
  131     void InitShowComponent(struct ComponentInfos *);
  132     void BuildPar();
  133     void UpdateThredsNumber(uint);
  134     void stopcalculations(bool);
  135     void WorkerThreadCopy(ParWorkerThread *);
  136     void MasterThreadCopy(ParMasterThread *);
  137     ErrorMessage ThreadParsersCopy();
  138     ErrorMessage  parse_expression2();
  139     ErrorMessage  ParMorph();
  140     void copycomponent(struct ComponentInfos*, struct ComponentInfos*);
  141     void run() Q_DECL_OVERRIDE;
  142 public :
  143     void emitErrorSignal();
  144     void emitUpdateMessageSignal();
  145 signals:
  146     void ErrorSignal(int);
  147     void UpdateMessageSignal(QString);
  148 };