[asl] 01/33: Fix VTKcasters errors

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu May 5 18:40:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository asl.

commit 375ecb6b039b3f9a6db3db29460a3d45e5dea373
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date:   Tue Sep 22 00:15:03 2015 +0300

    Fix VTKcasters errors
---
 CMakeLists.txt                  |  2 +-
 src/utilities/aslVTKCasters.cxx | 57 ++++++++++++++++++++++++++++++++---------
 src/utilities/aslVTKCasters.h   | 11 ++++++--
 3 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e86a592..88b64cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,7 @@ endif()
 if (WITH_TESTS)
 	# Test labels:
 	# DoublePrecision - tests that use double precision (will fail if device does not support it)
-	# IO - Input/Output tests (may require input files)
+	# IO - Input/Output tests (disabled for now)
 	# Performance - performance tests
 	#
 	# Run them e.g.: `ctest [-C Release|Debug] -L Performance`
diff --git a/src/utilities/aslVTKCasters.cxx b/src/utilities/aslVTKCasters.cxx
index adfa09a..d7b042a 100644
--- a/src/utilities/aslVTKCasters.cxx
+++ b/src/utilities/aslVTKCasters.cxx
@@ -48,12 +48,12 @@ namespace asl
 	template <typename T> void combineArrays(T* d1, unsigned int size, T* dTarget, unsigned int nComponents=1);
 	template <typename T> void combineArrays(T* d1, T* d2, unsigned int size, T* dTarget,unsigned int nComponents=2);	
 	template <typename T> void combineArrays(T* d1, T* d2, T* d3, unsigned int size, T* dTarget,unsigned int nComponents=3);
-	template <typename TO, typename TI> TO* combineArrays(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size);
+	template <typename TO, typename TI> TO* combineArraysX(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size);
 
 	template <typename T> void combineArrays(T* d1,
 	                                         unsigned int size,
 	                                         T* dTarget,
-	                                         unsigned int nComponents = 1)
+	                                         unsigned int nComponents)
 	{
 		if (nComponents < 1)
 			errorMessage("combineArrays() - attempt to provide nComponents that is less than 1");
@@ -65,7 +65,7 @@ namespace asl
 	}
 
 	#define BOOST_TT_rep_expression(r, data, T) \
-		template void combineArrays(T* d1, unsigned int size, T* dTarget, unsigned int nComponents=1);
+		template void combineArrays(T* d1, unsigned int size, T* dTarget, unsigned int nComponents);
 	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
 	#undef BOOST_TT_rep_expression
 	
@@ -73,7 +73,7 @@ namespace asl
 	                                         T* d2,
 	                                         unsigned int size,
 	                                         T* dTarget,
-	                                         unsigned int nComponents = 2)
+	                                         unsigned int nComponents)
 	{
 		if (nComponents < 2)
 			errorMessage("combineArrays() - attempt to provide nComponents that is less than 2");
@@ -86,7 +86,7 @@ namespace asl
 	}
 
 	#define BOOST_TT_rep_expression(r, data, T) \
-			template void combineArrays(T* d1, T* d2, unsigned int size, T* dTarget, unsigned int nComponents=2);
+			template void combineArrays(T* d1, T* d2, unsigned int size, T* dTarget, unsigned int nComponents);
 	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
 	#undef BOOST_TT_rep_expression
 
@@ -95,7 +95,7 @@ namespace asl
 	                                         T* d3,
 	                                         unsigned int size,
 	                                         T* dTarget,
-	                                         unsigned int nComponents = 3)
+	                                         unsigned int nComponents)
 	{
 		if (nComponents < 3)
 			errorMessage("combineArrays() - attempt to provide nComponents that is less than 3");
@@ -109,7 +109,7 @@ namespace asl
 	}
 
 	#define BOOST_TT_rep_expression(r, data, T) \
-		template void combineArrays(T* d1, T* d2, T* d3, unsigned int size, T* dTarget, unsigned int nComponents=3);
+		template void combineArrays(T* d1, T* d2, T* d3, unsigned int size, T* dTarget, unsigned int nComponents);
 	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
 	#undef BOOST_TT_rep_expression
 	
@@ -137,7 +137,7 @@ namespace asl
 	BOOST_PP_SEQ_FOR_EACH(BOOST_TT_rep_expression, ~, BOOST_TT_acl_types)
 	#undef BOOST_TT_rep_expression
 
