]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Convert arrays that contain logical integers to integer arrays.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 13 Jul 2009 12:45:33 +0000 (12:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 13 Jul 2009 12:45:33 +0000 (12:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@19068 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/mesh_conversion/MeshConversion.cc
deal.II/contrib/mesh_conversion/MeshConversion.h

index 3c7f3c2a8aa29a52c85bc56f6bbb3fc44de970e8..bb71ce779f55bdf66a14141f7c0aaac62c06fc66 100755 (executable)
@@ -1,5 +1,8 @@
 #include "MeshConversion.h"
 
+#include <cstdlib>
+
+
 //--------------------------------------------------------------------------------
 
 MeshConversion::MeshConversion (const unsigned int dimension):
@@ -171,14 +174,14 @@ bool MeshConversion::read_in_abaqus_inp (const std::string filename)
                                       (from_string<float> (temp_float, temp_data[k + 3 + j*(data_per_cell)], std::dec) == true))
                                {
                                        // Initilise storage variables
-                                       std::vector <double> cell (data_per_cell);
+                                       std::vector <int> cell (data_per_cell);
                                        
                                        // Material id
                                        cell[0] = material_id;
                                        
                                        // Convert from string to the variable types
                                        for (int i = 1; i < data_per_cell; ++i)
-                                               from_string<double> (cell[i], temp_data[k + 3 + j*(data_per_cell) + i], std::dec);
+                                               from_string<int> (cell[i], temp_data[k + 3 + j*(data_per_cell) + i], std::dec);
                                                
                                        // Add to the global node number vector
                                        cell_list.push_back(cell);
@@ -229,8 +232,8 @@ bool MeshConversion::read_in_abaqus_inp (const std::string filename)
                                                face_cell_face_no += (face_cell_face_no_temp[face_cell_face_no_temp.length() - m - 1] - 48 /* ASCII TRICKS */) * pow(10.0,m);
                                        
                                        // Initilise storage variables
-                                       std::vector <double> quad (data_per_quad);
-                                       std::vector <double> quad_node_list (node_per_face);
+                                       std::vector <int> quad (data_per_quad);
+                                       std::vector <int> quad_node_list (node_per_face);
                                        
                                        quad_node_list = get_global_node_numbers(face_cell_no, face_cell_face_no);
                                        
@@ -259,9 +262,9 @@ bool MeshConversion::read_in_abaqus_inp (const std::string filename)
 
 //--------------------------------------------------------------------------------
 
-std::vector <double> MeshConversion::get_global_node_numbers (const int face_cell_no, const int face_cell_face_no) 
+std::vector <int> MeshConversion::get_global_node_numbers (const int face_cell_no, const int face_cell_face_no) 
 {
-       std::vector <double> quad_node_list (node_per_face);
+       std::vector <int> quad_node_list (node_per_face);
        
        if (dimension == 2)
        {
@@ -409,7 +412,7 @@ bool MeshConversion::write_out_avs_ucd (const std::string filename)
        // Write out cell node numbers
        for (unsigned int ii = 0; ii < cell_list.size(); ++ii)
        {
-               output << ii + 1 << "\t" << cell_list[ii][0] << "\t" << (dimension==2 ? "quad" : "hex") << "\t";
+         output << ii + 1 << "\t" << cell_list[ii][0] << "\t" << (dimension==2 ? "quad" : "hex") << "\t";
                for (unsigned int jj = 1; jj < node_per_cell + 1; ++jj)
                        output << cell_list[ii][jj] << "\t";
                
@@ -419,7 +422,7 @@ bool MeshConversion::write_out_avs_ucd (const std::string filename)
        // Write out quad node numbers
        for (unsigned int ii = 0; ii < face_list.size(); ++ii)
        {
-               output << ii + 1 << "\t" << face_list[ii][0] << "\t" << (dimension==2 ? "line" : "quad") << "\t";
+         output << ii + 1 << "\t" << (int)face_list[ii][0] << "\t" << (dimension==2 ? "line" : "quad") << "\t";
                for (unsigned int jj = 1; jj < node_per_face + 1; ++jj)
                        output << face_list[ii][jj] << "\t";
                
index c44a384da715dc3c01964c92f12e84a95661ca03..b5c681cf0b9d360d846e23726e2b43cb61cbbe7a 100755 (executable)
@@ -23,7 +23,7 @@ class MeshConversion
 
        private:
                void greeting ();
-               std::vector <double> get_global_node_numbers(const int face_cell_no, const int face_cell_face_no);
+               std::vector <int> get_global_node_numbers(const int face_cell_no, const int face_cell_face_no);
                
                const double                            tolerance;
                const unsigned int                      dimension;
@@ -36,8 +36,8 @@ class MeshConversion
                std::string                             output_file_name;
                
                std::vector< std::vector<double> >      node_list;      // Stored as [ global node-id (int), x-coord, y-coord, z-coord ]
-               std::vector< std::vector<double> >      cell_list;      // Stored as [ material-id (int), node1, node2, node3, node4, node5, node6, node7, node8 ]
-               std::vector< std::vector<double> >      face_list;      // Stored as [ sideset-id (int), node1, node2, node3, node4 ]
+               std::vector< std::vector<int> >         cell_list;      // Stored as [ material-id (int), node1, node2, node3, node4, node5, node6, node7, node8 ]
+               std::vector< std::vector<int> >         face_list;      // Stored as [ sideset-id (int), node1, node2, node3, node4 ]
 };
 
 #endif // MESH_CONVERSION_H

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.