NVBIO
Main Page
Modules
Classes
Examples
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
nvbio
alignment
sink.h
Go to the documentation of this file.
1
/*
2
* nvbio
3
* Copyright (c) 2011-2014, NVIDIA CORPORATION. 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
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of the NVIDIA CORPORATION nor the
13
* names of its contributors may be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
* DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#pragma once
29
30
#include <
nvbio/basic/types.h
>
31
#include <
nvbio/basic/simd.h
>
32
33
namespace
nvbio {
34
namespace
aln {
35
40
49
53
struct
NullSink
54
{
60
template
<
typename
ScoreType>
61
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
62
void
report
(
const
ScoreType _score,
const
uint2 _sink) {}
63
};
64
68
template
<
typename
ScoreType>
69
struct
BestSink
70
{
71
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
72
BestSink
();
73
76
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
77
void
invalidate
();
78
84
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
85
void
report
(
const
ScoreType _score,
const
uint2 _sink);
86
87
ScoreType
score
;
88
uint2
sink
;
89
};
90
94
template
<>
95
struct
BestSink
<
simd4u8
>
96
{
97
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
98
BestSink
() :
score
(
uint32
(0) ) {}
99
104
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
105
void
report
(
const
simd4u8
_score) {
score
=
nvbio::max
(
score
, _score ); }
106
107
simd4u8
score
;
108
};
109
113
template
<
typename
ScoreType>
114
struct
Best2Sink
115
{
119
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
120
Best2Sink
(
const
uint32
distinct_dist = 0);
121
124
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
125
void
invalidate
();
126
132
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
133
void
report
(
const
ScoreType score,
const
uint2 sink);
134
135
ScoreType
score1
;
136
ScoreType
score2
;
137
uint2
sink1
;
138
uint2
sink2
;
139
140
private
:
141
uint32
m_distinct_dist;
142
};
143
148
template
<
typename
ScoreType, u
int
32 N = 16>
149
struct
BestColumnSink
150
{
154
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
155
BestColumnSink
(
const
uint32
column_width = 50,
const
ScoreType min_score =
Field_traits<ScoreType>::min
());
156
159
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
160
void
set_column_width
(
const
uint32
column_width) { m_column_width = column_width; }
161
164
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
165
void
set_min_score
(
const
uint32
min_score) { m_min_score = min_score; }
166
169
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
170
void
invalidate
();
171
177
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
178
void
report
(
const
ScoreType score,
const
uint2 sink);
179
182
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE
183
void
best2
(
uint32
& i1,
uint32
& i2,
const
uint32
min_dist)
const
;
184
185
ScoreType
scores
[N+1];
186
uint2
sinks
[N+1];
187
188
private
:
189
uint32
m_column_width;
190
ScoreType m_min_score;
191
};
192
194
196
197
}
// namespace aln
198
}
// namespace nvbio
199
200
#include <
nvbio/alignment/sink_inl.h
>
Generated on Wed Feb 25 2015 08:32:53 for NVBIO by
1.8.4