-	template <typename TO, typename TI> TO* combineArrays(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size)
+	template <typename TO, typename TI> TO* combineArraysX(TI* d0, TI* d1, TI* d2, TI* d3, unsigned int size)
 	{
 		TO* d(new TO[size*4]);
 		for(unsigned int i(0); i < size; ++i)
@@ -150,7 +150,7 @@ namespace asl
 		return d;
 	}
 
-	template vtkIdType* combineArrays<vtkIdType, unsigned int>(unsigned int* d0,
+	template vtkIdType* combineArraysX<vtkIdType, unsigned int>(unsigned int* d0,
 	                                                           unsigned int* d1,
 	                                                           unsigned int* d2,
 	                                                           unsigned int* d3,
@@ -163,7 +163,7 @@ namespace asl
 	template <> class VTKDataArrayClass<cl_uint>{public: typedef vtkUnsignedIntArray T;};
 	template <> class VTKDataArrayClass<cl_long>{public: typedef vtkLongLongArray T;};
 	
-	template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill=0)
+	template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill)
 	{
 		AVec<T> b(3);
 		if (nD(a) == 1)
@@ -291,7 +291,7 @@ namespace asl
 		vtkSmartPointer<vtkIdTypeArray> vtkArray(vtkSmartPointer<vtkIdTypeArray>::New());
 		vtkArray->SetName(name.c_str());
 		vtkArray->SetNumberOfComponents(1);
-		vtkArray->SetArray(combineArrays<vtkIdType, unsigned int>(d0, d1, d2, d3, np), 4 * np, 0);
+		vtkArray->SetArray(combineArraysX<vtkIdType, unsigned int>(d0, d1, d2, d3, np), 4 * np, 0);
 		return vtkArray;
 	}
 
@@ -323,6 +323,40 @@ namespace asl
 	}	
 
 
+	void updateVTKDataArray(acl::Element source,
+	                        vtkSmartPointer<vtkDataArray> vtkData)
+	{
+		if (!isMemBlock(source))
+			errorMessage ("updateVTKDataArray(): provided element is not a MemBlock type");
+
+		if (source->getTypeID() == acl::TYPE_DOUBLE)
+		{
+			double* d((double*)vtkData->GetVoidPointer(0));
+			copy(source, d);
+		}
+		if (source->getTypeID() == acl::TYPE_FLOAT)
+		{
+			float* d((float*)vtkData->GetVoidPointer(0));
+			copy(source, d);
+		}
+		if (source->getTypeID() == acl::TYPE_INT)
+		{
+			int* d =((int*)vtkData->GetVoidPointer(0));
+			copy(source, d);
+		}
+		vtkData->Modified();
+	}
+
+	
+	void updateVTKDataArray(acl::Element source,
+	                        const std::string &name,
+	                        vtkSmartPointer<vtkImageData> vtkData)
+	{
+		auto da(vtkData->GetPointData()->GetScalars(name.c_str()));
+		updateVTKDataArray(source, da);	
+	}
+	
+
 	vtkSmartPointer<vtkImageData> castVTKData(const Block & b)
 	{
 		vtkSmartPointer<vtkImageData> image(vtkSmartPointer<vtkImageData>::New());
@@ -611,4 +645,3 @@ namespace asl
 	
 		
 } // asl
-
diff --git a/src/utilities/aslVTKCasters.h b/src/utilities/aslVTKCasters.h
index 9ed6a8f..e8eae93 100644
--- a/src/utilities/aslVTKCasters.h
+++ b/src/utilities/aslVTKCasters.h
@@ -92,6 +92,13 @@ namespace asl
 	vtkSmartPointer<vtkDataArray> castVTKDataArray(acl::Element source,
 	                                               const std::string &name = "");
 
+	void updateVTKDataArray(acl::Element source,
+	                        vtkSmartPointer<vtkDataArray> vtkData);
+
+	void updateVTKDataArray(acl::Element source,
+	                        const std::string &name,
+	                        vtkSmartPointer<vtkImageData> vtkData);
+
 	vtkSmartPointer<vtkImageData> castVTKData(const Block & b);	
 
 	vtkSmartPointer<vtkImageData> castVTKData(double *d,
@@ -158,12 +165,12 @@ namespace asl
 	template <typename T> AVec<T> castVTKVector(AVec<T> a, T fill = 0);
 
 
-	template <typename T> void combineArrays(T* d1,
+/*	template <typename T> void combineArrays(T* d1,
 	                                         T* d2,
 	                                         T* d3,
 	                                         unsigned int size,
 	                                         T* dTarget,
-	                                         unsigned int nComponents = 3);
+	                                         unsigned int nComponents = 3);*/
 	/// @}
 	
 }  //namespace acl

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git



More information about the debian-science-commits mailing list