StiffnessIO.h
Go to the documentation of this file.
1 /*
2 * ==========================================================================
3 * This file is part of the implementation of
4 *
5 * <FrameFab: Robotic Fabrication of Frame Shapes>
6 * Yijiang Huang, Juyong Zhang, Xin Hu, Guoxian Song, Zhongyuan Liu, Lei Yu, Ligang Liu
7 * In ACM Transactions on Graphics (Proc. SIGGRAPH Asia 2016)
8 ----------------------------------------------------------------------------
9 * class: StiffnessIO
10 *
11 * Description: This module takes charge of outputting stiffness matrix related results.
12 *
13 * Version: 1.0
14 * Created: Mar/23/2016
15 * Updated: Aug/24/2016
16 *
17 * Author: Xin Hu, Yijiang Huang, Guoxian Song
18 * Company: GCL@USTC
19 * Citation: Some part of this module is modified from frame3dd_io.c
20 * output related submodule.
21 * Title: Frame3dd source code
22 * Static and dynamic structural analysis of 2D and 3D frames and trusses with
23 * elastic and geometric stiffness.
24 * Author: Henri P. Gavin
25 * Code Version: 20140514+
26 * Availability: http://frame3dd.sourceforge.net/
27 ----------------------------------------------------------------------------
28 * Copyright (C) 2016 Yijiang Huang, Xin Hu, Guoxian Song, Juyong Zhang
29 * and Ligang Liu.
30 *
31 * FrameFab is free software: you can redistribute it and/or modify
32 * it under the terms of the GNU General Public License as published by
33 * the Free Software Foundation, either version 3 of the License, or
34 * (at your option) any later version.
35 *
36 * FrameFab is distributed in the hope that it will be useful,
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 * GNU General Public License for more details.
40 *
41 * You should have received a copy of the GNU General Public License
42 * along with FrameFab. If not, see <http://www.gnu.org/licenses/>.
43 * ==========================================================================
44 */
45 
46 #ifndef STIFFNESS_IO_H
47 #define STIFFNESS_IO_H
48 
49 #include <stdio.h>
50 #include <iostream>
51 #include <fstream>
52 #include <vector>
53 #include <string>
54 #include <Eigen/Dense>
55 
58 
61 
65 
66 #define MYOUT std::cout
67 #define MYEND std::endl
68 
70 {
71  public:
72  typedef Eigen::MatrixXd MX;
73  typedef Eigen::Matrix3d M3;
74  typedef Eigen::VectorXd VX;
75  typedef Eigen::Vector3d V3;
76  typedef Eigen::VectorXi VXi;
77  typedef Eigen::MatrixXi MXi;
78 
79  typedef std::vector<V3> vec3;
80 
81  public:
84 
85  public:
86 
87  void OutputPath(const char *fname, char fullpath[], const int len, char *default_outdir, int verbose);
88 
89  /*--- GnuPlot file output ---*/
90  /*
91  * GnuPltStaticMesh - create mesh data of deformed and undeformed mesh, use gnuplot Mar/20/2016
92  */
93  void GnuPltStaticMesh(
94  const char *fpath,
95  const char *meshpath, const char *plotpath,
96  VX &D,
97  double exagg_static, float scale,
98  DualGraph *ptr_dualgraph, WireFrame *ptr_frame
99  );
100 
101  /*
102  * GnuPltCubicBentBeam - Mar/20/2016
103  * computes cubic deflection functions from end deflections
104  * and end rotations. Saves deflected shapes to a file.
105  * These bent shapes are exact for mode-shapes, and for frames
106  * loaded at their nodes.
107  */
108  void GnuPltCubicBentBeam(
109  vector<point> &beam,
110  VX &D, /* calculated deformation */
111  int dual_i, DualGraph *ptr_dualgraph, WireFrame *ptr_frame,
112  double exagg
113  );
114 
115  /*
116  * WriteInputData - write input data to a .3dd file Mar/20/2016
117  */
118  void WriteInputData(
119  const char *fpath,
120  DualGraph *ptr_dualgraph,
121  FiberPrintPARM *ptr_parm,
122  int verbose
123  );
124 
125  /*
126  * SaveUpperMatrix - save a symmetric matrix of dimension [1..n][1..n] Nov/26/2015
127  * to the named file, use only upper-triangular part
128  */
129  void SaveUpperMatrix(char filename[], const MX &A, int n);
130 
131  /*
132  * SaveDeformVector - save displacement vector of dimemsion [1...6*N] Nov/26/2015
133  * to the named file
134  */ ;
135  void SaveDisplaceVector(char filename[], const VX &D, int n, DualGraph *ptr_dual_graph);
136 
137  public:
138  void dots(FILE *fp, int n)
139  {
140  int i;
141  for (i = 1; i <= n; i++) fprintf(fp, ".");
142  }
143 
144  const char *TempDir()
145  {
146  char *tmp;
147  tmp = getenv("TEMP");
148  if (tmp == NULL) {
149  fprintf(stderr,
150  "ERROR: Environment Variables %%TEMP%% and %%FRAME3DD_OUTDIR%% are not set. "
151  "At least one of these variables must be set so that FrameFab knows where to "
152  "write its temporary files. Set one of these variable, then re-run FrameFab.");
153  exit(15);
154  }
155  return tmp;
156  }
157 
158  private:
160  StiffnessSolver solver_; // solver_: LU decomposition for cubic bent beam computaion
161 };
162 #endif
bool verbose
GLdouble n
Eigen::Vector3d V3
Definition: StiffnessIO.h:75
filename
void GnuPltCubicBentBeam(vector< point > &beam, VX &D, int dual_i, DualGraph *ptr_dualgraph, WireFrame *ptr_frame, double exagg)
GLenum GLenum GLenum GLenum GLenum scale
CoordTrans trsf_
Definition: StiffnessIO.h:159
void GnuPltStaticMesh(const char *fpath, const char *meshpath, const char *plotpath, VX &D, double exagg_static, float scale, DualGraph *ptr_dualgraph, WireFrame *ptr_frame)
Definition: StiffnessIO.cpp:46
std::vector< V3 > vec3
Definition: StiffnessIO.h:79
void dots(FILE *fp, int n)
Definition: StiffnessIO.h:138
Eigen::VectorXi VXi
Definition: StiffnessIO.h:76
Eigen::VectorXd VX
Definition: StiffnessIO.h:74
GLenum GLsizei len
Eigen::Matrix3d M3
Definition: StiffnessIO.h:73
void WriteInputData(const char *fpath, DualGraph *ptr_dualgraph, FiberPrintPARM *ptr_parm, int verbose)
Eigen::MatrixXd MX
Definition: StiffnessIO.h:72
void SaveUpperMatrix(char filename[], const MX &A, int n)
StiffnessSolver solver_
Definition: StiffnessIO.h:160
void SaveDisplaceVector(char filename[], const VX &D, int n, DualGraph *ptr_dual_graph)
Eigen::MatrixXi MXi
Definition: StiffnessIO.h:77
void OutputPath(const char *fname, char fullpath[], const int len, char *default_outdir, int verbose)
Definition: StiffnessIO.cpp:7
const char * TempDir()
Definition: StiffnessIO.h:144


choreo_task_sequence_planner
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:03:14