<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Does the C++ code support u_non_staggered</title>
		<link>http://www.k-wave.org/forum/topic/does-the-c-code-support-u_non_staggered</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:27:56 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/does-the-c-code-support-u_non_staggered" rel="self" type="application/rss+xml" />

		<item>
			<title>twistor59 on "Does the C++ code support u_non_staggered"</title>
			<link>http://www.k-wave.org/forum/topic/does-the-c-code-support-u_non_staggered#post-5734</link>
			<pubDate>Fri, 04 Nov 2016 11:11:25 +0000</pubDate>
			<dc:creator>twistor59</dc:creator>
			<guid isPermaLink="false">5734@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I found the problem:  there is a small bug in line 104 of OutputHDF5Stream.h in the c++ code:  The string allocation needs an extra byte to include space for the null character, i.e.  this-&#38;gt;HDF5_RootObjectName = new char[1+strlen(HDF5_RootObjectName)]; &#60;/p&#62;
&#60;p&#62;Without this the filenames were being corrupted as shown in the h5ls dump
&#60;/p&#62;</description>
		</item>
		<item>
			<title>twistor59 on "Does the C++ code support u_non_staggered"</title>
			<link>http://www.k-wave.org/forum/topic/does-the-c-code-support-u_non_staggered#post-5724</link>
			<pubDate>Fri, 28 Oct 2016 10:36:40 +0000</pubDate>
			<dc:creator>twistor59</dc:creator>
			<guid isPermaLink="false">5724@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Jiri,&#60;/p&#62;
&#60;p&#62;thanks for the response.  Sorry I've been a bit slow in getting back, I ran h5ls on the output file:&#60;/p&#62;
&#60;p&#62;h5ls kwave_output_data28-Oct-2016-08-41-04.h5&#60;br /&#62;
Nt                       Dataset {1, 1, 1}&#60;br /&#62;
Nx                       Dataset {1, 1, 1}&#60;br /&#62;
Ny                       Dataset {1, 1, 1}&#60;br /&#62;
Nz                       Dataset {1, 1, 1}&#60;br /&#62;
absorbing_flag           Dataset {1, 1, 1}&#60;br /&#62;
alpha_power              Dataset {1, 1, 1}&#60;br /&#62;
c_ref                    Dataset {1, 1, 1}&#60;br /&#62;
dt                       Dataset {1, 1, 1}&#60;br /&#62;
dx                       Dataset {1, 1, 1}&#60;br /&#62;
dy                       Dataset {1, 1, 1}&#60;br /&#62;
dz                       Dataset {1, 1, 1}&#60;br /&#62;
nonlinear_flag           Dataset {1, 1, 1}&#60;br /&#62;
nonuniform_grid_flag     Dataset {1, 1, 1}&#60;br /&#62;
p                        Dataset {1, 501, 25488}&#60;br /&#62;
p0_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
p_final                  Dataset {256, 256, 128}&#60;br /&#62;
p_source_flag            Dataset {1, 1, 1}&#60;br /&#62;
p_source_many            Dataset {1, 1, 1}&#60;br /&#62;
p_source_mode            Dataset {1, 1, 1}&#60;br /&#62;
pml_x_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_x_size               Dataset {1, 1, 1}&#60;br /&#62;
pml_y_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_y_size               Dataset {1, 1, 1}&#60;br /&#62;
pml_z_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_z_size               Dataset {1, 1, 1}&#60;br /&#62;
t_index                  Dataset {1, 1, 1}&#60;br /&#62;
transducer_source_flag   Dataset {1, 1, 1}&#60;br /&#62;
ux                       Dataset {1, 501, 25488}&#60;br /&#62;
ux_non_staggered01     Dataset {1, 501, 25488}&#60;br /&#62;
ux_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
uy                       Dataset {1, 501, 25488}&#60;br /&#62;
uy_non_staggered         Dataset {1, 501, 25488}&#60;br /&#62;
uy_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
uz                       Dataset {1, 501, 25488}&#60;br /&#62;
uz_non_staggered\ Vh\371\257\177 Dataset {1, 501, 25488}&#60;br /&#62;
uz_source_flag           Dataset {1, 1, 1}&#60;/p&#62;
&#60;p&#62;Clearly the non_staggered filenames seem to have been corrupted.  I tried running the C object outside Matlab: &#60;/p&#62;
&#60;p&#62;/Users/philjones/FEM/k-wave/k-Wave/binaries/kspaceFirstOrder3D-OMP -i /private/tmp/kwave_input_data28-Oct-2016-09-58-19.h5 -o /private/tmp/kwave_output_data28-Oct-2016-09-58-19.h5 --p_raw --p_final --u_raw --u_non_staggered_raw&#60;/p&#62;
&#60;p&#62;I'm still getting the strange non_staggered filenames:&#60;/p&#62;
&#60;p&#62;h5ls kwave_output_data28-Oct-2016-09-58-19.h5&#60;br /&#62;
Nt                       Dataset {1, 1, 1}&#60;br /&#62;
Nx                       Dataset {1, 1, 1}&#60;br /&#62;
Ny                       Dataset {1, 1, 1}&#60;br /&#62;
Nz                       Dataset {1, 1, 1}&#60;br /&#62;
absorbing_flag           Dataset {1, 1, 1}&#60;br /&#62;
alpha_power              Dataset {1, 1, 1}&#60;br /&#62;
c_ref                    Dataset {1, 1, 1}&#60;br /&#62;
dt                       Dataset {1, 1, 1}&#60;br /&#62;
dx                       Dataset {1, 1, 1}&#60;br /&#62;
dy                       Dataset {1, 1, 1}&#60;br /&#62;
dz                       Dataset {1, 1, 1}&#60;br /&#62;
nonlinear_flag           Dataset {1, 1, 1}&#60;br /&#62;
nonuniform_grid_flag     Dataset {1, 1, 1}&#60;br /&#62;
p                        Dataset {1, 501, 25488}&#60;br /&#62;
p0_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
p_final                  Dataset {256, 256, 128}&#60;br /&#62;
p_source_flag            Dataset {1, 1, 1}&#60;br /&#62;
p_source_many            Dataset {1, 1, 1}&#60;br /&#62;
p_source_mode            Dataset {1, 1, 1}&#60;br /&#62;
pml_x_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_x_size               Dataset {1, 1, 1}&#60;br /&#62;
pml_y_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_y_size               Dataset {1, 1, 1}&#60;br /&#62;
pml_z_alpha              Dataset {1, 1, 1}&#60;br /&#62;
pml_z_size               Dataset {1, 1, 1}&#60;br /&#62;
t_index                  Dataset {1, 1, 1}&#60;br /&#62;
transducer_source_flag   Dataset {1, 1, 1}&#60;br /&#62;
ux                       Dataset {1, 501, 25488}&#60;br /&#62;
ux_non_staggered01     Dataset {1, 501, 25488}&#60;br /&#62;
ux_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
uy                       Dataset {1, 501, 25488}&#60;br /&#62;
uy_non_staggered         Dataset {1, 501, 25488}&#60;br /&#62;
uy_source_flag           Dataset {1, 1, 1}&#60;br /&#62;
uz                       Dataset {1, 501, 25488}&#60;br /&#62;
uz_non_staggered04     Dataset {1, 501, 25488}&#60;br /&#62;
uz_source_flag           Dataset {1, 1, 1}&#60;/p&#62;
&#60;p&#62;I could try doing a clean rebuild of the C code.  Incidentally I'm working on OS/X 10.10.4.  I originally built with g++-5 and had to set the linking in the Makefile to Dynamic (static linking doesn't work on OS/X) I'm not sure if this could cause problems.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Jiri Jaros on "Does the C++ code support u_non_staggered"</title>
			<link>http://www.k-wave.org/forum/topic/does-the-c-code-support-u_non_staggered#post-5628</link>
			<pubDate>Wed, 10 Aug 2016 09:13:39 +0000</pubDate>
			<dc:creator>Jiri Jaros</dc:creator>
			<guid isPermaLink="false">5628@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi twistor59&#60;br /&#62;
