I want to split a flux into two fluxes where the first one has the first item of the original flux and the second one will takes the rest of items.
After applying a custom transformation myLogic
on each flux I want to combine them into one flux preserving the order of the original flux.
Example:
S: student
S': student after applying myLogic
Emitted flux: s1 -> s2 -> s3 -> s4
The first splited flux: s1' => myLogic
The second splited flux: s2' -> s3' -> s4' => myLogic
The combined flux: s1' -> s2' -> s3' -> s4'
Such a flux-split-based FDM consists of two steps. In the first step, flux vector splitting (FVS) methods, such as the Steger–Warming FVS [16] and van Leer FVS [17], [18], are frequently used to split the flux vector into positive and negative flux vectors.
We will further study the types of Heat Flux and the heat flux formula. What is Heat Flux? Heat flux also named as thermal flux, is referred to as heat flux density, heat-flow density is a flow of energy per unit of area per unit of time.
os.path.split () method in Python is used to Split the path name into a pair head and tail. Here, tail is the last path name component and head is everything leading up to that. For example consider the following path name: path name = '/home/User/Desktop/file.txt'.
where Q is the heat transfer rate, A is the cross-sectional through which the heat transfer is taking place, is the heat flux. Heat dissipated by each chip = 0.12 W
It is enough to use standard Flux
methods take
and skip
to seprate head and tail elements. Calling cache
before that is also useful to avoid subscription duplication.
class Util {
static <T, V> Flux<V> dualTransform(
Flux<T> originalFlux,
int cutpointIndex,
Function<T, V> transformHead,
Function<T, V> transformTail
) {
var cached = originalFlux.cache();
var head = cached.take(cutpointIndex).map(transformHead);
var tail = cached.skip(cutpointIndex).map(transformTail);
return Flux.concat(head, tail);
}
static void test() {
var sample = Flux.just("a", "b", "c", "d");
var result = dualTransform(
sample,
1,
x -> "{" + x.toUpperCase() + "}",
x -> "(" + x + ")"
);
result.doOnNext(System.out::print).subscribe();
// prints: {A}(b)(c)(d)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With