1 /*
2  * Copyright (c) 2012-2019, The University of Oxford
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright notice,
8  *    this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  *    this list of conditions and the following disclaimer in the documentation
11  *    and/or other materials provided with the distribution.
12  * 3. Neither the name of the University of Oxford nor the names of its
13  *    contributors may be used to endorse or promote products derived from this
14  *    software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef OSKAR_MEM_H_
30 #define OSKAR_MEM_H_
31 
32 /**
33  * @file oskar_mem.h
34  *
35  * @brief Structure to wrap a memory pointer either on the CPU or GPU.
36  *
37  * @details
38  * This structure holds a pointer to memory either on the CPU
39  * or GPU, and defines the type of the data to which it points.
40  *
41  * The structure will normally take ownership of the memory, so the
42  * memory will be released when the structure is freed.
43  */
44 
45 #include <oskar_global.h>
46 
47 /* Public interface. */
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 struct oskar_Mem;
54 #ifndef OSKAR_MEM_TYPEDEF_
55 #define OSKAR_MEM_TYPEDEF_
56 typedef struct oskar_Mem oskar_Mem;
57 #endif /* OSKAR_MEM_TYPEDEF_ */
58 
59 enum OSKAR_MEM_LOCATION
60 {
61     OSKAR_CPU = 0,
62     OSKAR_GPU = 1,
63     /* Bit-field, for future expansion. */
64     OSKAR_CL = 2
65 };
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #include <binary/oskar_binary_data_types.h>
72 #include <mem/oskar_mem_accessors.h>
73 #include <mem/oskar_mem_add.h>
74 #include <mem/oskar_mem_add_real.h>
75 #include <mem/oskar_mem_append_raw.h>
76 #include <mem/oskar_mem_clear_contents.h>
77 #include <mem/oskar_mem_copy.h>
78 #include <mem/oskar_mem_copy_contents.h>
79 #include <mem/oskar_mem_convert_precision.h>
80 #include <mem/oskar_mem_create.h>
81 #include <mem/oskar_mem_create_alias.h>
82 #include <mem/oskar_mem_create_alias_from_raw.h>
83 #include <mem/oskar_mem_create_copy.h>
84 #include <mem/oskar_mem_data_type_string.h>
85 #include <mem/oskar_mem_different.h>
86 #include <mem/oskar_mem_element_size.h>
87 #include <mem/oskar_mem_ensure.h>
88 #include <mem/oskar_mem_evaluate_relative_error.h>
89 #include <mem/oskar_mem_free.h>
90 #include <mem/oskar_mem_get_element.h>
91 #include <mem/oskar_mem_load_ascii.h>
92 #include <mem/oskar_mem_multiply.h>
93 #include <mem/oskar_mem_normalise.h>
94 #include <mem/oskar_mem_random_gaussian.h>
95 #include <mem/oskar_mem_random_range.h>
96 #include <mem/oskar_mem_random_uniform.h>
97 #include <mem/oskar_mem_read_binary_raw.h>
98 #include <mem/oskar_mem_read_element.h>
99 #include <mem/oskar_mem_read_fits.h>
100 #include <mem/oskar_mem_read_fits_image_plane.h>
101 #include <mem/oskar_mem_read_healpix_fits.h>
102 #include <mem/oskar_mem_realloc.h>
103 #include <mem/oskar_mem_save_ascii.h>
104 #include <mem/oskar_mem_scale_real.h>
105 #include <mem/oskar_mem_set_alias.h>
106 #include <mem/oskar_mem_set_element.h>
107 #include <mem/oskar_mem_set_value_real.h>
108 #include <mem/oskar_mem_stats.h>
109 #include <mem/oskar_mem_write_fits_cube.h>
110 #include <mem/oskar_mem_write_healpix_fits.h>
111 
112 #endif /* OSKAR_MEM_H_ */
113