The u_non_staggered flag is supported by the C++ version 1.1. Could you call h5ls on the output file to take a look what happened. Alternatively, could you try to run the code outside matlab (providing the input file, and the list of sampling flags).&#60;/p&#62;
&#60;p&#62;I can also see you made some changes in the code, maybe something went wrong.&#60;br /&#62;
I'd recommend you downloading the latest official version. If it doesn't help, send me the script and I'll take a look&#60;/p&#62;
&#60;p&#62;Jiri
&#60;/p&#62;</description>
		</item>
		<item>
			<title>twistor59 on "Does the C++ code support u_non_staggered"</title>
			<link>http://www.k-wave.org/forum/topic/does-the-c-code-support-u_non_staggered#post-5625</link>
			<pubDate>Mon, 08 Aug 2016 16:30:37 +0000</pubDate>
			<dc:creator>twistor59</dc:creator>
			<guid isPermaLink="false">5625@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, I've been using k-wave to perform 40Khz airborne ultrasound simulations, and have a need to be able to plot the intensities in the acoustic field.  For this purpose, I believe the code would need access to u_non_staggered.  I added what I believe is the appropriate parameter set to record:&#60;/p&#62;
&#60;p&#62;% define the field parameters to record&#60;br /&#62;
sensor.record = {'p', 'p_final', 'u', 'I'};&#60;/p&#62;
&#60;p&#62;The presence of 'I' automatically makes a request for u_non_staggered.  When running this using the C++ binaries, however, I encounter the error 'ux_non_staggered' doesn't exist - see trace:&#60;/p&#62;
&#60;p&#62;Running k-Wave simulation...&#60;br /&#62;
  start time: 08-Aug-2016 08:49:35&#60;br /&#62;
  reference sound speed: 343m/s&#60;br /&#62;
  dt: 500ns, t_end: 1ms, time steps: 2001&#60;br /&#62;
  input grid size: 236 by 236 by 236 grid points (168.6417 by 168.6417 by 168.6417mm)&#60;br /&#62;
  maximum supported frequency: 240kHz&#60;br /&#62;
  expanding computational grid...&#60;br /&#62;
  computational grid size: 256 by 256 by 256 grid points&#60;br /&#62;
  precomputation completed in 7.2038s&#60;br /&#62;
  saving input files to disk...&#60;br /&#62;
  completed in 3.5143s&#60;br /&#62;
