From ba6c902a2fb58c5ac6f6769097d6cce087e19ac1 Mon Sep 17 00:00:00 2001 From: akva Date: Thu, 22 Sep 2011 07:50:42 +0000 Subject: [PATCH] added: LR spline support in the HDF5 to VTx converter git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1172 e10b68d5-8a6e-419e-a041-bce267b0401d --- Apps/HDF5toVTx/HDF5toVTx.C | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/Apps/HDF5toVTx/HDF5toVTx.C b/Apps/HDF5toVTx/HDF5toVTx.C index 97a2e3e8..999a1342 100644 --- a/Apps/HDF5toVTx/HDF5toVTx.C +++ b/Apps/HDF5toVTx/HDF5toVTx.C @@ -20,10 +20,15 @@ #include "ASMs1D.h" #include "ASMs2D.h" #include "ASMs3D.h" +#if HAS_LRSPLINE == 1 +#include "LR/ASMu2D.h" +#endif #include "ElementBlock.h" #include "VTF.h" #include "VTU.h" +#include + typedef std::map< std::string,std::vector > ProcessList; typedef std::map< std::string, std::vector > VTFList; @@ -41,12 +46,24 @@ std::vector readBasis(const std::string& name, hdf.readString(geom.str(),out); std::stringstream basis; basis << out; - if (dim == 1) - result.push_back(new ASMs1D(basis,1,1)); - if (dim == 2) - result.push_back(new ASMs2D(basis,2,1)); - if (dim == 3) - result.push_back(new ASMs3D(basis,false,1)); + if (out.substr(0,10) == "# LRSPLINE") { + switch (dim) { +#if HAS_LRSPLINE == 1 + case 2: + result.push_back(new ASMu2D(basis,2,1)); + break; +#endif + default: + assert(0); + } + } else { + if (dim == 1) + result.push_back(new ASMs1D(basis,1,1)); + if (dim == 2) + result.push_back(new ASMs2D(basis,2,1)); + if (dim == 3) + result.push_back(new ASMs3D(basis,false,1)); + } result.back()->generateFEMTopology(); } @@ -140,6 +157,10 @@ void writePatchGeometry(ASMbase* patch, int id, VTF& myVtf, int* nViz) } +#define TRY(x,y) { x* t = dynamic_cast(y); \ + if (t) \ + t->getGridParameters(gpar[k],k,n[k]-1); \ + } std::vector generateFEModel(std::vector patches, int dims, int* n) { @@ -148,8 +169,8 @@ std::vector generateFEModel(std::vector patches, RealArray* gpar = new RealArray[dims]; for (int k=0;kgetGridParameters(gpar[k],k,n[k]-1); + TRY(ASMu2D,patches[i]) + TRY(ASMs2D,patches[i]) } if (dims == 3) { ASMs3D* patch = (ASMs3D*)patches[i];