19 #if (__CUDACC_VER__ < 70500) && !defined(BOOST_RESULT_OF_USE_TR1) 20 #define BOOST_RESULT_OF_USE_TR1 23 #include <boost/config/select_compiler_config.hpp> 35 #pragma GCC diagnostic push 36 #pragma GCC diagnostic error "-Wall" 38 #pragma GCC diagnostic pop 45 #include <alpaka/alpaka.hpp> 46 #include <boost/type_traits.hpp> 47 #include <boost/mpl/not.hpp> 49 #include <boost/mpl/int.hpp> 73 size_t TTransfer_size,
82 using TDevAcc = alpaka::dev::Dev<TAcc>;
83 using TFraDim = alpaka::dim::DimInt<1>;
84 using TTexDim = alpaka::dim::DimInt<1>;
95 json_t *content = json_object();
96 json_array_append_new( jsonRoot, content );
97 json_object_set_new( content,
"name", json_string ( TSource::getName().c_str() ) );
98 json_object_set_new( content,
"feature dimension", json_integer ( s.feature_dim ) );
111 json_t *content = json_object();
112 json_array_append_new( jsonRoot, content );
113 json_object_set_new( content,
"name", json_string ( TFunctor::getName().c_str() ) );
114 json_object_set_new( content,
"description", json_string ( TFunctor::getDescription().c_str() ) );
115 json_object_set_new( content,
"uses parameter", json_boolean ( TFunctor::uses_parameter ) );
130 if (!found && name == TFunctor::getName())
148 const TSource& source,
149 const TFunctions& functions,
157 chain_nr += functions[I].bytecode[i];
159 dest.nr[I] = chain_nr * 4 + TSource::feature_dim - 1;
170 #if ISAAC_ALPAKA == 1 177 const TSource& source,
178 TArray& pointer_array,
179 const TLocalSize& local_size
180 #
if ISAAC_ALPAKA == 1
181 ,TVector& alpaka_vector
182 ,
const TDevAcc__& acc
186 if (TSource::persistent)
187 pointer_array.pointer[I] = NULL;
190 #if ISAAC_ALPAKA == 1 191 alpaka_vector.push_back(
192 alpaka::mem::buf::Buf< TDevAcc, isaac_float, TFraDim, size_t> (
193 alpaka::mem::buf::alloc<isaac_float, size_t> (
195 alpaka::vec::Vec<TFraDim, size_t> (
201 pointer_array.pointer[I] = alpaka::mem::view::getPtrNative( alpaka_vector.back() );
218 #if ISAAC_ALPAKA == 1 225 TArray& pointer_array,
226 const TLocalSize& local_size,
227 const TWeight& weight,
228 const TPointer& pointer
229 #
if ISAAC_ALPAKA == 1
234 bool enabled = weight.value[ I ] !=
isaac_float(0);
235 source.update( enabled, pointer );
236 if (!TSource::persistent && enabled)
238 isaac_size2 grid_size=
243 isaac_size2 block_size=
249 #if ISAAC_ALPAKA == 1 250 #if ALPAKA_ACC_GPU_CUDA_ENABLED == 1 251 if ( mpl::not_<boost::is_same<TAcc, alpaka::acc::AccGpuCudaRt<TAccDim, size_t> > >::value )
256 block_size.x = size_t(1);
257 block_size.y = size_t(1);
259 const alpaka::vec::Vec<TAccDim, size_t> threads (
size_t(1),
size_t(1),
size_t(1));
260 const alpaka::vec::Vec<TAccDim, size_t> blocks (
size_t(1), block_size.x, block_size.y);
261 const alpaka::vec::Vec<TAccDim, size_t> grid (
size_t(1), grid_size.x, grid_size.y);
262 auto const workdiv(alpaka::workdiv::WorkDivMembers<TAccDim, size_t>(grid,blocks,threads));
263 updateBufferKernel<TSource> kernel;
266 alpaka::exec::create<TAcc>
271 pointer_array.pointer[ I ],
275 alpaka::stream::enqueue(stream, instance);
276 alpaka::wait::wait(stream);
278 dim3 block (block_size.x, block_size.y);
279 dim3 grid (grid_size.x, grid_size.y);
280 updateBufferKernel<<<grid,block>>>( source, pointer_array.pointer[ I ], local_size_array );
294 typename TLocalMinmax,
296 #if ISAAC_ALPAKA == 1 303 const TSource& source,
304 TArray& pointer_array,
306 TLocalMinmax& local_minmax,
307 TLocalSize& local_size
308 #
if ISAAC_ALPAKA == 1
314 isaac_size2 grid_size=
316 size_t((local_size[0]+15)/16),
317 size_t((local_size[1]+15)/16),
319 isaac_size2 block_size=
325 minmax_struct local_minmax_array_h[ local_size_array.x * local_size_array.y ];
326 #if ISAAC_ALPAKA == 1 327 #if ALPAKA_ACC_GPU_CUDA_ENABLED == 1 328 if ( mpl::not_<boost::is_same<TAcc, alpaka::acc::AccGpuCudaRt<TAccDim, size_t> > >::value )
331 grid_size.x = size_t(local_size[0]);
332 grid_size.y = size_t(local_size[0]);
333 block_size.x = size_t(1);
334 block_size.y = size_t(1);
336 const alpaka::vec::Vec<TAccDim, size_t> threads (
size_t(1),
size_t(1),
size_t(1));
337 const alpaka::vec::Vec<TAccDim, size_t> blocks (
size_t(1), block_size.x, block_size.y);
338 const alpaka::vec::Vec<TAccDim, size_t> grid (
size_t(1), grid_size.x, grid_size.y);
339 auto const workdiv(alpaka::workdiv::WorkDivMembers<TAccDim, size_t>(grid,blocks,threads));
340 minMaxKernel<TSource> kernel;
343 alpaka::exec::create<TAcc>
349 alpaka::mem::view::getPtrNative(local_minmax),
351 pointer_array.pointer[ I ]
354 alpaka::stream::enqueue(stream, instance);
355 alpaka::wait::wait(stream);
356 alpaka::mem::view::ViewPlainPtr<THost, minmax_struct, TFraDim, size_t> minmax_buffer(local_minmax_array_h, host, alpaka::vec::Vec<TFraDim, size_t>(
size_t(local_size_array.x * local_size_array.y)));
357 alpaka::mem::view::copy( stream, minmax_buffer, local_minmax, alpaka::vec::Vec<TFraDim, size_t>(
size_t(local_size_array.x * local_size_array.y)));
359 dim3 block (block_size.x, block_size.y);
360 dim3 grid (grid_size.x, grid_size.y);
361 minMaxKernel<<<grid,block>>>( source, I, local_minmax, local_size_array, pointer_array.pointer[ I ]);
362 ISAAC_CUDA_CHECK(cudaMemcpy( local_minmax_array_h, local_minmax,
sizeof(
minmax_struct)*local_size_array.x * local_size_array.y, cudaMemcpyDeviceToHost));
364 minmax.min[ I ] = FLT_MAX;
365 minmax.max[ I ] = -FLT_MAX;
366 for (
int i = 0; i < local_size_array.x * local_size_array.y; i++)
368 if ( local_minmax_array_h[i].min < minmax.
min[ I ])
369 minmax.min[ I ] = local_minmax_array_h[i].
min;
370 if ( local_minmax_array_h[i].max > minmax.
max[ I ])
371 minmax.max[ I ] = local_minmax_array_h[i].
max;
377 #
if ISAAC_ALPAKA == 1
382 const std::string name,
384 const std::string server_url,
386 const isaac_size2 framebuffer_size,
387 const TDomainSize global_size,
388 const TDomainSize local_size,
389 const TDomainSize position,
390 TSourceList& sources,
393 #if ISAAC_ALPAKA == 1
398 global_size(global_size),
399 local_size(local_size),
403 server_url(server_url),
404 server_port(server_port),
405 framebuffer_size(framebuffer_size),
406 compbuffer_size(TCompositor::getCompositedbufferSize(framebuffer_size)),
407 compositor(framebuffer_size),
409 visualizationThread(0),
416 interpolation(false),
419 framebuffer_prod(size_t(framebuffer_size.x) * size_t(framebuffer_size.y)),
422 icet_bounding_box( true )
423 #if ISAAC_ALPAKA == 1
424 ,framebuffer(alpaka::mem::buf::alloc<uint32_t, size_t>(acc, framebuffer_prod))
426 ,functor_chain_choose_d(alpaka::mem::buf::alloc<
isaac_functor_chain_pointer_N, size_t>(acc, size_t( boost::mpl::size< TSourceList >::type::value )))
427 ,local_minmax_array_d(alpaka::mem::buf::alloc<
minmax_struct, size_t>(acc, size_t( local_size[0] * local_size[1] )))
431 ISAAC_CUDA_CHECK(cudaMalloc((uint32_t**)&framebuffer,
sizeof(uint32_t)*framebuffer_prod));
436 #if ISAAC_VALGRIND_TWEAKS == 1 442 json_set_alloc_funcs(extra_malloc, extra_free);
445 for (
int i = 0; i < 3; i++)
452 background_color[0] = 0;
453 background_color[1] = 0;
454 background_color[2] = 0;
455 background_color[3] = 1;
458 MPI_Comm_dup(MPI_COMM_WORLD, &mpi_world);
459 MPI_Comm_rank(mpi_world, &rank);
460 MPI_Comm_size(mpi_world, &numProc);
467 this->communicator = NULL;
470 controller.updateProjection( projection, framebuffer_size, NULL,
true );
479 #if ISAAC_ALPAKA == 1 480 const alpaka::vec::Vec<TAccDim, size_t> threads (
size_t(1),
size_t(1),
size_t(1));
481 const alpaka::vec::Vec<TAccDim, size_t> blocks (
size_t(1),
size_t(1),
size_t(1));
482 const alpaka::vec::Vec<TAccDim, size_t> grid (
size_t(1),
size_t(1),
size_t(1));
483 auto const workdiv(alpaka::workdiv::WorkDivMembers<TAccDim, size_t>(grid,blocks,threads));
487 alpaka::exec::create<TAcc>
491 alpaka::mem::view::getPtrNative(functor_chain_d)
494 alpaka::stream::enqueue(stream, instance);
495 alpaka::wait::wait(stream);
499 fillFunctorChainPointerKernel<<<grid,block>>>( functor_chain_d );
503 for (
int i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
504 functions[i].source = std::string(
"idem");
509 #
if ISAAC_ALPAKA == 1
510 ,pointer_array_alpaka
516 for (
int i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
519 #if ISAAC_ALPAKA == 1 520 transfer_d_buf.push_back( alpaka::mem::buf::Buf<TDevAcc, isaac_float4, TTexDim, size_t> ( alpaka::mem::buf::alloc<isaac_float4, size_t>( acc, alpaka::vec::Vec<TTexDim, size_t> ( TTransfer_size ) ) ) );
521 transfer_h_buf.push_back( alpaka::mem::buf::Buf< THost, isaac_float4, TTexDim, size_t> ( alpaka::mem::buf::alloc<isaac_float4, size_t>(host, alpaka::vec::Vec<TTexDim, size_t> ( TTransfer_size ) ) ) );
522 transfer_d.pointer[i] = alpaka::mem::view::getPtrNative( transfer_d_buf[i] );
523 transfer_h.pointer[i] = alpaka::mem::view::getPtrNative( transfer_h_buf[i] );
525 ISAAC_CUDA_CHECK(cudaMalloc((isaac_float4**)&(transfer_d.pointer[i]),
sizeof(isaac_float4)*TTransfer_size));
526 transfer_h.pointer[i] = (isaac_float4*)malloc(
sizeof(isaac_float4)*TTransfer_size );
528 transfer_h.description[i].insert( std::pair< isaac_uint, isaac_float4> (0 ,
getHSVA(
isaac_float(2*i)*M_PI/
isaac_float(boost::mpl::size< TSourceList >::type::value),1,1,0) ));
529 transfer_h.description[i].insert( std::pair< isaac_uint, isaac_float4> (TTransfer_size,
getHSVA(
isaac_float(2*i)*M_PI/
isaac_float(boost::mpl::size< TSourceList >::type::value),1,1,1) ));
533 max_size =
ISAAC_MAX(uint32_t(global_size[0]),uint32_t(global_size[1]));
534 if (TSimDim::value > 2)
535 max_size =
ISAAC_MAX(uint32_t(global_size[2]),uint32_t(max_size));
536 max_size_scaled =
ISAAC_MAX(uint32_t(global_size_scaled[0]),uint32_t(global_size_scaled[1]));
537 if (TSimDim::value > 2)
538 max_size_scaled =
ISAAC_MAX(uint32_t(global_size_scaled[2]),uint32_t(max_size_scaled));
541 IceTCommunicator icetComm;
542 icetComm = icetCreateMPICommunicator(mpi_world);
543 for (
int pass = 0; pass < TController::pass_count; pass++)
545 icetContext[pass] = icetCreateContext(icetComm);
547 icetAddTile(0, 0, framebuffer_size.x, framebuffer_size.y, master);
549 icetStrategy(ICET_STRATEGY_SEQUENTIAL);
553 icetSingleImageStrategy( ICET_SINGLE_IMAGE_STRATEGY_BSWAP );
564 icetSetColorFormat(ICET_IMAGE_COLOR_RGBA_UBYTE);
565 icetSetDepthFormat(ICET_IMAGE_DEPTH_NONE);
566 icetCompositeMode(ICET_COMPOSITE_MODE_BLEND);
567 icetEnable(ICET_ORDERED_COMPOSITE);
568 icetPhysicalRenderSize(framebuffer_size.x, framebuffer_size.y);
569 icetDrawCallback( drawCallBack );
571 icetDestroyMPICommunicator(icetComm);
577 json_object_set_new( json_root,
"type", json_string(
"register" ) );
578 json_object_set_new( json_root,
"name", json_string( name.c_str() ) );
579 json_object_set_new( json_root,
"nodes", json_integer( numProc ) );
580 json_object_set_new( json_root,
"framebuffer width", json_integer ( compbuffer_size.x ) );
581 json_object_set_new( json_root,
"framebuffer height", json_integer ( compbuffer_size.y ) );
584 json_t *json_functors_array = json_array();
585 json_object_set_new( json_root,
"functors", json_functors_array );
590 json_object_set_new( json_root,
"projection count", json_integer ( TController::pass_count ) );
591 json_object_set_new( json_root,
"projection", matrix = json_array() );
593 json_object_set_new( json_root,
"position", matrix = json_array() );
595 json_object_set_new( json_root,
"rotation", matrix = json_array() );
597 json_object_set_new( json_root,
"distance", json_real( distance ) );
599 json_t *json_sources_array = json_array();
600 json_object_set_new( json_root,
"sources", json_sources_array );
604 json_object_set_new( json_root,
"interpolation", json_boolean( interpolation ) );
605 json_object_set_new( json_root,
"iso surface", json_boolean( iso_surface ) );
606 json_object_set_new( json_root,
"step", json_real( step ) );
608 json_object_set_new( json_root,
"dimension", json_integer ( TSimDim::value ) );
609 json_object_set_new( json_root,
"width", json_integer ( global_size_scaled[0] ) );
610 if (TSimDim::value > 1)
611 json_object_set_new( json_root,
"height", json_integer ( global_size_scaled[1] ) );
612 if (TSimDim::value > 2)
613 json_object_set_new( json_root,
"depth", json_integer ( global_size_scaled[2] ) );
614 json_t *json_version_array = json_array();
617 json_object_set_new( json_root,
"protocol", json_version_array);
624 communicator->setJpegQuality(jpeg_quality);
634 isaac_float l = sqrt(nx_s*nx_s+ny_s*ny_s+nz_s*nz_s);
640 clipping.elem[ nr ].position.x = px;
641 clipping.elem[ nr ].position.y = py;
642 clipping.elem[ nr ].position.z = pz;
643 clipping.elem[ nr ].normal.x = nx_s;
644 clipping.elem[ nr ].normal.y = ny_s;
645 clipping.elem[ nr ].normal.z = nz_s;
646 clipping_saved_normals[ nr ].x = nx;
647 clipping_saved_normals[ nr ].y = ny;
648 clipping_saved_normals[ nr ].z = nz;
653 if (
editClipping( clipping.count, px, py, pz, nx, ny, nz ) )
659 if (nr >= clipping.count)
662 for (
isaac_uint i = nr; i < clipping.count; i++)
664 clipping.elem[i] = clipping.elem[i+1];
665 clipping_saved_normals[i] = clipping_saved_normals[i+1];
671 for (
int pass = 0; pass < TController::pass_count; pass++)
673 icetSetContext( icetContext[pass] );
674 if (icet_bounding_box)
679 if (TSimDim::value > 2)
684 if (TSimDim::value > 2)
686 icetBoundingBoxf( f_x, f_x + f_l_width, f_y, f_y + f_l_height, f_z, f_z + f_l_depth);
689 icetBoundingVertices(0,0,0,0,NULL);
695 this->position = position;
696 for (
int i = 0; i < 3; i++)
702 this->local_size = local_size;
703 for (
int i = 0; i < 3; i++)
710 isaac_float4 isaac_parameter_h[boost::mpl::size< TSourceList >::type::value *
ISAAC_MAX_FUNCTORS];
711 for (
int i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
713 functions[i].error_code = 0;
715 std::string source = functions[i].source;
719 while (again && ((pos = source.find(
"|")) != std::string::npos || ((again =
false) ==
false)) )
723 functions[i].error_code = 1;
726 std::string token = source.substr(0, pos);
727 source.erase(0, pos + 1);
729 token.erase(remove_if(token.begin(), token.end(), isspace), token.end());
731 size_t t_begin = token.find(
"(");
732 if (t_begin == std::string::npos)
736 size_t t_end = token.find(
")");
737 if (t_end == std::string::npos)
739 functions[i].error_code = -1;
742 if (t_end - t_begin == 1)
746 std::string parameters = token.substr(t_begin+1, t_end-t_begin-1);
751 while (p_again && ((p_pos = parameters.find(
",")) != std::string::npos || ((p_again =
false) ==
false)) )
755 functions[i].error_code = 2;
758 std::string par = parameters.substr(0, p_pos);
759 parameters.erase(0, p_pos + 1);
760 parameter_array[p_elem] = std::stof( par );
763 for (;p_elem < 4; p_elem++)
764 parameter_array[p_elem] = parameter_array[p_elem - 1];
768 if (t_begin != std::string::npos)
769 token = token.substr(0, t_begin);
774 functions[i].error_code = -2;
782 functions[i].bytecode[elem] = 0;
783 memset(&(isaac_parameter_h[i * ISAAC_MAX_FUNCTORS + elem]), 0,
sizeof(isaac_float4));
790 #if ISAAC_ALPAKA == 1 791 alpaka::mem::view::ViewPlainPtr<THost, isaac_float4, TFraDim, size_t> parameter_buffer(isaac_parameter_h, host, alpaka::vec::Vec<TFraDim, size_t>(
size_t(
ISAAC_MAX_FUNCTORS * boost::mpl::size< TSourceList >::type::value)));
793 alpaka::vec::Vec<alpaka::dim::DimInt<1u>,
size_t>
const parameter_d_extent(
size_t(16));
794 auto parameter_d_view(alpaka::mem::view::createStaticDevMemView(&
isaac_parameter_d[0u],acc,parameter_d_extent));
795 alpaka::mem::view::copy( stream, parameter_d_view, parameter_buffer, alpaka::vec::Vec<TFraDim, size_t>(
size_t(
ISAAC_MAX_FUNCTORS * boost::mpl::size< TSourceList >::type::value)) );
797 const alpaka::vec::Vec<TAccDim, size_t> threads (
size_t(1),
size_t(1),
size_t(1));
798 const alpaka::vec::Vec<TAccDim, size_t> blocks (
size_t(1),
size_t(1),
size_t(1));
799 const alpaka::vec::Vec<TAccDim, size_t> grid (
size_t(1),
size_t(1),
size_t(1));
800 auto const workdiv(alpaka::workdiv::WorkDivMembers<TAccDim, size_t>(grid,blocks,threads));
803 boost::mpl::size< TSourceList >::type::value,
808 alpaka::exec::create<TAcc>
812 alpaka::mem::view::getPtrNative(functor_chain_choose_d),
813 alpaka::mem::view::getPtrNative(functor_chain_d),
817 alpaka::stream::enqueue(stream, instance);
818 alpaka::wait::wait(stream);
820 alpaka::vec::Vec<alpaka::dim::DimInt<1u>,
size_t>
const function_chain_d_extent(
size_t(
ISAAC_MAX_SOURCES) );
821 auto function_chain_d_view(alpaka::mem::view::createStaticDevMemView(&
isaac_function_chain_d[0u],acc,function_chain_d_extent));
822 alpaka::mem::view::copy( stream, function_chain_d_view, functor_chain_choose_d,
size_t( boost::mpl::size< TSourceList >::type::value ) );
827 updateFunctorChainPointerKernel< boost::mpl::size< TSourceList >::type::value > <<<grid,block>>>(functor_chain_choose_d, functor_chain_d, dest);
837 for (
int i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
839 auto next = transfer_h.description[i].begin();
841 for(next++; next != transfer_h.description[i].end(); next++)
843 isaac_uint width = next->first - before->first;
844 for (
size_t j = 0; j < width && j + before->first < TTransfer_size; j++)
846 transfer_h.pointer[i][before->first + j] = (
853 #if ISAAC_ALPAKA == 1 854 alpaka::mem::view::copy(stream, transfer_d_buf[i], transfer_h_buf[i], TTransfer_size );
856 ISAAC_CUDA_CHECK(cudaMemcpy(transfer_d.pointer[i], transfer_h.pointer[i],
sizeof(isaac_float4)*TTransfer_size, cudaMemcpyHostToDevice));
863 return json_meta_root;
868 if (communicator && (communicator->serverConnect(communicatorBehaviour) < 0))
870 MPI_Bcast(&failed,1, MPI_INT, master, mpi_world);
875 json_init_root = json_root;
876 communicator->serverSendRegister(&json_init_root);
887 #
if ISAAC_ALPAKA == 1
899 send_distance =
false;
900 send_look_at =
false;
901 send_projection =
false;
902 send_rotation =
false;
903 send_transfer =
false;
904 send_interpolation =
false;
906 send_iso_surface =
false;
907 send_functions =
false;
910 send_background_color =
false;
911 send_clipping =
false;
912 send_controller =
false;
913 send_init_json =
false;
922 message = json_object();
923 bool add_modelview =
false;
924 while (json_t* last = communicator->getLastMessage())
930 if ( js = json_object_get(last,
"request") )
932 const char* target = json_string_value( js );
933 if ( strcmp( target,
"rotation" ) == 0 )
934 send_rotation =
true;
935 if ( strcmp( target,
"position" ) == 0 )
937 if ( strcmp( target,
"distance" ) == 0 )
938 send_distance =
true;
939 if ( strcmp( target,
"projection" ) == 0 )
940 send_projection =
true;
941 if ( strcmp( target,
"transfer" ) == 0 )
942 send_transfer =
true;
943 if ( strcmp( target,
"interpolation" ) == 0 )
944 send_interpolation =
true;
945 if ( strcmp( target,
"step" ) == 0 )
947 if ( strcmp( target,
"iso surface" ) == 0 )
948 send_iso_surface =
true;
949 if ( strcmp( target,
"functions" ) == 0 )
950 send_functions =
true;
951 if ( strcmp( target,
"weight" ) == 0 )
953 if ( strcmp( target,
"background color" ) == 0 )
954 send_background_color =
true;
955 if ( strcmp( target,
"clipping" ) == 0 )
956 send_clipping =
true;
957 if ( strcmp( target,
"controller" ) == 0 )
958 send_controller =
true;
959 if ( strcmp( target,
"init" ) == 0 )
960 send_init_json =
true;
963 if (json_array_size( js = json_object_get(last,
"rotation absolute") ) == 9)
965 add_modelview =
true;
966 send_rotation =
true;
967 json_array_foreach(js, index, value)
968 rotation[index] = json_number_value( value );
969 json_object_del( last,
"rotation absolute" );
971 if (json_array_size( js = json_object_get(last,
"rotation relative") ) == 9)
973 add_modelview =
true;
974 send_rotation =
true;
975 IceTDouble relative[9];
976 IceTDouble new_rotation[9];
977 json_array_foreach(js, index, value)
978 relative[index] = json_number_value( value );
981 new_rotation[y+x*3] = relative[y+0*3] * rotation[0+x*3]
982 + relative[y+1*3] * rotation[1+x*3]
983 + relative[y+2*3] * rotation[2+x*3];
984 memcpy(rotation, new_rotation, 9 *
sizeof(IceTDouble) );
985 json_object_del( last,
"rotation relative" );
987 if (json_array_size( js = json_object_get(last,
"rotation axis") ) == 4)
989 IceTDouble relative[9];
990 IceTDouble x = json_number_value( json_array_get( js, 0 ) );
991 IceTDouble y = json_number_value( json_array_get( js, 1 ) );
992 IceTDouble z = json_number_value( json_array_get( js, 2 ) );
993 IceTDouble rad = json_number_value( json_array_get( js, 3 ) );
994 IceTDouble s = sin( rad * M_PI / 180.0);
995 IceTDouble c = cos( rad * M_PI / 180.0);
996 IceTDouble l = sqrt( x * x + y * y + z * z);
999 add_modelview =
true;
1000 send_rotation =
true;
1004 relative[0] = c + x * x * ( 1 - c );
1005 relative[3] = x * y * ( 1 - c ) - z * s;
1006 relative[6] = x * z * ( 1 - c ) + y * s;
1007 relative[1] = y * x * ( 1 - c ) + z * s;
1008 relative[4] = c + y * y * ( 1 - c );
1009 relative[7] = y * z * ( 1 - c ) - x * s;
1010 relative[2] = z * x * ( 1 - c ) - y * s;
1011 relative[5] = z * y * ( 1 - c ) + x * s;
1012 relative[8] = c + z * z * ( 1 - c );
1013 IceTDouble new_rotation[9];
1016 new_rotation[y+x*3] = relative[y+0*3] * rotation[0+x*3]
1017 + relative[y+1*3] * rotation[1+x*3]
1018 + relative[y+2*3] * rotation[2+x*3];
1019 memcpy(rotation, new_rotation, 9 *
sizeof(IceTDouble) );
1021 json_object_del( last,
"rotation axis" );
1023 if (json_array_size( js = json_object_get(last,
"position absolute") ) == 3)
1025 add_modelview =
true;
1026 send_look_at =
true;
1027 json_array_foreach(js, index, value)
1028 look_at[index] = json_number_value( value );
1029 json_object_del( last,
"position absolute" );
1031 if (json_array_size( js = json_object_get(last,
"position relative") ) == 3)
1033 add_modelview =
true;
1034 send_look_at =
true;
1036 json_array_foreach(js, index, value)
1037 add[index] = json_number_value( value );
1038 IceTDouble add_p[3] =
1040 rotation[0] * add[0] + rotation[1] * add[1] + rotation[2] * add[2],
1041 rotation[3] * add[0] + rotation[4] * add[1] + rotation[5] * add[2],
1042 rotation[6] * add[0] + rotation[7] * add[1] + rotation[8] * add[2]
1044 look_at[0] += add_p[0];
1045 look_at[1] += add_p[1];
1046 look_at[2] += add_p[2];
1047 json_object_del( last,
"position relative" );
1049 if ( js = json_object_get(last,
"distance absolute") )
1051 add_modelview =
true;
1052 send_distance =
true;
1053 distance = json_number_value( js );
1054 json_object_del( last,
"distance absolute" );
1056 if ( js = json_object_get(last,
"distance relative") )
1058 add_modelview =
true;
1059 send_distance =
true;
1060 distance += json_number_value( js );
1061 json_object_del( last,
"distance relative" );
1064 if ( controller.updateProjection( projection, framebuffer_size, last ) )
1067 send_projection =
true;
1069 json_object_set_new( message,
"projection", matrix = json_array() );
1073 json_decref( last );
1080 json_object_set_new( message,
"modelview", matrix = json_array() );
1083 char* buffer = json_dumps( message, 0 );
1087 int l = strlen( message_buffer );
1088 MPI_Bcast( &l, 1, MPI_INT, master, mpi_world);
1089 MPI_Bcast( message_buffer, l, MPI_CHAR, master, mpi_world);
1094 MPI_Bcast( &l, 1, MPI_INT, master, mpi_world);
1095 MPI_Bcast( message_buffer, l, MPI_CHAR, master, mpi_world);
1096 message_buffer[l] = 0;
1097 message = json_loads(message_buffer, 0, NULL);
1105 if ( js = json_object_get(message,
"request") )
1107 const char* target = json_string_value( js );
1108 if ( strcmp( target,
"redraw" ) == 0 )
1110 if ( strcmp( target,
"minmax" ) == 0 )
1115 if (json_array_size( js = json_object_get(message,
"projection") ) == 16 * TController::pass_count)
1118 send_projection =
true;
1119 json_array_foreach(js, index, value)
1120 projection[index] = json_number_value( value );
1122 if (rank!= master && json_array_size( js = json_object_get(message,
"modelview") ) == 16)
1125 json_array_foreach(js, index, value)
1126 modelview[index] = json_number_value( value );
1128 if (json_array_size( js = json_object_get(message,
"transfer points") ) )
1131 json_array_foreach(js, index, value)
1133 transfer_h.description[index].clear();
1136 json_array_foreach(value, index_2, element)
1138 transfer_h.description[index].insert( std::pair< isaac_uint, isaac_float4> (
1139 isaac_uint( json_number_value( json_object_get( element,
"value" ) ) ), {
1140 isaac_float( json_number_value( json_object_get( element,
"r" ) ) ),
1141 isaac_float( json_number_value( json_object_get( element,
"g" ) ) ),
1142 isaac_float( json_number_value( json_object_get( element,
"b" ) ) ),
1143 isaac_float( json_number_value( json_object_get( element,
"a" ) ) ) } ) );
1147 send_transfer =
true;
1149 if ( js = json_object_get(message,
"interpolation") )
1152 interpolation = json_boolean_value ( js );
1153 send_interpolation =
true;
1155 if ( js = json_object_get(message,
"step") )
1158 step = json_number_value ( js );
1163 if ( js = json_object_get(message,
"iso surface") )
1166 iso_surface = json_boolean_value ( js );
1167 send_iso_surface =
true;
1169 if (json_array_size( js = json_object_get(message,
"functions") ) )
1172 json_array_foreach(js, index, value)
1173 functions[index].source = std::string(json_string_value(value));
1175 send_functions =
true;
1177 if (json_array_size( js = json_object_get(message,
"weight") ) )
1180 json_array_foreach(js, index, value)
1181 source_weight.value[index] = json_number_value(value);
1184 if (js = json_object_get(message,
"bounding box") )
1187 icet_bounding_box = !icet_bounding_box;
1190 if (json_array_size( js = json_object_get(message,
"background color") ) == 3 )
1193 json_array_foreach(js, index, value)
1194 background_color[index] = json_number_value( value );
1195 for (
int pass = 0; pass < TController::pass_count; pass++)
1197 icetSetContext( icetContext[pass] );
1198 if (background_color[0] == 0.0f &&
1199 background_color[1] == 0.0f &&
1200 background_color[2] == 0.0f )
1201 icetDisable(ICET_CORRECT_COLORED_BACKGROUND);
1203 icetEnable(ICET_CORRECT_COLORED_BACKGROUND);
1205 send_background_color =
true;
1207 if (js = json_object_get(message,
"clipping add") )
1210 send_clipping =
true;
1211 json_t* position = json_object_get(js,
"position");
1212 json_t* normal = json_object_get(js,
"normal");
1214 json_number_value( json_array_get( position, 0 ) ),
1215 json_number_value( json_array_get( position, 1 ) ),
1216 json_number_value( json_array_get( position, 2 ) ),
1217 json_number_value( json_array_get( normal, 0 ) ),
1218 json_number_value( json_array_get( normal, 1 ) ),
1219 json_number_value( json_array_get( normal, 2 ) )
1222 if (js = json_object_get(message,
"clipping remove") )
1225 send_clipping =
true;
1228 if (js = json_object_get(message,
"clipping edit") )
1231 send_clipping =
true;
1232 json_t* nr = json_object_get(js,
"nr");
1233 json_t* position = json_object_get(js,
"position");
1234 json_t* normal = json_object_get(js,
"normal");
1236 json_integer_value( nr ),
1237 json_number_value( json_array_get( position, 0 ) ),
1238 json_number_value( json_array_get( position, 1 ) ),
1239 json_number_value( json_array_get( position, 2 ) ),
1240 json_number_value( json_array_get( normal, 0 ) ),
1241 json_number_value( json_array_get( normal, 1 ) ),
1242 json_number_value( json_array_get( normal, 2 ) )
1246 json_t* metadata = json_object_get( message,
"metadata" );
1248 json_incref(metadata);
1249 json_decref(message);
1250 thr_metaTargets = metaTargets;
1255 #
if ISAAC_ALPAKA == 1
1262 MPI_Reduce( MPI_IN_PLACE, minmax_array.min, boost::mpl::size< TSourceList >::type::value, MPI_FLOAT, MPI_MIN, master, mpi_world);
1263 MPI_Reduce( MPI_IN_PLACE, minmax_array.max, boost::mpl::size< TSourceList >::type::value, MPI_FLOAT, MPI_MAX, master, mpi_world);
1267 MPI_Reduce( minmax_array.min, NULL, boost::mpl::size< TSourceList >::type::value, MPI_FLOAT, MPI_MIN, master, mpi_world);
1268 MPI_Reduce( minmax_array.max, NULL, boost::mpl::size< TSourceList >::type::value, MPI_FLOAT, MPI_MAX, master, mpi_world);
1272 for (
int pass = 0; pass < TController::pass_count; pass++)
1273 image[pass].opaque_internals = NULL;
1277 for (
int pass = 0; pass < TController::pass_count; pass++)
1279 icetSetContext( icetContext[pass] );
1283 IceTDouble point[4] =
1285 (IceTDouble(position_scaled[0]) + (IceTDouble(local_size_scaled[0]) - IceTDouble(global_size_scaled[0])) / 2.0) / IceTDouble(max_size_scaled/2),
1286 (IceTDouble(position_scaled[1]) + (IceTDouble(local_size_scaled[1]) - IceTDouble(global_size_scaled[1])) / 2.0) / IceTDouble(max_size_scaled/2),
1287 (IceTDouble(position_scaled[2]) + (IceTDouble(local_size_scaled[2]) - IceTDouble(global_size_scaled[2])) / 2.0) / IceTDouble(max_size_scaled/2),
1290 IceTDouble result[4];
1292 float point_distance = sqrt(result[0] * result[0] + result[1] * result[1] + result[2] * result[2]);
1294 float receive_buffer[numProc];
1295 MPI_Allgather( &point_distance, 1, MPI_FLOAT, receive_buffer, 1, MPI_FLOAT, mpi_world);
1297 std::multimap<float, isaac_int, std::less< float > > distance_map;
1299 distance_map.insert( std::pair<float, isaac_int>( receive_buffer[i], i ) );
1301 IceTInt icet_order_array[numProc];
1304 for (
auto it = distance_map.begin(); it != distance_map.end(); it++)
1306 icet_order_array[i] = it->second;
1310 icetCompositeOrder( icet_order_array );
1315 image[pass] = icetDrawFrame(&(projection[pass * 16]),modelview,background_color);
1323 char* buffer = json_dumps( json_root, 0 );
1324 strcpy( message_buffer, buffer );
1336 json_t* js = json_loads(receive_buffer[i], 0, NULL);
1342 MPI_Gather( message_buffer,
ISAAC_MAX_RECEIVE, MPI_CHAR, NULL, 0, MPI_CHAR, master, mpi_world);
1345 #ifdef ISAAC_THREADING 1346 pthread_create(&visualizationThread,NULL,visualizationFunction,NULL);
1348 visualizationFunction(NULL);
1355 json_decref( json_root );
1358 json_root = json_object();
1359 json_object_set_new( json_root,
"type", json_string(
"exit" ) );
1360 char* buffer = json_dumps( json_root, 0 );
1361 communicator->serverSend(buffer,
true,
true);
1363 json_decref( json_root );
1365 for (
int pass = 0; pass < TController::pass_count; pass++)
1366 icetDestroyContext(icetContext[pass]);
1367 #if ISAAC_ALPAKA == 0 1368 for (
int i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1370 if ( pointer_array.pointer[i] )
1373 free( transfer_h.pointer[i] );
1380 delete communicator;
1381 json_decref(json_init_root);
1386 if (clock_gettime(CLOCK_MONOTONIC_RAW,&ts) == 0)
1387 return ts.tv_sec*1000000 + ts.tv_nsec/1000;
1397 static void drawCallBack(
1398 const IceTDouble * projection_matrix,
1399 const IceTDouble * modelview_matrix,
1400 const IceTFloat * background_color,
1401 const IceTInt * readback_viewport,
1404 #if ISAAC_ALPAKA == 1 1405 alpaka::mem::buf::Buf<THost, isaac_float, TFraDim, size_t> inverse_h_buf ( alpaka::mem::buf::alloc<isaac_float, size_t>(myself->host,
size_t(16)));
1406 alpaka::mem::buf::Buf<THost, isaac_size_struct< TSimDim::value >, TFraDim,
size_t> size_h_buf ( alpaka::mem::buf::alloc<
isaac_size_struct< TSimDim::value >,
size_t>(myself->host,
size_t(1)));
1407 isaac_float* inverse_h =
reinterpret_cast<float*
>(alpaka::mem::view::getPtrNative(inverse_h_buf));
1413 IceTDouble inverse[16];
1414 calcInverse(inverse,projection_matrix,modelview_matrix);
1415 for (
int i = 0; i < 16; i++)
1416 inverse_h[i] = static_cast<float>(inverse[i]);
1418 size_h[0].
global_size.value.x = myself->global_size[0];
1419 size_h[0].
global_size.value.y = myself->global_size[1];
1420 if (TSimDim::value > 2)
1421 size_h[0].
global_size.value.z = myself->global_size[2];
1422 size_h[0].
position.value.x = myself->position[0];
1423 size_h[0].
position.value.y = myself->position[1];
1424 if (TSimDim::value > 2)
1425 size_h[0].
position.value.z = myself->position[2];
1426 size_h[0].
local_size.value.x = myself->local_size[0];
1427 size_h[0].
local_size.value.y = myself->local_size[1];
1428 if (TSimDim::value > 2)
1429 size_h[0].
local_size.value.z = myself->local_size[2];
1430 size_h[0].
max_global_size =
static_cast<float>(
ISAAC_MAX(
ISAAC_MAX(uint32_t(myself->global_size[0]),uint32_t(myself->global_size[1])),uint32_t(myself->global_size[2])));
1434 if (TSimDim::value > 2)
1438 if (TSimDim::value > 2)
1442 if (TSimDim::value > 2)
1444 size_h[0].
max_global_size_scaled =
static_cast<float>(
ISAAC_MAX(
ISAAC_MAX(uint32_t(myself->global_size_scaled[0]),uint32_t(myself->global_size_scaled[1])),uint32_t(myself->global_size_scaled[2])));
1446 isaac_float3 isaac_scale =
1453 #if ISAAC_ALPAKA == 1 1454 alpaka::vec::Vec<alpaka::dim::DimInt<1u>,
size_t>
const inverse_d_extent(
size_t(16));
1455 auto inverse_d_view(alpaka::mem::view::createStaticDevMemView(&
isaac_inverse_d[0u],myself->acc,inverse_d_extent));
1456 alpaka::mem::view::copy(myself->stream, inverse_d_view, inverse_h_buf,
size_t(16));
1458 alpaka::vec::Vec<alpaka::dim::DimInt<1u>,
size_t>
const size_d_extent(
size_t(1));
1459 auto size_d_view(alpaka::mem::view::createStaticDevMemView(&
isaac_size_d[0u],myself->acc,size_d_extent));
1460 alpaka::mem::view::copy(myself->stream, size_d_view, size_h_buf,
size_t(1));
1465 IceTUByte* pixels = icetImageGetColorub(result);
1467 isaac_float4 bg_color =
1474 isaac_uint2 framebuffer_start =
1479 #if ISAAC_ALPAKA == 1 1488 alpaka::mem::buf::Buf<TDevAcc, uint32_t, TFraDim, size_t>,
1494 alpaka::mem::buf::Buf<TDevAcc, isaac_functor_chain_pointer_N, TFraDim, size_t>,
1495 boost::mpl::size< TSourceList >::type::value
1499 myself->framebuffer,
1500 myself->framebuffer_size,
1506 myself->source_weight,
1507 myself->pointer_array,
1509 myself->interpolation,
1510 myself->iso_surface,
1514 alpaka::wait::wait(myself->stream);
1517 alpaka::mem::view::ViewPlainPtr<THost, uint32_t, TFraDim, size_t> result_buffer((uint32_t*)(pixels), myself->host, alpaka::vec::Vec<TFraDim, size_t>(myself->framebuffer_prod));
1518 alpaka::mem::view::copy(myself->stream, result_buffer, myself->framebuffer, alpaka::vec::Vec<TFraDim, size_t>(myself->framebuffer_prod));
1524 transfer_d_struct< boost::mpl::size< TSourceList >::type::value >,
1525 source_weight_struct< boost::mpl::size< TSourceList >::type::value >,
1526 pointer_array_struct< boost::mpl::size< TSourceList >::type::value >,
1531 boost::mpl::size< TSourceList >::type::value
1534 myself->framebuffer,
1535 myself->framebuffer_size,
1541 myself->source_weight,
1542 myself->pointer_array,
1544 myself->interpolation,
1545 myself->iso_surface,
1552 ISAAC_CUDA_CHECK(cudaMemcpy((uint32_t*)(pixels), myself->framebuffer,
sizeof(uint32_t)*myself->framebuffer_prod, cudaMemcpyDeviceToHost));
1557 static void* visualizationFunction(
void* dummy)
1560 if (myself->rank == myself->master)
1562 json_object_set_new( myself->json_root,
"type", json_string(
"period" ) );
1563 json_object_set_new( myself->json_root,
"meta nr", json_integer( myself->metaNr ) );
1566 if ( myself->send_projection )
1568 json_object_set_new( myself->json_root,
"projection", matrix = json_array() );
1570 json_object_set( myself->json_init_root,
"projection", matrix );
1571 myself->send_init_json =
true;
1573 if ( myself->send_look_at )
1575 json_object_set_new( myself->json_root,
"position", matrix = json_array() );
1577 json_object_set( myself->json_init_root,
"position", matrix );
1578 myself->send_init_json =
true;
1580 if ( myself->send_rotation )
1582 json_object_set_new( myself->json_root,
"rotation", matrix = json_array() );
1584 json_object_set( myself->json_init_root,
"rotation", matrix );
1585 myself->send_init_json =
true;
1587 if ( myself->send_distance )
1589 json_object_set_new( myself->json_root,
"distance", json_real( myself->distance ) );
1590 json_object_set_new( myself->json_init_root,
"distance", json_real( myself->distance ) );
1591 myself->send_init_json =
true;
1593 if ( myself->send_transfer )
1595 json_object_set_new( myself->json_root,
"transfer array", matrix = json_array() );
1596 for (
size_t i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1598 json_t* transfer = json_array();
1599 json_array_append_new( matrix, transfer );
1600 for (
size_t j = 0; j < TTransfer_size; j++)
1602 json_t* color = json_array();
1603 json_array_append_new( transfer, color );
1604 json_array_append_new( color, json_integer(
isaac_uint( myself->transfer_h.pointer[i][j].x *
isaac_float(255) ) ) );
1605 json_array_append_new( color, json_integer(
isaac_uint( myself->transfer_h.pointer[i][j].y *
isaac_float(255) ) ) );
1606 json_array_append_new( color, json_integer(
isaac_uint( myself->transfer_h.pointer[i][j].z *
isaac_float(255) ) ) );
1607 json_array_append_new( color, json_integer(
isaac_uint( myself->transfer_h.pointer[i][j].w *
isaac_float(255) ) ) );
1610 json_object_set_new( myself->json_root,
"transfer points", matrix = json_array() );
1611 for (
size_t i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1613 json_t* points = json_array();
1614 json_array_append_new( matrix, points );
1615 for(
auto it = myself->transfer_h.description[i].begin(); it != myself->transfer_h.description[i].end(); it++)
1617 json_t* p = json_object();
1618 json_array_append_new( points, p);
1619 json_object_set_new(p,
"value", json_integer( it->first ) );
1620 json_object_set_new(p,
"r", json_real( it->second.x ) );
1621 json_object_set_new(p,
"g", json_real( it->second.y ) );
1622 json_object_set_new(p,
"b", json_real( it->second.z ) );
1623 json_object_set_new(p,
"a", json_real( it->second.w ) );
1627 if ( myself->send_functions )
1629 json_object_set_new( myself->json_root,
"functions", matrix = json_array() );
1630 for (
size_t i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1632 json_t* f = json_object();
1633 json_array_append_new( matrix, f );
1634 json_object_set_new(f,
"source", json_string( myself->functions[i].source.c_str() ) );
1635 json_object_set_new(f,
"error", json_integer( myself->functions[i].error_code ) );
1638 if ( myself->send_weight )
1640 json_object_set_new( myself->json_root,
"weight", matrix = json_array() );
1641 for (
size_t i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1642 json_array_append_new( matrix, json_real( myself->source_weight.value[i] ) );
1644 if ( myself->send_interpolation )
1646 json_object_set_new( myself->json_root,
"interpolation", json_boolean( myself->interpolation ) );
1647 json_object_set_new( myself->json_init_root,
"interpolation", json_boolean( myself->interpolation ) );
1648 myself->send_init_json =
true;
1650 if ( myself->send_step )
1652 json_object_set_new( myself->json_root,
"step", json_real( myself->step ) );
1653 json_object_set_new( myself->json_init_root,
"step", json_boolean( myself->step ) );
1654 myself->send_init_json =
true;
1656 if ( myself->send_iso_surface )
1658 json_object_set_new( myself->json_root,
"iso surface", json_boolean( myself->iso_surface ) );
1659 json_object_set_new( myself->json_init_root,
"iso surface", json_boolean( myself->iso_surface ) );
1660 myself->send_init_json =
true;
1662 if ( myself->send_minmax )
1664 json_object_set_new( myself->json_root,
"minmax", matrix = json_array() );
1665 for (
size_t i = 0; i < boost::mpl::size< TSourceList >::type::value; i++)
1667 json_t* v = json_object();
1668 json_array_append_new( matrix, v );
1669 json_object_set_new(v,
"min", json_real( myself->minmax_array.min[i] ) );
1670 json_object_set_new(v,
"max", json_real( myself->minmax_array.max[i] ) );
1673 if ( myself->send_background_color )
1675 json_object_set_new( myself->json_root,
"background color", matrix = json_array() );
1676 for (
size_t i = 0; i < 3; i++)
1677 json_array_append_new( matrix, json_real( myself->background_color[i] ) );
1678 json_object_set( myself->json_init_root,
"background color", matrix );
1679 myself->send_init_json =
true;
1681 if ( myself->send_clipping )
1683 json_object_set_new( myself->json_root,
"clipping", matrix = json_array() );
1684 for (
size_t i = 0; i < myself->clipping.count; i++)
1686 json_t* f = json_object();
1687 json_array_append_new( matrix, f );
1688 json_t* inner = json_array();
1689 json_object_set_new(f,
"position", inner );
1690 json_array_append_new( inner, json_real( myself->clipping.elem[i].position.x ) );
1691 json_array_append_new( inner, json_real( myself->clipping.elem[i].position.y ) );
1692 json_array_append_new( inner, json_real( myself->clipping.elem[i].position.z ) );
1693 inner = json_array();
1694 json_object_set_new(f,
"normal", inner );
1695 json_array_append_new( inner, json_real( myself->clipping_saved_normals[i].x ) );
1696 json_array_append_new( inner, json_real( myself->clipping_saved_normals[i].y ) );
1697 json_array_append_new( inner, json_real( myself->clipping_saved_normals[i].z ) );
1700 myself->controller.sendFeedback( myself->json_root, myself->send_controller );
1701 if ( myself->send_init_json )
1702 json_object_set( myself->json_root,
"init",myself->json_init_root );
1703 char* buffer = json_dumps( myself->json_root, 0 );
1704 myself->communicator->serverSend(buffer);
1707 json_decref( myself->json_root );
1708 myself->recreateJSON();
1712 if (myself->communicator)
1714 if (myself->image[0].opaque_internals)
1715 myself->communicator->serverSendFrame(myself->compositor.doCompositing(myself->image),myself->compbuffer_size.x,myself->compbuffer_size.y,4);
1718 myself->communicator->serverSend(NULL,
false,
true);
1727 json_root = json_object();
1728 json_meta_root = json_object();
1729 json_object_set_new( json_root,
"metadata", json_meta_root );
1731 void updateModelview()
1733 IceTDouble look_at_m[16];
1735 look_at_m[12] = look_at[0];
1736 look_at_m[13] = look_at[1];
1737 look_at_m[14] = look_at[2];
1739 IceTDouble rotation_m[16];
1744 rotation_m[x+y*4] = rotation[x+y*3];
1747 rotation_m[x+y*4] = 0.0;
1749 rotation_m[x+y*4] = 1.0;
1752 IceTDouble distance_m[16];
1754 distance_m[14] = distance;
1756 IceTDouble temp[16];
1761 #if ISAAC_ALPAKA == 1 1767 std::string server_url;
1769 isaac_size2 framebuffer_size;
1770 isaac_size2 compbuffer_size;
1771 #if ISAAC_ALPAKA == 1 1772 alpaka::vec::Vec<TFraDim, size_t> framebuffer_prod;
1773 alpaka::mem::buf::Buf<TDevAcc, uint32_t, TFraDim, size_t> framebuffer;
1774 alpaka::mem::buf::Buf<TDevAcc, isaac_functor_chain_pointer_N, TFraDim, size_t> functor_chain_d;
1775 alpaka::mem::buf::Buf<TDevAcc, isaac_functor_chain_pointer_N, TFraDim, size_t> functor_chain_choose_d;
1776 alpaka::mem::buf::Buf<TDevAcc, minmax_struct, TFraDim, size_t> local_minmax_array_d;
1778 size_t framebuffer_prod;
1784 TDomainSize global_size;
1785 TDomainSize local_size;
1786 TDomainSize position;
1787 std::vector<size_t> global_size_scaled;
1788 std::vector<size_t> local_size_scaled;
1789 std::vector<size_t> position_scaled;
1791 IceTDouble projection[16 * TController::pass_count];
1792 IceTDouble look_at[3];
1793 IceTDouble rotation[9];
1794 IceTDouble distance;
1798 bool send_projection;
1800 bool send_interpolation;
1802 bool send_iso_surface;
1803 bool send_functions;
1806 bool send_background_color;
1808 bool send_controller;
1809 bool send_init_json;
1812 bool icet_bounding_box;
1814 IceTDouble modelview[16];
1817 json_t *json_init_root;
1818 json_t *json_meta_root;
1823 TSourceList& sources;
1824 IceTContext icetContext[TController::pass_count];
1826 pthread_t visualizationThread;
1827 #if ISAAC_ALPAKA == 1 1828 std::vector< alpaka::mem::buf::Buf<TDevAcc, isaac_float4, TTexDim, size_t> > transfer_d_buf;
1829 std::vector< alpaka::mem::buf::Buf< THost, isaac_float4, TTexDim, size_t> > transfer_h_buf;
1830 std::vector< alpaka::mem::buf::Buf< TDevAcc, isaac_float, TFraDim, size_t> > pointer_array_alpaka;
1837 const static size_t transfer_size = TTransfer_size;
1840 size_t max_size_scaled;
1841 IceTFloat background_color[4];
1846 TController controller;
1847 TCompositor compositor;
1848 IceTImage image[TController::pass_count];
1851 #if ISAAC_ALPAKA == 1 1852 template <
typename THost,
typename TAcc,
typename TStream,
typename TAccDim,
typename TSimDim,
typename TSourceList,
typename TDomainSize,
size_t TTransfer_size,
typename TScale,
typename TController,
typename TCompositor>
1853 IsaacVisualization<THost,TAcc,TStream,TAccDim,TSimDim,TSourceList,TDomainSize,TTransfer_size,TScale,TController,TCompositor>*
IsaacVisualization<THost,TAcc,TStream,TAccDim,TSimDim,TSourceList,TDomainSize,TTransfer_size,TScale,TController,TCompositor>::myself = NULL;
1855 template <
typename TSimDim,
typename TSourceList,
typename TDomainSize,
size_t TTransfer_size,
typename TScale,
typename TController,
typename TCompositor>
1856 IsaacVisualization<TSimDim,TSourceList,TDomainSize,TTransfer_size,TScale,TController,TCompositor>*
IsaacVisualization<TSimDim,TSourceList,TDomainSize,TTransfer_size,TScale,TController,TCompositor>::myself = NULL;
#define ISAAC_HOST_INLINE
void calcInverse(IceTDouble *inv, const IceTDouble *projection, const IceTDouble *modelview)
json_t * getJsonMetaRoot()
isaac_float4 getHSVA(isaac_float h, isaac_float s, isaac_float v, isaac_float a)
isaac_size_dim< simdim > local_size
void addClipping(isaac_float px, isaac_float py, isaac_float pz, isaac_float nx, isaac_float ny, isaac_float nz)
ISAAC_CONSTANT isaac_functor_chain_pointer_N isaac_function_chain_d[ISAAC_MAX_SOURCES]
IsaacVisualizationMetaEnum
ISAAC_HOST_INLINE void operator()(const int I, const TSource &source, TArray &pointer_array, const TLocalSize &local_size) const
void mergeJSON(json_t *result, json_t *candidate)
isaac_size_dim< simdim > position_scaled
isaac_size_dim< simdim > local_size_scaled
isaac_size_dim< simdim > global_size_scaled
ISAAC_HOST_INLINE void operator()(const int I, const TSource &source, TArray &pointer_array, TMinmax &minmax, TLocalMinmax &local_minmax, TLocalSize &local_size) const
#define ISAAC_MAX_SOURCES
#define ISAAC_STOP_TIME_MEASUREMENT(result, operand, unique_name, time_function)
void updatePosition(const TDomainSize position)
#define ISAAC_FUNCTOR_COUNT
ISAAC_HOST_INLINE void operator()(const int I, const TFunctor &f, TJsonRoot &jsonRoot) const
#define ISAAC_FUNCTOR_COMPLEX
fus::list< IsaacFunctorIdem,IsaacFunctorAdd,IsaacFunctorMul,IsaacFunctorLength,IsaacFunctorPow,IsaacFunctorSum > IsaacFunctorPool
#define ISAAC_JSON_ADD_MATRIX(array, matrix, count)
ISAAC_CONSTANT isaac_float4 isaac_parameter_d[ISAAC_MAX_SOURCES *ISAAC_MAX_FUNCTORS]
#define ISAAC_MAX_FUNCTORS
void updateLocalSize(const TDomainSize local_size)
#define ISAAC_PROTOCOL_VERSION_MAJOR
void mulMatrixMatrix(IceTDouble *result, const IceTDouble *matrix1, const IceTDouble *matrix2)
__global__ void fillFunctorChainPointerKernel(isaac_functor_chain_pointer_N *const functor_chain_d)
ISAAC_HOST_INLINE void operator()(const int I, const TSource &source, const TFunctions &functions, TDest &dest) const
json_t * doVisualization(const IsaacVisualizationMetaEnum metaTargets=META_MASTER, void *pointer=NULL, bool redraw=true)
ISAAC_NO_HOST_DEVICE_WARNING ISAAC_HOST_DEVICE_INLINE void isaac_for_each_params(Sequence &seq, F const &f, P &... p)
#define ISAAC_SET_IDENTITY(size, matrix)
#define ISAAC_DEFAULT_WEIGHT
isaac_float(* isaac_functor_chain_pointer_N)(void *, isaac_int)
ISAAC_CONSTANT isaac_size_struct< 3 > isaac_size_d[1]
ISAAC_CONSTANT isaac_float isaac_inverse_d[16]
void mulMatrixVector(IceTDouble *result, const IceTDouble *matrix, const IceTDouble *vector)
size_t max_global_size_scaled
ISAAC_HOST_INLINE void operator()(const int I, TSource &source, TArray &pointer_array, const TLocalSize &local_size, const TWeight &weight, const TPointer &pointer) const
#define ISAAC_CUDA_CHECK(call)
bool editClipping(isaac_uint nr, isaac_float px, isaac_float py, isaac_float pz, isaac_float nx, isaac_float ny, isaac_float nz)
#define ISAAC_MAX_RECEIVE
#define ISAAC_START_TIME_MEASUREMENT(unique_name, time_function)
#define ISAAC_MAX_CLIPPING
void removeClipping(isaac_uint nr)
#define ISAAC_DEFAULT_STEP
__global__ void updateFunctorChainPointerKernel(isaac_functor_chain_pointer_N *const functor_chain_choose_d, isaac_functor_chain_pointer_N const *const functor_chain_d, TDest dest)
int init(CommunicatorSetting communicatorBehaviour=ReturnAtError)
isaac_size_dim< simdim > global_size
#define ISAAC_PROTOCOL_VERSION_MINOR
ISAAC_HOST_INLINE void operator()(const int I, const TSource &s, TJsonRoot &jsonRoot) const
#define ISAAC_WAIT_VISUALIZATION
void setJpegQuality(isaac_uint jpeg_quality)
ISAAC_HOST_INLINE void operator()(const int I, TFunctor &f, const TName &name, TValue &value, TFound &found) const
isaac_size_dim< simdim > position
IsaacVisualization(const std::string name, const isaac_int master, const std::string server_url, const isaac_uint server_port, const isaac_size2 framebuffer_size, const TDomainSize global_size, const TDomainSize local_size, const TDomainSize position, TSourceList &sources, TScale scale)