--------------------------------&#60;br /&#62;
  kspaceFirstOrder3D-OMP v1.1&#60;br /&#62;
--------------------------------&#60;br /&#62;
List of enabled parameters:&#60;br /&#62;
  Input  file               /private/tmp/kwave_input_data08-Aug-2016-08-49-35.h5&#60;br /&#62;
  Output file               /private/tmp/kwave_output_data08-Aug-2016-08-49-35.h5&#60;/p&#62;
&#60;p&#62;  Number of threads         8&#60;br /&#62;
  Verbose interval[%]       5&#60;br /&#62;
  Compression level         0&#60;/p&#62;
&#60;p&#62;  Benchmark flag            0&#60;br /&#62;
  Benchmark time steps      0&#60;/p&#62;
&#60;p&#62;  Checkpoint_file&#60;br /&#62;
  Checkpoint_interval       0&#60;/p&#62;
&#60;p&#62;  Store p_raw               1&#60;br /&#62;
  Store p_rms               0&#60;br /&#62;
  Store p_max               0&#60;br /&#62;
  Store p_min               0&#60;br /&#62;
  Store p_max_all           0&#60;br /&#62;
  Store p_min_all           0&#60;br /&#62;
  Store p_final             1&#60;/p&#62;
&#60;p&#62;  Store u_raw               1&#60;br /&#62;
  Store u_non_staggered_raw 1&#60;br /&#62;
  Store u_rms               0&#60;br /&#62;
  Store u_max               0&#60;br /&#62;
  Store u_min               0&#60;br /&#62;
  Store u_max_all           0&#60;br /&#62;
  Store u_min_all           0&#60;br /&#62;
  Store u_final             0&#60;/p&#62;
&#60;p&#62;  Copy sensor mask          0&#60;/p&#62;
&#60;p&#62;  Collection begins at      1&#60;br /&#62;
Number of CPU threads:         8&#60;br /&#62;
Domain dims:   [ 256,  256, 256]&#60;br /&#62;
Simulation time steps:      2001&#60;br /&#62;
--------------------------------&#60;br /&#62;
........ Initialization ........&#60;br /&#62;
Memory allocation ..........Done&#60;br /&#62;
Data loading................Done&#60;br /&#62;
Elapsed time:              0.33s&#60;br /&#62;
--------------------------------&#60;br /&#62;
.......... Computation .........&#60;br /&#62;
FFT plans creation..........Done&#60;br /&#62;
Pre-processing phase........Done&#60;br /&#62;
Current memory in use: 1900112MB&#60;br /&#62;
Elapsed time:              6.51s&#60;br /&#62;
-------------------------------------------------------------&#60;br /&#62;
....................... Simulation ..........................&#60;br /&#62;
Progress...ElapsedTime........TimeToGo......TimeOfTermination&#60;/p&#62;
&#60;p&#62;........&#60;/p&#62;
&#60;p&#62;-------------------------------------------------------------&#60;br /&#62;
Elapsed time:                                        1967.82s&#60;br /&#62;
-------------------------------------------------------------&#60;br /&#62;
Post-processing phase.......Done&#60;br /&#62;
Elapsed time:              0.32s&#60;br /&#62;
--------------------------------&#60;br /&#62;
............ Summary ...........&#60;br /&#62;
Peak memory in use:    1913592MB&#60;br /&#62;
Total execution time:   1975.68s&#60;br /&#62;
--------------------------------&#60;br /&#62;
       End of computation&#60;br /&#62;
--------------------------------&#60;br /&#62;
Error using h5readc&#60;br /&#62;
The HDF5 library encountered an error and produced the following stack trace information:&#60;/p&#62;
&#60;p&#62;    H5G_loc_find_cb      object 'ux_non_staggered' doesn't exist&#60;br /&#62;
    H5G_traverse_real    traversal operator failed&#60;br /&#62;
    H5G_traverse         internal path traversal failed&#60;br /&#62;
    H5G_loc_find         can't find object&#60;br /&#62;
    H5Dopen2             not found&#60;/p&#62;
&#60;p&#62;Error in h5read (line 58)&#60;br /&#62;
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);&#60;/p&#62;
&#60;p&#62;Error in kspaceFirstOrder3DC (line 462)&#60;br /&#62;
            sensor_data.ux_non_staggered = h5read(output_filename, '/ux_non_staggered');&#60;/p&#62;
&#60;p&#62;Error in uharray (line 301)&#60;br /&#62;
        sensor_data = kspaceFirstOrder3DC(kgrid, medium, source, sensor, 'PMLInside', false);&#60;/p&#62;
&#60;p&#62;As the simulations are quite intensive, I need the C++ code - Matlab alone would be a bit slow for this.  The question I have is whether or not this is already supported in the C++ code.  If yes, I must be doing something wrong.  If not, I'm happy to have a dig around the code to see what I need to modify.  I just thought I'd check with people in the know before I go down this route!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
